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 #define BUILD_NO_LOCAL_VIA (1<<0)
00052 #define BUILD_NO_VIA1_UPDATE (1<<1)
00053 #define BUILD_NO_PATH (1<<2)
00054 #define BUILD_IN_SHM (1<<7)
00055
00056 #include "parser/msg_parser.h"
00057 #include "ip_addr.h"
00058
00059
00060 struct bookmark {
00061 str to_tag_val;
00062 };
00063
00064
00065 struct hostport {
00066 str* host;
00067 str* port;
00068 };
00069
00070
00071 #define set_hostport(hp, msg) \
00072 do{ \
00073 if ((msg) && ((struct sip_msg*)(msg))->set_global_address.len) \
00074 (hp)->host=&(((struct sip_msg*)(msg))->set_global_address); \
00075 else \
00076 (hp)->host=&default_global_address; \
00077 if ((msg) && ((struct sip_msg*)(msg))->set_global_port.len) \
00078 (hp)->port=&(((struct sip_msg*)(msg))->set_global_port); \
00079 else \
00080 (hp)->port=&default_global_port; \
00081 }while(0)
00082
00083 char * build_req_buf_from_sip_req(struct sip_msg* msg,
00084 unsigned int *returned_len, struct dest_info* send_info,
00085 unsigned int mode);
00086
00087 char * build_res_buf_from_sip_res(struct sip_msg* msg,
00088 unsigned int *returned_len);
00089
00090
00091 char * build_res_buf_from_sip_req(unsigned int code,
00092 str *text,
00093 str *new_tag,
00094 struct sip_msg* msg,
00095 unsigned int *returned_len,
00096 struct bookmark *bmark);
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 char* via_builder( unsigned int *len,
00111 struct dest_info* send_info,
00112 str *branch, str* extra_params, struct hostport *hp );
00113
00114
00115
00116 char* create_via_hf( unsigned int *len,
00117 struct sip_msg *msg,
00118 struct dest_info* send_info ,
00119 str* branch);
00120
00121 int branch_builder( unsigned int hash_index,
00122
00123 unsigned int label, char * char_v,
00124 int branch,
00125
00126 char *branch_str, int *len );
00127
00128 char* id_builder(struct sip_msg* msg, unsigned int *id_len);
00129
00130
00131 int received_test( struct sip_msg *msg );
00132
00133
00134
00135
00136 char * build_only_headers( struct sip_msg* msg, int skip_first_line,
00137 unsigned int *returned_len,
00138 int *error,
00139 struct dest_info* send_info);
00140
00141
00142
00143
00144 char * build_body( struct sip_msg* msg,
00145 unsigned int *returned_len,
00146 int *error,
00147 struct dest_info* send_info);
00148
00149
00150
00151
00152
00153 char * build_all( struct sip_msg* msg, int adjust_clen,
00154 unsigned int *returned_len,
00155 int *error,
00156 struct dest_info* send_info);
00157
00159 void fix_global_req_flags(str* gname, str* name);
00160
00161 int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len,
00162 unsigned int id);
00163 #endif