myht_util.h
最終更新:2009/11/9
001: /* myht_util.c 002: * HTTP 用ユーティリティ 003: */ 004: 005: #ifndef _MYHT_UTIL_H_ 006: #define _MYHT_UTIL_H_ 007: 008: #ifndef APR_STRINGS_H 009: #include "apr_strings.h" 010: #endif 011: #ifndef APR_URI_H 012: #include "apr_uri.h" 013: #endif 014: #ifndef APR_TABLES_H 015: #include "apr_tables.h" 016: #endif 017: 018: /* 019: * 1行の文字列からデリミタで区切られた3つの文字列を読み出す関数 020: * 文字列の領域も確保する。 021: * 各文字列はヌル文字で終端される。 022: * 返り値: 023: * 読み出せた文字列の個数。 024: * エラー時には -1。 025: * ・入力文字列は書き換えられることに注意 026: */ 027: 028: int read_3strs ( 029: char *line /* IN: 入力文字列 */ 030: , char **x1 /* OUT: 1番目の文字列へのポインタ */ 031: , char **x2 /* OUT: 2番目の文字列へのポインタ */ 032: , char **x3 /* OUT: 3番目の文字列へのポインタ */ 033: , char delim /* IN: デリミタ文字 */ 034: ); 035: 036: #define read_rsp_line(line,ver,stat,reason,delim) \ 037: read_3strs((line),(ver),(stat),(reason),(delim)) 038: 039: /* ヘッダ文字列からヘッダ名・ヘッダの値を抽出し、 040: * テーブルに保存する関数 041: * 042: */ 043: 044: void set_entity_header_to_tab ( 045: char *line 046: , apr_table_t *tab 047: ); 048: 049: /* 050: * テーブル各キー・値の表示 051: * ctx に apr_file_t* の出力ストリームを指定する。 052: */ 053: 054: int disp_tab (void *ctx, const char *key, const char *value); 055: 056: /* URI のパース 057: * 成功:1 058: * 失敗:0 059: */ 060: 061: int my_uri_parse( 062: apr_pool_t *pool 063: , const char *uri_str 064: , apr_uri_t *uri 065: ); 066: #endif /* _MYHT_UTIL_H_ */
KAKU PROJECT (2009) |