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 #ifndef _UAC_H
00034 #define _UAC_H
00035
00036 #include <stdio.h>
00037 #include "../../str.h"
00038 #include "dlg.h"
00039 #include "t_hooks.h"
00040 #include "h_table.h"
00041
00042 #define DEFAULT_CSEQ 10
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 typedef struct uac_req {
00054 str *method;
00055 str *headers;
00056 str *body;
00057 dlg_t *dialog;
00058 int cb_flags;
00059 transaction_cb *cb;
00060 void *cbp;
00061 } uac_req_t;
00062
00063
00064 #define set_uac_req(_req, \
00065 _m, _h, _b, _dlg, _cb_flags, _cb, _cbp) \
00066 do { \
00067 (_req)->method = (_m); \
00068 (_req)->headers = (_h); \
00069 (_req)->body = (_b); \
00070 (_req)->dialog = (_dlg); \
00071 (_req)->cb_flags = (_cb_flags); \
00072 (_req)->cb = (_cb); \
00073 (_req)->cbp = (_cbp); \
00074 } while (0)
00075
00076
00077 #ifdef WITH_EVENT_LOCAL_REQUEST
00078
00079 extern int goto_on_local_req;
00080 #endif
00081
00082
00083
00084
00085 typedef int (*reqwith_t)(uac_req_t *uac_r);
00086 typedef int (*reqout_t)(uac_req_t *uac_r, str* ruri, str* to, str* from, str *next_hop);
00087 typedef int (*req_t)(uac_req_t *uac_r, str* ruri, str* to, str* from, str *next_hop);
00088 typedef int (*t_uac_t)(uac_req_t *uac_r);
00089 typedef int (*t_uac_with_ids_t)(uac_req_t *uac_r,
00090 unsigned int *ret_index, unsigned int *ret_label);
00091 #ifdef WITH_AS_SUPPORT
00092 typedef int (*ack_local_uac_f)(struct cell *trans, str *hdrs, str *body);
00093 #endif
00094 typedef int (*prepare_request_within_f)(uac_req_t *uac_r,
00095 struct retr_buf **dst_req);
00096 typedef void (*send_prepared_request_f)(struct retr_buf *request_dst);
00097 typedef void (*generate_fromtag_f)(str*, str*);
00098
00099
00100
00101
00102 void generate_fromtag(str* tag, str* callid);
00103
00104
00105
00106
00107
00108 int uac_init(void);
00109
00110
00111
00112
00113
00114 int t_uac(uac_req_t *uac_r);
00115
00116
00117
00118
00119
00120 int t_uac_with_ids(uac_req_t *uac_r,
00121 unsigned int *ret_index, unsigned int *ret_label);
00122
00123
00124
00125 int req_within(uac_req_t *uac_r);
00126
00127
00128
00129
00130
00131 int req_outside(uac_req_t *uac_r, str* ruri, str* to, str* from, str* next_hop);
00132
00133
00134 #ifdef WITH_AS_SUPPORT
00135 struct retr_buf *local_ack_rb(sip_msg_t *rpl_2xx, struct cell *trans,
00136 unsigned int branch, str *hdrs, str *body);
00137 void free_local_ack(struct retr_buf *lack);
00138 void free_local_ack_unsafe(struct retr_buf *lack);
00139
00143 int ack_local_uac(struct cell *trans, str *hdrs, str *body);
00144 #endif
00145
00146
00147
00148
00149 int request(uac_req_t *uac_r, str* ruri, str* to, str* from, str *next_hop);
00150
00151 int prepare_req_within(uac_req_t *uac_r,
00152 struct retr_buf **dst_req);
00153
00154 void send_prepared_request(struct retr_buf *request);
00155
00156
00157 #endif