blob: d212dd2e47a8b0940761bf8dfbc9d214a0700752 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __PJSIP_SIP_TYPES_H__
21#define __PJSIP_SIP_TYPES_H__
22
23
24/*
25 * My note: Doxygen PJSIP and PJSIP_CORE group is declared in
26 * sip_config.h
27 */
28
29/**
30 * @file sip_types.h
31 * @brief Basic PJSIP types.
32 */
33
34#include <pjsip/sip_config.h>
35#include <pj/types.h>
36
37/**
38 * @addtogroup PJSIP_BASE
39 */
40
41/* @defgroup PJSIP_TYPES Basic Data Types
42 * @ingroup PJSIP_BASE
43 * @brief Basic data types.
44 * @{
45 */
46
47
48
49/**
50 * Forward declaration for SIP transport.
51 */
52typedef struct pjsip_transport pjsip_transport;
53
54/**
55 * Forward declaration for transport manager.
56 */
57typedef struct pjsip_tpmgr pjsip_tpmgr;
58
59/**
60 * Transport types.
61 */
62typedef enum pjsip_transport_type_e
63{
64 /** Unspecified. */
65 PJSIP_TRANSPORT_UNSPECIFIED,
66
67 /** UDP. */
68 PJSIP_TRANSPORT_UDP,
69
70 /** TCP. */
71 PJSIP_TRANSPORT_TCP,
72
73 /** TLS. */
74 PJSIP_TRANSPORT_TLS,
75
76 /** SCTP. */
77 PJSIP_TRANSPORT_SCTP,
78
79 /** Loopback (stream, reliable) */
80 PJSIP_TRANSPORT_LOOP,
81
82 /** Loopback (datagram, unreliable) */
83 PJSIP_TRANSPORT_LOOP_DGRAM,
84
85 /** Start of user defined transport */
86 PJSIP_TRANSPORT_START_OTHER,
87
88 /** Start of IPv6 transports */
89 PJSIP_TRANSPORT_IPV6 = 128,
90
91 /** UDP over IPv6 */
92 PJSIP_TRANSPORT_UDP6 = PJSIP_TRANSPORT_UDP + PJSIP_TRANSPORT_IPV6,
93
94 /** TCP over IPv6 */
95 PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6,
96
97 /** TLS over IPv6 */
98 PJSIP_TRANSPORT_TLS6 = PJSIP_TRANSPORT_TLS + PJSIP_TRANSPORT_IPV6
99
100} pjsip_transport_type_e;
101
102
103/**
104 * Forward declaration for endpoint (sip_endpoint.h).
105 */
106typedef struct pjsip_endpoint pjsip_endpoint;
107
108/**
109 * Forward declaration for transactions (sip_transaction.h).
110 */
111typedef struct pjsip_transaction pjsip_transaction;
112
113/**
114 * Forward declaration for events (sip_event.h).
115 */
116typedef struct pjsip_event pjsip_event;
117
118/**
119 * Forward declaration for transmit data/buffer (sip_transport.h).
120 */
121typedef struct pjsip_tx_data pjsip_tx_data;
122
123/**
124 * Forward declaration for receive data/buffer (sip_transport.h).
125 */
126typedef struct pjsip_rx_data pjsip_rx_data;
127
128/**
129 * Forward declaration for message (sip_msg.h).
130 */
131typedef struct pjsip_msg pjsip_msg;
132
133/**
134 * Forward declaration for message body (sip_msg.h).
135 */
136typedef struct pjsip_msg_body pjsip_msg_body;
137
138/**
139 * Forward declaration for header field (sip_msg.h).
140 */
141typedef struct pjsip_hdr pjsip_hdr;
142
143/**
144 * Forward declaration for URI (sip_uri.h).
145 */
146typedef struct pjsip_uri pjsip_uri;
147
148/**
149 * Forward declaration for SIP method (sip_msg.h)
150 */
151typedef struct pjsip_method pjsip_method;
152
153/**
154 * Opaque data type for the resolver engine (sip_resolve.h).
155 */
156typedef struct pjsip_resolver_t pjsip_resolver_t;
157
158/**
159 * Forward declaration for credential.
160 */
161typedef struct pjsip_cred_info pjsip_cred_info;
162
163
164/**
165 * Forward declaration for module (sip_module.h).
166 */
167typedef struct pjsip_module pjsip_module;
168
169
170/**
171 * Forward declaration for user agent type (sip_ua_layer.h).
172 */
173typedef pjsip_module pjsip_user_agent;
174
175/**
176 * Forward declaration for dialog (sip_dialog.h).
177 */
178typedef struct pjsip_dialog pjsip_dialog;
179
180/**
181 * Transaction role.
182 */
183typedef enum pjsip_role_e
184{
185 PJSIP_ROLE_UAC, /**< Role is UAC. */
186 PJSIP_ROLE_UAS, /**< Role is UAS. */
187
188 /* Alias: */
189
190 PJSIP_UAC_ROLE = PJSIP_ROLE_UAC, /**< Role is UAC. */
191 PJSIP_UAS_ROLE = PJSIP_ROLE_UAS /**< Role is UAS. */
192
193} pjsip_role_e;
194
195
196/**
197 * General purpose buffer.
198 */
199typedef struct pjsip_buffer
200{
201 /** The start of the buffer. */
202 char *start;
203
204 /** Pointer to current end of the buffer, which also indicates the position
205 of subsequent buffer write.
206 */
207 char *cur;
208
209 /** The absolute end of the buffer. */
210 char *end;
211
212} pjsip_buffer;
213
214
215/**
216 * General host:port pair, used for example as Via sent-by.
217 */
218typedef struct pjsip_host_port
219{
220 pj_str_t host; /**< Host part or IP address. */
221 int port; /**< Port number. */
222} pjsip_host_port;
223
224/**
225 * Host information.
226 */
227typedef struct pjsip_host_info
228{
229 unsigned flag; /**< Flags of pjsip_transport_flags_e. */
230 pjsip_transport_type_e type; /**< Transport type. */
231 pjsip_host_port addr; /**< Address information. */
232} pjsip_host_info;
233
234
235/**
236 * Convert exception ID into pj_status_t status.
237 *
238 * @param exception_id Exception Id.
239 *
240 * @return Error code for the specified exception Id.
241 */
242PJ_DECL(pj_status_t) pjsip_exception_to_status(int exception_id);
243
244/**
245 * Return standard pj_status_t status from current exception.
246 */
247#define PJSIP_RETURN_EXCEPTION() pjsip_exception_to_status(PJ_GET_EXCEPTION())
248
249/**
250 * Attributes to inform that the function may throw exceptions.
251 */
252#define PJSIP_THROW_SPEC(list)
253
254
255/**
256 * @}
257 */
258
259#endif /* __PJSIP_SIP_TYPES_H__ */
260