Skip to content
  • Tom Herbert's avatar
    strparser: Stream parser for messages · 43a0c675
    Tom Herbert authored
    This patch introduces a utility for parsing application layer protocol
    messages in a TCP stream. This is a generalization of the mechanism
    implemented of Kernel Connection Multiplexor.
    
    The API includes a context structure, a set of callbacks, utility
    functions, and a data ready function.
    
    A stream parser instance is defined by a strparse structure that
    is bound to a TCP socket. The function to initialize the structure
    is:
    
    int strp_init(struct strparser *strp, struct sock *csk,
                  struct strp_callbacks *cb);
    
    csk is the TCP socket being bound to and cb are the parser callbacks.
    
    The upper layer calls strp_tcp_data_ready when data is ready on the lower
    socket for strparser to process. This should be called from a data_ready
    callback that is set on the socket:
    
    void strp_tcp_data_ready(struct strparser *strp);
    
    A parser is bound to a TCP socket by setting data_ready function to
    strp_tcp_data_ready so that all receive indications on the socket
    go through the ...
    43a0c675