00001 
00002 #ifndef  __JBXL_PROTOCOL_H_
00003 #define  __JBXL_PROTOCOL_H_
00004 
00005 
00029 #include "xtools.h"
00030 
00031 
00032 
00033 #define HDLIST_FIRST_LINE_KEY       "FIRST_LINE"
00034 #define HDLIST_CONTENTS_KEY         "CONTENTS_DATA"
00035 #define HDLIST_CONTINUE             "HEADER_CONTINUE"
00036 #define HDLIST_END_KEY              "HEADER_END"
00037 
00038 
00040 
00041 
00042 tList*  get_protocol_header_list(Buffer buf, char deli, int fstline, int rcntnt);
00043 Buffer  restore_protocol_header (tList* pp, char* deli, int mode, int* hdsz);
00044 
00045 Buffer  restore_protocol_contents(tList* pp);
00046 void    set_protocol_contents(tList* pp, Buffer cnt);
00047 
00048 tList*  get_protocol_header_list_seq(tList* list, Buffer buf, char deli, int fstline, int rcntnt);
00049 tList*  get_protocol_header_list_file(char* fname, char deli, int fstline, int rcntnt);
00050 
00051 
00052 #define create_protocol_header(p, k, v)                     add_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)
00053 #define add_protocol_header(p, k, v)                        add_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)
00054 #define create_protocol_header_Buffer(p, k, v)              add_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)
00055 #define add_protocol_header_Buffer(p, k, v)                 add_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)
00056 #define delete_protocol_header(p, k, n)                     del_tList_key((p), (k), (n))
00057 
00058 
00059 Buffer  search_protocol_header(tList* list, char* key, int no);
00060 Buffer  search_protocol_header_item (tList* list, char* key, int no, char deli, int nm);
00061 Buffer  search_protocol_header_value(tList* list, char* key, char* data, int no);
00062 Buffer  search_protocol_header_partvalue(tList* list, char* key, char* data, int no);
00063 
00064 #define get_protocol_header(l, k, n)                        search_protocol_header((l), (k), (n))
00065 #define get_protocol_header_item(l, k, n, d, m)             search_protocol_header_item((l), (k), (n), (d), (m))
00066 #define get_protocol_header_value(l, k, d, n)               search_protocol_header_value((l), (k), (d), (n)) 
00067 #define get_protocol_header_partvalue(l, k, d, n)           search_protocol_header_partvalue((l), (k), (d), (n))
00068 
00069 
00070 
00071 int     set_protocol_header(tList* list, char* key, char* value, int no, int mode);
00072 
00073 #define set_protocol_record_item(l, d, m, v)                set_item_tList_node((l), (d), (m), (v))
00074 #define replace_protocol_record_item(l, d, m, s, v)         replace_item_tList_node((l), (d), (m), (s), (v))
00075 
00076 
00092 #define replace_protocol_header(list, key, no, srcval, value)   replace_value_tList((list), (key), (no), (srcval), (value))
00093 
00094 
00109 #define replace_protocol_header_item(list, key, no, deli, nm, srcval, value)  replace_item_tList((list), (key), (no), (deli), (nm), (srcval), (value))
00110 
00111 
00125 #define set_protocol_header_item(list, key, no, deli, nm, value)        set_item_tList((list), (key), (no), (deli), (nm), (value))
00126 
00127 
00128 
00129 int     search_crlfcrlf(char* mesg);
00130 int     is_header_continue(tList* lp);
00131 
00132 void    print_protocol_header(tList* lp, int content);
00133 
00134 tList*  find_protocol_end(tList* lp);
00135 #endif
00136 
00137 
00138