strparser: Stream parser for messages
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 ...
Showing
- include/net/strparser.h 145 additions, 0 deletionsinclude/net/strparser.h
- net/Kconfig 1 addition, 0 deletionsnet/Kconfig
- net/Makefile 1 addition, 0 deletionsnet/Makefile
- net/strparser/Kconfig 4 additions, 0 deletionsnet/strparser/Kconfig
- net/strparser/Makefile 1 addition, 0 deletionsnet/strparser/Makefile
- net/strparser/strparser.c 492 additions, 0 deletionsnet/strparser/strparser.c
Please register or sign in to comment