blob: 3bdfcc78102fda1e0af3ab8ba6af47cbb563dea4 [file] [log] [blame]
James Kuszmaul82f6c042021-01-17 11:30:16 -08001/**
2 * @file sipsess.h SIP Session Private Interface
3 *
4 * Copyright (C) 2010 Creytiv.com
5 */
6
7
8struct sipsess {
9 struct le he;
10 struct tmr tmr;
11 struct list replyl;
12 struct list requestl;
13 struct sip_loopstate ls;
14 struct sipsess_sock *sock;
15 const struct sip_msg *msg;
16 struct sip_request *req;
17 struct sip_dialog *dlg;
18 struct sip_strans *st;
19 struct sip_auth *auth;
20 struct sip *sip;
21 char *cuser;
22 char *ctype;
23 char *close_hdrs;
24 struct mbuf *hdrs;
25 struct mbuf *desc;
26 sipsess_offer_h *offerh;
27 sipsess_answer_h *answerh;
28 sipsess_progr_h *progrh;
29 sipsess_estab_h *estabh;
30 sipsess_info_h *infoh;
31 sipsess_refer_h *referh;
32 sipsess_close_h *closeh;
33 void *arg;
34 bool owner;
35 bool sent_offer;
36 bool awaiting_answer;
37 bool modify_pending;
38 bool established;
39 bool peerterm;
40 int terminated;
41};
42
43
44struct sipsess_sock {
45 struct sip_lsnr *lsnr_resp;
46 struct sip_lsnr *lsnr_req;
47 struct hash *ht_sess;
48 struct hash *ht_ack;
49 struct sip *sip;
50 sipsess_conn_h *connh;
51 void *arg;
52};
53
54
55struct sipsess_request {
56 struct le le;
57 struct sip_loopstate ls;
58 struct sipsess *sess;
59 struct sip_request *req;
60 char *ctype;
61 struct mbuf *body;
62 sip_resp_h *resph;
63 void *arg;
64};
65
66
67int sipsess_alloc(struct sipsess **sessp, struct sipsess_sock *sock,
68 const char *cuser, const char *ctype, struct mbuf *desc,
69 sip_auth_h *authh, void *aarg, bool aref,
70 sipsess_offer_h *offerh, sipsess_answer_h *answerh,
71 sipsess_progr_h *progrh, sipsess_estab_h *estabh,
72 sipsess_info_h *infoh, sipsess_refer_h *referh,
73 sipsess_close_h *closeh, void *arg);
74void sipsess_terminate(struct sipsess *sess, int err,
75 const struct sip_msg *msg);
76int sipsess_ack(struct sipsess_sock *sock, struct sip_dialog *dlg,
77 uint32_t cseq, struct sip_auth *auth,
78 const char *ctype, struct mbuf *desc);
79int sipsess_ack_again(struct sipsess_sock *sock, const struct sip_msg *msg);
80int sipsess_reply_2xx(struct sipsess *sess, const struct sip_msg *msg,
81 uint16_t scode, const char *reason, struct mbuf *desc,
82 const char *fmt, va_list *ap);
83int sipsess_reply_ack(struct sipsess *sess, const struct sip_msg *msg,
84 bool *awaiting_answer);
85int sipsess_reinvite(struct sipsess *sess, bool reset_ls);
86int sipsess_bye(struct sipsess *sess, bool reset_ls);
87int sipsess_request_alloc(struct sipsess_request **reqp, struct sipsess *sess,
88 const char *ctype, struct mbuf *body,
89 sip_resp_h *resph, void *arg);