http_parse.h

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

H
157
字号
/*******************************************************************
 * 
 *  Copyright C 2004 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: HTTP Parser header file.
 *
 *  Author: Eric Knudstrup
 *  Created: Wed Dec 29 13:50:14 2004
 *
 *******************************************************************/

#ifndef HTTP_PARSE_H
#define HTTP_PARSE_H

/**
 * @file http_parse.h
 * HTTP Parser core.  Provided by http_core.lib.
 */

#include "http_types.h"

/** @defgroup http_parser HTTP Parser routines
 * @ingroup Network
 */

/*@{*/

/*;emacs generated header for file http_parse.c. Global function declarations only. */
/**
 * Given an HTTP content descriptor, a buffer pointer, and an
 * increment, try to reallocate a buffer for the content descriptor.
 * @returns HTTP_STATUS_NEEDMORE if successful, HTTP_STATUS_ENOMEM otherwise.
 */
extern HTTPParseStatus
http_realloc_buffer(HTTPContentDescriptor *cd, char **buffer, int increment);
/** 
 * Flush all state for the previous request/response.
 * @param [in] parser HTTPParser to operate on.
 */
extern void
http_parser_reset(HTTPParser *parser);

/**
 * Set the user's context for an \a HTTPParser
 */
extern void
http_parser_set_context(HTTPParser *parser, void *context);

/**
 * Fetch the user's context for an \a HTTPParser
 */
extern void *
http_parser_context(HTTPParser *parser);

/**
 * Returns the minor registered by http_core_parser_create().
 * @param [in] parser HTTPParser to operate on.
 * @returns minor version.
 */
extern int
http_parser_minor(HTTPParser *parser);

/**
 * Returns the major registered by http_core_parser_create().
 * @param [in] parser HTTPParser to operate on.
 * @returns major version.
 */
extern int
http_parser_major(HTTPParser *parser);

/**
 * Returns the protocol registered by http_core_parser_create().
 * @param [in] parser HTTPParser to operate on.
 * @returns protocol string.
 */
extern const char *
http_parser_proto(HTTPParser *parser);

/**
 * Add a pbuf's data onto an HTTPParser's input queue.
 * @param [in] parser Parser to add data to.
 * @param [in] pbuf containing input data.
 */
extern void
http_parser_enqueue(HTTPParser *parser, struct pbuf *pbuf);

extern void
http_parser_clear_consumed_count(HTTPParser *parser);

extern int
http_parser_consumed_count(HTTPParser *parser);

/**
 * Free all context for an HTTPParser.
 * @param [in] parser to delete.
 */
extern void
http_parser_delete(HTTPParser *parser);

/**
 * Create a duplicate http parser using \a original's context.
 *
 * @param [in] original HTTPParser to copy.
 * @returns A new HTTPParser if successful.
 */
extern HTTPParser *
http_parser_duplicate(HTTPParser *original);

/**
 * Create an HTTP parser.
 *
 * @param [in] content_init_cb Callback to initialize content reception.
 * @param [in] filter_cb Function to call before processing input.
 * @param [in] user_context Opaque user data.
 * @param [in] proto Protocol, such as "HTTP" or "RTSP".
 * @param [in] major Major version (eg: 1).
 * @param [in] minor Minor version (eg: 1).
 *
 * If allocation succeeded, a new HTTPParser will be returned.
 */
extern HTTPParser *
http_core_parser_create(HTTPContentInitCb content_init_cb, 
 HTTPPreParseFunc filter_cb,
 void *user_context,
 char *proto, unsigned short major, unsigned short minor);

/**
 * Peek at a character from the input stream. Returns a ' a null character if no more
 * input is waiting. The input stream is not modified.
 * @param [in] parser HTTPParser to retrieve data for.
 * @returns A character.
 */
extern char http_parser_peek(HTTPParser *parser);

/**
 * Retrieve a character from the input stream. Returns a null character if no more
 * input is waiting.
 * @param [in] parser HTTPParser to retrieve data for.
 * @returns A character.
 */
extern char http_parser_getch(HTTPParser *parser);

/**
 * Parse and dispatch HTTP responses
 */
extern HTTPParseStatus
http_parse(HTTPParser *parser);

extern void
http_parser_change_state(HTTPParser *parser, HTTPParserState new_state);


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

#endif
/*@}*/

⌨️ 快捷键说明

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