blob: 912c69bb8f45668c93ff9a8d82ce5e5ed6baf968 [file] [log] [blame]
James Kuszmaul82f6c042021-01-17 11:30:16 -08001/**
2 * @file sip.h SIP Private Interface
3 *
4 * Copyright (C) 2010 Creytiv.com
5 */
6
7
8struct sip {
9 struct list transpl;
10 struct list lsnrl;
11 struct list reql;
12 struct hash *ht_ctrans;
13 struct hash *ht_strans;
14 struct hash *ht_strans_mrg;
15 struct hash *ht_conn;
16 struct hash *ht_udpconn;
17 struct dnsc *dnsc;
18 struct stun *stun;
19 char *software;
20 sip_exit_h *exith;
21 void *arg;
22 bool closing;
23};
24
25
26struct sip_lsnr {
27 struct le le;
28 struct sip_lsnr **lsnrp;
29 sip_msg_h *msgh;
30 void *arg;
31 bool req;
32};
33
34
35struct sip_keepalive {
36 struct le le;
37 struct sip_keepalive **kap;
38 sip_keepalive_h *kah;
39 void *arg;
40};
41
42
43/* request */
44void sip_request_close(struct sip *sip);
45
46
47/* ctrans */
48struct sip_ctrans;
49
50int sip_ctrans_request(struct sip_ctrans **ctp, struct sip *sip,
51 enum sip_transp tp, const struct sa *dst, char *met,
52 char *branch, struct mbuf *mb, sip_resp_h *resph,
53 void *arg);
54int sip_ctrans_cancel(struct sip_ctrans *ct);
55int sip_ctrans_init(struct sip *sip, uint32_t sz);
56int sip_ctrans_debug(struct re_printf *pf, const struct sip *sip);
57
58
59/* strans */
60int sip_strans_init(struct sip *sip, uint32_t sz);
61int sip_strans_debug(struct re_printf *pf, const struct sip *sip);
62
63
64/* transp */
65struct sip_connqent;
66
67typedef void(sip_transp_h)(int err, void *arg);
68
69int sip_transp_init(struct sip *sip, uint32_t sz);
70int sip_transp_send(struct sip_connqent **qentp, struct sip *sip, void *sock,
71 enum sip_transp tp, const struct sa *dst, struct mbuf *mb,
72 sip_transp_h *transph, void *arg);
73bool sip_transp_supported(struct sip *sip, enum sip_transp tp, int af);
74const char *sip_transp_srvid(enum sip_transp tp);
75bool sip_transp_reliable(enum sip_transp tp);
76int sip_transp_debug(struct re_printf *pf, const struct sip *sip);
77
78
79/* auth */
80int sip_auth_encode(struct mbuf *mb, struct sip_auth *auth, const char *met,
81 const char *uri);
82
83
84/* dialog */
85int sip_dialog_encode(struct mbuf *mb, struct sip_dialog *dlg, uint32_t cseq,
86 const char *met);
87const char *sip_dialog_uri(const struct sip_dialog *dlg);
88const struct uri *sip_dialog_route(const struct sip_dialog *dlg);
89uint32_t sip_dialog_hash(const struct sip_dialog *dlg);
90
91
92/* keepalive */
93struct sip_conn;
94
95void sip_keepalive_signal(struct list *kal, int err);
96uint64_t sip_keepalive_wait(uint32_t interval);
97int sip_keepalive_tcp(struct sip_keepalive *ka, struct sip_conn *conn,
98 uint32_t interval);
99int sip_keepalive_udp(struct sip_keepalive *ka, struct sip *sip,
100 struct udp_sock *us, const struct sa *paddr,
101 uint32_t interval);