| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef GETPARAM_H
- #define GETPARAM_H
- #pragma once
- #include "config.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- /*
- * protocol msg parsing utility
- * each call parse a line
- * line = <fullname>:<whitespace+><value>\r\n
- * the msg ends with \r\n\r\n
- */
- #define PROTOPARSE_IGNOREWHITESPACE 1
- #define PROTOPARSE_CASESENSITIVE 2
- struct proto_param
- {
- const char *fname; /* fullname */
- int mode; /* see PROTOPARSE_xxx */
- int sname; /* short name */
- };
- /**
- * parsing funtion
- * @param buf original protocol msg buffer, must be ends with CRLFCRLF
- * @param params pointers to proto_param array, end element must be fill with zero members
- * @param pval pointer to value
- * @param plen pval length
- * @param ctx context store current parsing position in the buf,
- * init value is null, user don't access
- * @return -1 indicate finished
- */
- TOOLKIT_API int getparam(const char *buf,
- const struct proto_param *params,
- const char **pval,
- int *plen,
- const char **ctx);
- #ifdef __cplusplus
- } // extern "C" {
- #endif
- #endif // GETPARAM_H
|