nta  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
nta.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef NTA_H
26 
27 #define NTA_H
28 
36 #ifndef SU_WAIT_H
37 #include <sofia-sip/su_wait.h>
38 #endif
39 
40 #ifndef SIP_H
41 #include <sofia-sip/sip.h>
42 #endif
43 
44 #ifndef NTA_TAG_H
45 #include <sofia-sip/nta_tag.h>
46 #endif
47 
48 SOFIA_BEGIN_DECLS
49 
50 /* ----------------------------------------------------------------------
51  * 1) Types
52  */
53 
55 typedef struct nta_agent_s nta_agent_t;
57 typedef struct nta_leg_s nta_leg_t;
59 typedef struct nta_outgoing_s nta_outgoing_t;
61 typedef struct nta_incoming_s nta_incoming_t;
62 
63 #ifndef NTA_AGENT_MAGIC_T
64 
67 #define NTA_AGENT_MAGIC_T struct nta_agent_magic_s
68 #endif
69 #ifndef NTA_LEG_MAGIC_T
70 
73 #define NTA_LEG_MAGIC_T struct nta_leg_magic_s
74 #endif
75 #ifndef NTA_OUTGOING_MAGIC_T
76 
79 #define NTA_OUTGOING_MAGIC_T struct nta_outgoing_magic_s
80 #endif
81 #ifndef NTA_INCOMING_MAGIC_T
82 
85 #define NTA_INCOMING_MAGIC_T struct nta_incoming_magic_s
86 #endif
87 
96 
97 /* ----------------------------------------------------------------------
98  * 2) Constants
99  */
100 
102 #define NTA_VERSION "2.0"
103 
105 SOFIAPUBVAR char const nta_version[];
106 
107 enum {
108  /* Stack parameters */
109  NTA_SIP_T1 = 500,
110  NTA_SIP_T2 = 4000,
111  NTA_SIP_T4 = 5000,
112  NTA_TIME_MAX = 15 * 24 * 3600 * 1000
114 };
115 
116 /* ----------------------------------------------------------------------
117  * 3) Agent-level prototypes
118  */
119 
120 typedef int nta_message_f(nta_agent_magic_t *context,
121  nta_agent_t *agent,
122  msg_t *msg,
123  sip_t *sip);
124 
127  url_string_t const *name,
128  nta_message_f *callback,
129  nta_agent_magic_t *magic,
130  tag_type_t tag, tag_value_t value, ...);
131 
133 
134 SOFIAPUBFUN char const *nta_agent_version(nta_agent_t const *a);
136 
139  url_string_t const *url,
140  tag_type_t tag, tag_value_t value, ...);
141 
143 
147 
149  char const *fmt, nta_agent_t *);
150 
152  tag_type_t tag, tag_value_t value, ...);
154  tag_type_t tag, tag_value_t value, ...);
155 
157  tag_type_t tag, tag_value_t value, ...);
158 
159 /* ----------------------------------------------------------------------
160  * 4) Message-level prototypes
161  */
162 
163 SOFIAPUBFUN msg_t *nta_msg_create(nta_agent_t *self, int flags);
164 
166 
168  nta_leg_t *leg,
169  sip_method_t method,
170  char const *method_name,
171  url_string_t const *req_url);
172 
173 SOFIAPUBFUN int nta_msg_is_internal(msg_t const *msg);
174 SOFIAPUBFUN int nta_sip_is_internal(sip_t const *sip);
175 
176 /* ----------------------------------------------------------------------
177  * 5) Leg-level prototypes
178  */
179 typedef int nta_request_f(nta_leg_magic_t *lmagic,
180  nta_leg_t *leg,
181  nta_incoming_t *irq,
182  sip_t const *sip);
183 
186  nta_request_f *req_callback,
187  nta_leg_magic_t *magic,
188  tag_type_t tag, tag_value_t value, ...);
189 
191 
193 
195  nta_request_f *callback);
196 
198  nta_request_f *callback,
199  nta_leg_magic_t *);
200 
202 SOFIAPUBFUN char const *nta_leg_tag(nta_leg_t *leg, char const *tag);
203 
205 SOFIAPUBFUN char const *nta_leg_get_tag(nta_leg_t const *leg);
206 
208 SOFIAPUBFUN char const *nta_leg_rtag(nta_leg_t *leg, char const *tag);
209 
211 SOFIAPUBFUN char const *nta_leg_get_rtag(nta_leg_t const *leg);
212 
215 
218 
220  sip_record_route_t const *route,
221  sip_contact_t const *contact);
222 
224  sip_record_route_t const *route,
225  sip_contact_t const *contact,
226  int initial);
227 
229  sip_record_route_t const *route,
230  sip_contact_t const *contact);
231 
234  sip_route_t const **return_route,
235  sip_contact_t const **return_target);
236 
239  url_string_t const *);
240 
244  url_t const *request_uri,
245  sip_call_id_t const *call_id,
246  char const *from_tag,
247  url_t const *from_url,
248  char const *to_tag,
249  url_t const *to_url);
250 
253  su_home_t *home,
254  int early_only);
258 
261 nta_leg_t *nta_leg_by_call_id(nta_agent_t *sa, const char *call_id);
262 
263 /* ----------------------------------------------------------------------
264  * 6) Prototypes for incoming transactions
265  */
266 
269  nta_leg_t *leg,
270  msg_t *msg,
271  sip_t *sip,
272  tag_type_t tag, tag_value_t value, ...);
273 
275 
277  nta_incoming_t *irq,
278  sip_t const *sip);
279 
281  nta_ack_cancel_f *callback,
282  nta_incoming_magic_t *imagic);
283 
286  nta_ack_cancel_f *callback);
287 
290  sip_t const *sip,
291  sip_via_t const *v);
292 
293 SOFIAPUBFUN char const *nta_incoming_tag(nta_incoming_t *irq, char const *tag);
294 SOFIAPUBFUN char const *nta_incoming_gettag(nta_incoming_t const *irq);
295 
298 SOFIAPUBFUN char const *nta_incoming_method_name(nta_incoming_t const *irq);
302 
304  tag_type_t tag, tag_value_t value, ...);
305 
309 
312  msg_t *msg,
313  int status,
314  char const *phrase,
315  tag_type_t tag, tag_value_t value, ...);
316 
318 msg_t *nta_incoming_create_response(nta_incoming_t *irq, int status, char const *phrase);
319 
322  int status, char const *phrase,
323  tag_type_t tag, tag_value_t value, ...);
324 
326 
328 
329 /* Functions for feature, method, mime, session-timer negotation */
330 
333  sip_t const *sip,
334  sip_supported_t const *supported,
335  tag_type_t tag, tag_value_t value, ...);
338  sip_t const *sip,
339  sip_require_t *require,
340  tag_type_t tag, tag_value_t value, ...);
343  sip_t const *sip,
344  sip_allow_t const *allow,
345  tag_type_t tag, tag_value_t value, ...);
347 int nta_check_session_content(nta_incoming_t *irq, sip_t const *sip,
348  sip_accept_t const *session_accepts,
349  tag_type_t tag, tag_value_t value, ...);
352  sip_t const *sip,
353  sip_accept_t const *acceptable,
354  sip_accept_t const **return_acceptable,
355  tag_type_t tag, tag_value_t value, ...);
356 
359  sip_t const *sip,
360  sip_time_t my_min_se,
361  tag_type_t tag, tag_value_t value, ...);
362 
363 /* ----------------------------------------------------------------------
364  * 7) Prototypes for outgoing transactions
365  */
367  nta_outgoing_t *request,
368  sip_t const *sip);
369 
372  nta_response_f *callback,
373  nta_outgoing_magic_t *magic,
374  url_string_t const *route_url,
375  sip_method_t method,
376  char const *method_name,
377  url_string_t const *request_uri,
378  tag_type_t tag, tag_value_t value, ...);
379 
382  nta_response_f *callback,
383  nta_outgoing_magic_t *magic,
384  url_string_t const *route_url,
385  msg_t *msg,
386  tag_type_t tag, tag_value_t value, ...);
387 
390  nta_response_f *callback,
391  nta_outgoing_magic_t *magic);
392 
394  nta_response_f *callback,
395  nta_outgoing_magic_t *magic);
397  nta_response_f *callback);
400 SOFIAPUBFUN char const *nta_outgoing_method_name(nta_outgoing_t const *orq);
402 SOFIAPUBFUN char const *nta_outgoing_branch(nta_outgoing_t const *orq);
403 
404 SOFIAPUBFUN unsigned nta_outgoing_delay(nta_outgoing_t const *orq);
405 
408 
411 
414  nta_response_f *callback,
415  nta_outgoing_magic_t *magic,
416  char const *to_tag,
417  sip_rseq_t const *rseq);
418 
420 
423  nta_response_f *callback,
424  nta_outgoing_magic_t *magic,
425  tag_type_t, tag_value_t, ...);
426 
428 
431  msg_t const *msg,
432  sip_t const *sip,
433  sip_via_t const *v);
434 
436 
437 /* ----------------------------------------------------------------------
438  * 8) Reliable provisional responses (100rel)
439  */
440 
441 /* UAC side */
442 
445  nta_outgoing_t *oorq,
446  nta_response_f *callback,
447  nta_outgoing_magic_t *magic,
448  url_string_t const *route_url,
449  sip_t const *response_to_prack,
450  tag_type_t, tag_value_t, ...);
451 
454 
455 /* UAS side */
456 
458 typedef struct nta_reliable_s nta_reliable_t;
459 
460 #ifndef NTA_RELIABLE_MAGIC_T
461 
464 #define NTA_RELIABLE_MAGIC_T struct nta_reliable_magic_s
465 #endif
466 
469 
470 typedef int nta_prack_f(nta_reliable_magic_t *rmagic,
471  nta_reliable_t *rel,
472  nta_incoming_t *prack,
473  sip_t const *sip);
474 
477  nta_prack_f *callback,
478  nta_reliable_magic_t *rmagic,
479  int status, char const *phrase,
480  tag_type_t tag,
481  tag_value_t value, ...);
482 
485  nta_prack_f *callback,
486  nta_reliable_magic_t *rmagic,
487  msg_t *msg);
488 
490 
491 /* ----------------------------------------------------------------------
492  * Backward-compatibility stuff - going away soon
493  */
494 
495 #define nta_outgoing_tmcreate nta_outgoing_mcreate
496 #define nta_msg_response_complete(msg, irq, status, phrase) \
497  nta_incoming_complete_response((irq), (msg), (status), (phrase), TAG_END())
498 
499 SOFIAPUBFUN void nta_msg_discard(nta_agent_t *agent, msg_t *msg);
500 
501 SOFIAPUBFUN int nta_is_internal_msg(msg_t const *msg);
502 
503 SOFIA_END_DECLS
504 
505 #endif

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.