 }
 
 /// This is the IP stack that receives and outputs IP packets.
+///
+/// `outputBlock` and `delegate` should be set before any input.
+/// Then call `receivedPacket()` when a new IP packet is read from the TUN interface.
+///
+/// There is a timer running internally. When the device is going to sleep (which means the timer will not fire for some time), then the timer must be paused by calling `suspendTimer()` and resumed by `resumeTimer` when the deivce wakes up.
 public class TSIPStack {
+    /// The singleton stack instance that developer should use. The `init()` method is a private method, which means there will never be more than one IP stack running at the same time.
     public static var stack = TSIPStack()
 
     // The whole stack is running in this dispatch queue.

    let timer: dispatch_source_t
    let listenPCB: UnsafeMutablePointer<tcp_pcb>

    public var outputBlock: (([NSData], [NSNumber]) -> ())!

    public weak var delegate: TSIPStackDelegate?

    // Since all we need is a mock interface, we just use the loopback interface provided by lwip.
    // Do not need to add any interface.
    var interface: UnsafeMutablePointer<netif> {
        return netif_list
    }

        }
    }

    /**
     Input an IP packet.

     - parameter data: the data containing the whole IP packet.
     */
    public func receivedPacket(data: NSData) {
        dispatch_call {
            // Due to the limitation of swift, if we want a zero-copy implemention, we have to change the definition of `pbuf.payload` to `const`, which is not possible.
