00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _MSG_TRANSLATOR_H
00038 #define _MSG_TRANSLATOR_H
00039
00040 #define MY_HF_SEP ": "
00041 #define MY_HF_SEP_LEN 2
00042
00043 #define BRANCH_SEPARATOR '.'
00044 #define WARNING "Warning: 392 "
00045 #define WARNING_LEN (sizeof(WARNING)-1)
00046 #define WARNING_PHRASE " \"Noisy feedback tells: "
00047 #define WARNING_PHRASE_LEN (sizeof(WARNING_PHRASE)-1)
00048
00049
00050
00051 #include "parser/msg_parser.h"
00052 #include "ip_addr.h"
00053
00054
00055 struct bookmark {
00056 str to_tag_val;
00057 };
00058
00059
00060 struct hostport {
00061 str* host;
00062 str* port;
00063 };
00064
00065
00066 #define set_hostport(hp, msg) \
00067 do{ \
00068 if ((msg) && ((struct sip_msg*)(msg))->set_global_address.len) \
00069 (hp)->host=&(((struct sip_msg*)(msg))->set_global_address); \
00070 else \
00071 (hp)->host=&default_global_address; \
00072 if ((msg) && ((struct sip_msg*)(msg))->set_global_port.len) \
00073 (hp)->port=&(((struct sip_msg*)(msg))->set_global_port); \
00074 else \
00075 (hp)->port=&default_global_port; \
00076 }while(0)
00077
00078 char * build_req_buf_from_sip_req ( struct sip_msg* msg,
00079 unsigned int *returned_len, struct dest_info* send_info);
00080
00081 char * build_res_buf_from_sip_res( struct sip_msg* msg,
00082 unsigned int *returned_len);
00083
00084
00085 char * build_res_buf_from_sip_req( unsigned int code ,
00086 char *text ,
00087 str *new_tag ,
00088 struct sip_msg* msg,
00089 unsigned int *returned_len,
00090 struct bookmark *bmark);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 char* via_builder( unsigned int *len,
00105 struct dest_info* send_info,
00106 str *branch, str* extra_params, struct hostport *hp );
00107
00108
00109
00110 char* create_via_hf( unsigned int *len,
00111 struct sip_msg *msg,
00112 struct dest_info* send_info ,
00113 str* branch);
00114
00115 int branch_builder( unsigned int hash_index,
00116
00117 unsigned int label, char * char_v,
00118 int branch,
00119
00120 char *branch_str, int *len );
00121
00122 char* id_builder(struct sip_msg* msg, unsigned int *id_len);
00123
00124
00125 int received_test( struct sip_msg *msg );
00126
00127
00128
00129
00130 char * build_only_headers( struct sip_msg* msg, int skip_first_line,
00131 unsigned int *returned_len,
00132 int *error,
00133 struct dest_info* send_info);
00134
00135
00136
00137
00138 char * build_body( struct sip_msg* msg,
00139 unsigned int *returned_len,
00140 int *error,
00141 struct dest_info* send_info);
00142
00143
00144
00145
00146
00147 char * build_all( struct sip_msg* msg, int adjust_clen,
00148 unsigned int *returned_len,
00149 int *error,
00150 struct dest_info* send_info);
00151
00153 void fix_global_req_flags(str* gname, str* name);
00154
00155 #endif