scanner.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 88 行

H
88
字号
/*******************************************************************
 * 
 *  Copyright C 2004 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: HTTP/HTTP MIME tokenizer
 *
 *  Author: Eric Knudstrup
 *  Created: Fri Jan 14 16:27:35 2005
 *
 *******************************************************************/

#ifndef SCANNER_H
#define SCANNER_H

/**
 * @file scanner.h HTTP scanner/tokenizer.
 * @internal
 */

/** @addtogroup http_parser */
/*@{*/

typedef enum {
    TT_NONE = 0,        /**< Start state. */
    TT_IDENTIFIER,      /**< alphanumeric text */
    TT_WHITESPACE,      /**< Spaces, tabs, etc. */
    TT_SEPARATOR,       /**< HTTP separators */
    TT_CR,              /**< Carriage return. */
    TT_CRLF,            /**< CRLF */
    TT_CTRL,            /**< Control character */
    TT_TEXT,            /**< Quoted text */
} http_token_type_t;

#define HTTP_TOKEN_LEN        1024
typedef struct {
    char            t_token[HTTP_TOKEN_LEN+1];
    int             t_token_len;
    http_token_type_t t_type;
} http_token_t;

extern const char http_separator_chars[];

/*;emacs generated header for file scanner.c. Global function declarations only. */
extern void
http_scanner_reset(HTTPParser *parser);

/* http_get_token()
 * Get an identifier according to the HTTP RFC's definition of the term.
 *
 * @param [in,out] parser
 * @param [in] accepted_separators String of accepted separator characters
 * @param [in] added_separators String of additional separator characters
 */
extern HTTPParseStatus
http_get_token(HTTPParser *parser, 
 const char *accepted_separators,
 const char *added_separators);

/* http_scan_bol()
 * Get an identifier according to the HTTP RFC's definition of the term.
 * If it is the beginning of a line then we need to just check for CRLF and
 * not go through whitespace.
 *
 * @param [in,out] parser
 * @param [in] is_bol Pass true to specify that it is the beginning of a line.
 * @param [in] accepted_separators String of accepted separator characters
 * @param [in] added_separators String of additional separator characters
 */
extern HTTPParseStatus
http_scan_bol(HTTPParser *parser, 
 int is_bol,
 const char *accepted_separators,
 const char *added_separators);

extern char *http_token_str(http_token_t *t);

extern void http_token_reset(http_token_t *t);

extern http_token_type_t http_token_type(http_token_t *t);

extern int http_token_len(http_token_t *t);


/*;end emacs generated header for file scanner.c. Global function declarations only. */

#endif
/*@}*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?