1 /**
2  * @file re_sipsess.h  SIP Session
3  *
4  * Copyright (C) 2010 Creytiv.com
5  */
6 
7 struct sipsess_sock;
8 struct sipsess;
9 
10 
11 typedef void (sipsess_conn_h)(const struct sip_msg *msg, void *arg);
12 typedef int  (sipsess_offer_h)(struct mbuf **descp, const struct sip_msg *msg,
13 			       void *arg);
14 typedef int  (sipsess_answer_h)(const struct sip_msg *msg, void *arg);
15 typedef void (sipsess_progr_h)(const struct sip_msg *msg, void *arg);
16 typedef void (sipsess_estab_h)(const struct sip_msg *msg, void *arg);
17 typedef void (sipsess_info_h)(struct sip *sip, const struct sip_msg *msg,
18 			      void *arg);
19 typedef void (sipsess_refer_h)(struct sip *sip, const struct sip_msg *msg,
20 			       void *arg);
21 typedef void (sipsess_close_h)(int err, const struct sip_msg *msg, void *arg);
22 
23 
24 int  sipsess_listen(struct sipsess_sock **sockp, struct sip *sip,
25 		    int htsize, sipsess_conn_h *connh, void *arg);
26 
27 int  sipsess_connect(struct sipsess **sessp, struct sipsess_sock *sock,
28 		     const char *to_uri, const char *from_name,
29 		     const char *from_uri, const char *cuser,
30 		     const char *routev[], uint32_t routec,
31 		     const char *ctype, struct mbuf *desc,
32 		     sip_auth_h *authh, void *aarg, bool aref,
33 		     sipsess_offer_h *offerh, sipsess_answer_h *answerh,
34 		     sipsess_progr_h *progrh, sipsess_estab_h *estabh,
35 		     sipsess_info_h *infoh, sipsess_refer_h *referh,
36 		     sipsess_close_h *closeh, void *arg, const char *fmt, ...);
37 
38 int  sipsess_accept(struct sipsess **sessp, struct sipsess_sock *sock,
39 		    const struct sip_msg *msg, uint16_t scode,
40 		    const char *reason, const char *cuser, const char *ctype,
41 		    struct mbuf *desc,
42 		    sip_auth_h *authh, void *aarg, bool aref,
43 		    sipsess_offer_h *offerh, sipsess_answer_h *answerh,
44 		    sipsess_estab_h *estabh, sipsess_info_h *infoh,
45 		    sipsess_refer_h *referh, sipsess_close_h *closeh,
46 		    void *arg, const char *fmt, ...);
47 
48 int  sipsess_progress(struct sipsess *sess, uint16_t scode,
49 		      const char *reason, struct mbuf *desc,
50 		      const char *fmt, ...);
51 int  sipsess_answer(struct sipsess *sess, uint16_t scode, const char *reason,
52 		    struct mbuf *desc, const char *fmt, ...);
53 int  sipsess_reject(struct sipsess *sess, uint16_t scode, const char *reason,
54 		    const char *fmt, ...);
55 int  sipsess_modify(struct sipsess *sess, struct mbuf *desc);
56 int  sipsess_info(struct sipsess *sess, const char *ctype, struct mbuf *body,
57 		  sip_resp_h *resph, void *arg);
58 int  sipsess_set_close_headers(struct sipsess *sess, const char *hdrs, ...);
59 void sipsess_close_all(struct sipsess_sock *sock);
60 struct sip_dialog *sipsess_dialog(const struct sipsess *sess);
61