 import LoggerAPI
 import Socket
 
-/// This class processes the data sent by the client after the data was read. The data
-/// is parsed, filling in a `HTTPServerRequest` object. When the parsing is complete, the
-/// `ServerDelegate` is invoked.
+
+/**
+This class processes the data sent by the client after the data was read. The data is parsed, filling in a `HTTPServerRequest` object. When the parsing is complete, the `ServerDelegate` is invoked.
+ 
+### Usage Example: ###
+````swift
+ //Create an `IncomingHTTPSocketProcessor` object.
+ var processor : IncomingHTTPSocketProcessor?
+ 
+ //Write from an NSMutableData buffer.
+ processor.write(from: NSMutableData)
+ 
+ //Write from a data object.
+ processor.write(from: utf8, length: utf8Length)
+ ````
+ */
 public class IncomingHTTPSocketProcessor: IncomingSocketProcessor {
     
-    /// A back reference to the `IncomingSocketHandler` processing the socket that
-    /// this `IncomingDataProcessor` is processing.
+    /**
+     A back reference to the `IncomingSocketHandler` processing the socket that
+     this `IncomingDataProcessor` is processing.
+     
+     ### Usage Example: ###
+     ````swift
+     processor?.handler = handler
+     ````
+     */
     public weak var handler: IncomingSocketHandler?
         
     private weak var delegate: ServerDelegate?
     
-    /// Keep alive timeout for idle sockets in seconds
+    /**
+     Keep alive timeout for idle sockets in seconds
+     
+     ### Usage Example: ###
+     ````swift
+     print("timeout=\(Int(IncomingHTTPSocketProcessor.keepAliveTimeout))")
+     ````
+     */
     static let keepAliveTimeout: TimeInterval = 60
     
     /// A flag indicating that the client has requested that the socket be kept alive
     private(set) var clientRequestedKeepAlive = false
     
-    /// The socket if idle will be kep alive until...
+    /**
+     The socket if idle will be kep alive until...
+     
+     ### Usage Example: ###
+     ````swift
+     processor?.keepAliveUntil = 0.0
+     ````
+     */
     public var keepAliveUntil: TimeInterval = 0.0
     
     /// A flag indicating that the client has requested that the prtocol be upgraded
     private(set) var isUpgrade = false
     
-    /// A flag that indicates that there is a request in progress
+    /**
+     A flag that indicates that there is a request in progress
+     
+     ### Usage Example: ###
+     ````swift
+     processor?.inProgress = false
+     ````
+     */
     public var inProgress = true
     
     ///HTTP Parser

        handler?.prepareToClose()
    }
    
    /// Called by the `IncomingSocketHandler` to tell us that the socket has been closed
    /// by the remote side. 
    public func socketClosed() {
        keepAliveUntil=0.0
        inProgress = false

        self.keepAliveState = keepalive
    }
    
    /**
     Process data read from the socket. It is either passed to the HTTP parser or
     it is saved in the Pseudo synchronous reader to be read later on.
     
     - Parameter buffer: An NSData object that contains the data read from the socket.
     
     - Returns: true if the data was processed, false if it needs to be processed later.
     
     ### Usage Example: ###
     ````swift
     let processed = processor.process(readBuffer)
     ````
     */
    public func process(_ buffer: NSData) -> Bool {
        let result: Bool
        
