SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osip.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 
21 #ifndef _OSIP_H_
22 #define _OSIP_H_
23 
24 #include <osipparser2/osip_const.h>
25 
26 /* Time-related functions and data types */
27 #include <osip2/osip_time.h>
28 
29 #ifdef __sun
30 #include <sys/types.h>
31 #endif
32 
34 #include <osip2/osip_fifo.h>
35 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
58  typedef enum _state_t {
59  /* STATES for invite client transaction */
65 
66  /* STATES for invite server transaction */
72 
73  /* STATES for NON-invite client transaction */
79 
80  /* STATES for NON-invite server transaction */
86 
87 #ifndef DOXYGEN
90  DIALOG_CLOSE /* ?? */
91 #endif
92  } state_t;
93 
111  typedef enum type_t {
112  /* TIMEOUT EVENTS for ICT */
117  /* TIMEOUT EVENTS for NICT */
122  /* TIMEOUT EVENTS for IST */
127  /* TIMEOUT EVENTS for NIST */
130  /* FOR INCOMING MESSAGE */
138  /* FOR OUTGOING MESSAGE */
148  } type_t;
149 
158  typedef enum osip_fsm_type_t {
159  ICT,
160  IST,
163  } osip_fsm_type_t;
164 
165 #ifndef DEFAULT_T1
166 
170 #define DEFAULT_T1 500 /* 500 ms */
171 #endif
172 #ifndef DEFAULT_T1_TCP_PROGRESS
173 
181 #define DEFAULT_T1_TCP_PROGRESS 50 /* 50ms */
182 #endif
183 #ifndef DEFAULT_T2
184 
188 #define DEFAULT_T2 4000 /* 4s */
189 #endif
190 #ifndef DEFAULT_T4
191 
195 #define DEFAULT_T4 5000 /* 5s */
196 #endif
197 
198 
203  typedef struct osip_ict osip_ict_t;
204 
209  struct osip_ict {
211  struct timeval timer_a_start;
213  struct timeval timer_b_start;
215  struct timeval timer_d_start;
216  char *destination;
217  int port;
218  };
219 
224  typedef struct osip_nict osip_nict_t;
225 
230  struct osip_nict {
232  struct timeval timer_e_start;
234  struct timeval timer_f_start;
236  struct timeval timer_k_start;
237  char *destination;
238  int port;
240  };
241 
246  typedef struct osip_ist osip_ist_t;
247 
252  struct osip_ist {
254  struct timeval timer_g_start;
256  struct timeval timer_h_start;
258  struct timeval timer_i_start;
259  };
260 
265  typedef struct osip_nist osip_nist_t;
266 
271  struct osip_nist {
273  struct timeval timer_j_start;
274  };
275 
281 
287  struct osip_srv_entry {
288  char srv[512];
289  int priority;
290  int weight;
291  int rweight;
292  int port;
293  char ipaddress[512];
294  struct timeval srv_is_broken;
295  };
296 
297 #define OSIP_SRV_STATE_UNKNOWN 0
298 #define OSIP_SRV_STATE_RETRYLATER 2
299 #define OSIP_SRV_STATE_COMPLETED 3
300 #define OSIP_SRV_STATE_NOTSUPPORTED 4
306  typedef struct osip_srv_record osip_srv_record_t;
307 
313  char name[512];
314  int srv_state;
315  char protocol[64];
316  int order;
318  int index;
320  };
321 
322 #define OSIP_NAPTR_STATE_UNKNOWN 0
323 #define OSIP_NAPTR_STATE_INPROGRESS 1
324 #define OSIP_NAPTR_STATE_NAPTRDONE 2
325 #define OSIP_NAPTR_STATE_SRVINPROGRESS 3
326 #define OSIP_NAPTR_STATE_SRVDONE 4
327 #define OSIP_NAPTR_STATE_RETRYLATER 5
328 #define OSIP_NAPTR_STATE_NOTSUPPORTED 6
334  typedef struct osip_naptr osip_naptr_t;
335 
340  struct osip_naptr {
341  char domain[512];
343  void *arg;
350  };
351 
357 
363 
380  time_t birth_time;
381  time_t completed_time;
383  int in_socket;
386  void *config;
396  void *reserved1;
397  void *reserved2;
398  void *reserved3;
399  void *reserved4;
400  void *reserved5;
401  void *reserved6;
402  };
403 
404 
477 
481  typedef enum osip_kill_callback_type {
489 
501 
506  typedef void (*osip_message_cb_t) (int type, osip_transaction_t *, osip_message_t *);
511  typedef void (*osip_kill_transaction_cb_t) (int type, osip_transaction_t *);
516  typedef void (*osip_transport_error_cb_t) (int type, osip_transaction_t *, int error);
517 
518 
519  struct osip_dialog;
520 
525  typedef struct ixt ixt_t;
526 
531  struct ixt {
532  /* any ACK received that match this context will set counter to -1 */
533  struct osip_dialog *dialog;
536  struct timeval start;
537  int interval;
538  char *dest;
539  int port;
540  int sock;
541  int counter;
542  };
543 
544 
552  typedef struct osip osip_t;
553 
558  struct osip {
559 
567  void *id_mutex;
570  /* list of transactions for ict, ist, nict, nist */
582  int (*cb_send_message) (osip_transaction_t *, osip_message_t *, char *, int, int);
589  };
590 
598 
606 
614 
623  typedef struct osip_event osip_event_t;
624 
629  struct osip_event {
633  };
634 
635 
636 
644  int osip_transaction_init (osip_transaction_t ** transaction, osip_fsm_type_t ctx_type, osip_t * osip, osip_message_t * request);
649  int osip_transaction_free (osip_transaction_t * transaction);
657  int osip_transaction_free2 (osip_transaction_t * transaction);
658 
666  void osip_response_get_destination (osip_message_t * response, char **address, int *portnum);
676  int osip_ict_set_destination (osip_ict_t * ict, char *destination, int port);
677 
687  int osip_nict_set_destination (osip_nict_t * nict, char *destination, int port);
688 
694  int osip_transaction_add_event (osip_transaction_t * transaction, osip_event_t * evt);
703  int osip_transaction_execute (osip_transaction_t * transaction, osip_event_t * evt);
716  int osip_transaction_set_your_instance (osip_transaction_t * transaction, void *ptr);
717 
729  int osip_transaction_set_reserved1 (osip_transaction_t * transaction, void *ptr);
736  int osip_transaction_set_reserved2 (osip_transaction_t * transaction, void *ptr);
737 
744  int osip_transaction_set_reserved3 (osip_transaction_t * transaction, void *ptr);
745 
752  int osip_transaction_set_reserved4 (osip_transaction_t * transaction, void *ptr);
753 
760  int osip_transaction_set_reserved5 (osip_transaction_t * transaction, void *ptr);
761 
768  int osip_transaction_set_reserved6 (osip_transaction_t * transaction, void *ptr);
769 
775  void *osip_transaction_get_your_instance (osip_transaction_t * transaction);
776 
781  void *osip_transaction_get_reserved1 (osip_transaction_t * transaction);
782 
787  void *osip_transaction_get_reserved2 (osip_transaction_t * transaction);
788 
793  void *osip_transaction_get_reserved3 (osip_transaction_t * transaction);
794 
799  void *osip_transaction_get_reserved4 (osip_transaction_t * transaction);
800 
805  void *osip_transaction_get_reserved5 (osip_transaction_t * transaction);
806 
811  void *osip_transaction_get_reserved6 (osip_transaction_t * transaction);
812 
820  int osip_transaction_get_destination (osip_transaction_t * transaction, char **ip, int *port);
821 
822 
829  int osip_transaction_set_srv_record (osip_transaction_t * transaction, osip_srv_record_t * record);
830 
837  int osip_transaction_set_naptr_record (osip_transaction_t * transaction, osip_naptr_t * record);
838 
845  int osip_transaction_set_in_socket (osip_transaction_t * transaction, int sock);
852  int osip_transaction_set_out_socket (osip_transaction_t * transaction, int sock);
853 
854 
855 
860  int osip_init (osip_t ** osip);
865  void osip_release (osip_t * osip);
866 
873  void osip_set_application_context (osip_t * osip, void *pointer);
874 
881 
882 
888  int osip_remove_transaction (osip_t * osip, osip_transaction_t * ict);
889 
890 
895  int osip_ict_execute (osip_t * osip);
900  int osip_ist_execute (osip_t * osip);
905  int osip_nict_execute (osip_t * osip);
910  int osip_nist_execute (osip_t * osip);
911 
920  void osip_timers_gettimeout (osip_t * osip, struct timeval *lower_tv);
921 
942 
943 /* Take care of mutlithreading issuewhile using this method */
949  osip_transaction_t *osip_transaction_find (osip_list_t * transactions, osip_event_t * evt);
950 
951 
952 #ifndef DOXYGEN
953 
960 #ifdef OSIP_MONOTHREAD
961  osip_transaction_t *osip_find_transaction (osip_t * osip, osip_event_t * evt);
962 #endif
963 
964  osip_transaction_t *__osip_find_transaction (osip_t * osip, osip_event_t * evt, int consume);
965 #endif
966 
974 
980  osip_transaction_t *osip_create_transaction (osip_t * osip, osip_event_t * evt);
981 
987  osip_event_t *osip_parse (const char *buf, size_t length);
988 
989 
995 
1003  void osip_start_200ok_retransmissions (osip_t * osip, struct osip_dialog *dialog, osip_message_t * msg200ok, int sock);
1004 
1014  void osip_start_ack_retransmissions (osip_t * osip, struct osip_dialog *dialog, osip_message_t * ack, char *dest, int port, int sock);
1015 
1022 
1031 
1032 
1038 
1043  void osip_event_free (osip_event_t * event);
1044 
1050  void osip_set_cb_send_message (osip_t * cf, int (*cb) (osip_transaction_t *, osip_message_t *, char *, int, int));
1051 
1052 /* FOR INCOMING TRANSACTION */
1057 #define EVT_IS_RCV_INVITE(event) (event->type==RCV_REQINVITE)
1058 
1062 #define EVT_IS_RCV_ACK(event) (event->type==RCV_REQACK)
1063 
1067 #define EVT_IS_RCV_REQUEST(event) (event->type==RCV_REQUEST)
1068 
1072 #define EVT_IS_RCV_STATUS_1XX(event) (event->type==RCV_STATUS_1XX)
1073 
1077 #define EVT_IS_RCV_STATUS_2XX(event) (event->type==RCV_STATUS_2XX)
1078 
1082 #define EVT_IS_RCV_STATUS_3456XX(event) (event->type==RCV_STATUS_3456XX)
1083 
1084 
1085 /* FOR OUTGOING TRANSACTION */
1090 #define EVT_IS_SND_INVITE(event) (event->type==SND_REQINVITE)
1091 
1095 #define EVT_IS_SND_ACK(event) (event->type==SND_REQACK)
1096 
1100 #define EVT_IS_SND_REQUEST(event) (event->type==SND_REQUEST)
1101 
1105 #define EVT_IS_SND_STATUS_1XX(event) (event->type==SND_STATUS_1XX)
1106 
1110 #define EVT_IS_SND_STATUS_2XX(event) (event->type==SND_STATUS_2XX)
1111 
1115 #define EVT_IS_SND_STATUS_3456XX(event) (event->type==SND_STATUS_3456XX)
1116 
1120 #define EVT_IS_INCOMINGMSG(event) (event->type>=RCV_REQINVITE \
1121  &&event->type<=RCV_STATUS_3456XX)
1122 
1126 #define EVT_IS_INCOMINGREQ(event) (EVT_IS_RCV_INVITE(event) \
1127  ||EVT_IS_RCV_ACK(event) \
1128  ||EVT_IS_RCV_REQUEST(event))
1129 
1133 #define EVT_IS_INCOMINGRESP(event) (EVT_IS_RCV_STATUS_1XX(event) \
1134  ||EVT_IS_RCV_STATUS_2XX(event) \
1135  ||EVT_IS_RCV_STATUS_3456XX(event))
1136 
1140 #define EVT_IS_OUTGOINGMSG(event) (event->type>=SND_REQINVITE \
1141  &&event->type<=SND_STATUS_3456XX)
1142 
1146 #define EVT_IS_OUTGOINGREQ(event) (EVT_IS_SND_INVITE(event) \
1147  ||EVT_IS_SND_ACK(event) \
1148  ||EVT_IS_SND_REQUEST(event))
1149 
1153 #define EVT_IS_OUTGOINGRESP(event) (EVT_IS_SND_STATUS_1XX(event) \
1154  ||EVT_IS_SND_STATUS_2XX(event) \
1155  ||EVT_IS_SND_STATUS_3456XX(event))
1156 
1161 #define EVT_IS_MSG(event) (event->type>=RCV_REQINVITE \
1162  &&event->type<=SND_STATUS_3456XX)
1163 
1168 #define EVT_IS_KILL_TRANSACTION(event) (event->type==KILL_TRANSACTION)
1169 
1170 #ifdef __cplusplus
1171 }
1172 #endif
1173 
1174 #endif
1XX FOR INVITE SENT
Definition: osip.h:426
Structure for referencing a list of elements.
Definition: osip_list.h:82
Structure for SIP Message (REQUEST and RESPONSE).
Definition: osip_message.h:55
void * ict_fastmutex
mutex for ICT transaction
Definition: osip.h:562
struct timeval timer_f_start
Timer F (fire when transaction timeout)
Definition: osip.h:234
void * osip_transaction_get_reserved3(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
int timer_a_length
Timer A A=T1, A=2xT1...
Definition: osip.h:210
void osip_timers_nict_execute(osip_t *osip)
Check if a nict transactions needs a timer event.
RESPONSE RETRANSMITTED.
Definition: osip.h:470
Timer K.
Definition: osip.h:120
NOTIFY RECEIVED.
Definition: osip.h:458
osip_message_t * last_response
Last response.
Definition: osip.h:375
Event is an incoming NON-INVITE and NON-ACK request.
Definition: osip.h:133
struct timeval timer_g_start
Timer G (0 when reliable transport is used)
Definition: osip.h:254
struct timeval timer_d_start
Timer D.
Definition: osip.h:215
int counter
start at 7
Definition: osip.h:541
4XX FOR INVITE SENT
Definition: osip.h:430
Definition of the CSeq header.
Definition: osip_cseq.h:45
INFO MESSAGE SENT.
Definition: osip.h:438
Event is an incoming 2XX response.
Definition: osip.h:135
time_t completed_time
end date of transaction
Definition: osip.h:381
void * osip_get_application_context(osip_t *osip)
Get a pointer in a osip_t element.
void * reserved4
User Defined Pointer.
Definition: osip.h:399
int osip_transaction_free2(osip_transaction_t *transaction)
Free all resource in a osip_transaction_t element.
TIMER F EXPIRATION: NO REMOTE ANSWER.
Definition: osip.h:473
int osip_transaction_set_reserved3(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
int osip_init(osip_t **osip)
Allocate an osip_t element.
osip_transport_error_cb_t tp_error_callbacks[OSIP_TRANSPORT_ERROR_CALLBACK_COUNT]
transport error callback
Definition: osip.h:580
enum osip_message_callback_type osip_message_callback_type_t
Enumeration for callback type.
2XX FOR MESSAGE SENT
Definition: osip.h:464
transport error for ICT
Definition: osip.h:494
end of Server Non-INVITE transaction
Definition: osip.h:485
5XX FOR INVITE RECEIVED
Definition: osip.h:418
2XX FOR INVITE SENT
Definition: osip.h:427
void * osip_transaction_get_reserved6(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
Structure for NAPTR record entry.
Definition: osip.h:340
osip_nist_t * nist_context
internal nist context
Definition: osip.h:392
Structure for referencing a fifo.
Definition: osip_fifo.h:63
int transactionid
previous unique transaction id generation
Definition: osip.h:568
int in_socket
Optional socket for incoming message.
Definition: osip.h:383
osip_via_t * topvia
CALL-LEG definition (Top Via)
Definition: osip.h:368
_state_t
Enumeration for transaction state.
Definition: osip.h:58
int osip_transaction_set_in_socket(osip_transaction_t *transaction, int sock)
Set the socket for incoming message.
3XX FOR MESSAGE RECEIVED
Definition: osip.h:447
2XX FOR INVITE RECEIVED
Definition: osip.h:414
void * reserved3
User Defined Pointer.
Definition: osip.h:398
int osip_nict_execute(osip_t *osip)
Consume ALL pending osip_event_t previously added in the fifos of nict transactions.
void * arg
arg
Definition: osip.h:343
UNKNWON REQUEST RECEIVED.
Definition: osip.h:461
enum _state_t state_t
Enumeration for transaction state.
osip_ist_t * ist_context
internal ist context
Definition: osip.h:390
END OF ENUM.
Definition: osip.h:487
OPTIONS MESSAGE SENT.
Definition: osip.h:437
char * destination
IP used to send requests.
Definition: osip.h:237
osip_kill_transaction_cb_t kill_callbacks[OSIP_KILL_CALLBACK_COUNT]
kill callbacks
Definition: osip.h:579
2XX FOR MESSAGE RETRANSMITTED
Definition: osip.h:465
BYE MESSAGE SENT.
Definition: osip.h:436
osip_message_callback_type
Enumeration for callback type.
Definition: osip.h:408
int osip_remove_transaction(osip_t *osip, osip_transaction_t *ict)
Remove a transaction from the osip stack.
1XX FOR MESSAGE RECEIVED
Definition: osip.h:444
REGISTER MESSAGE SENT.
Definition: osip.h:435
6XX FOR MESSAGE SENT
Definition: osip.h:469
void * osip_ict_hastable
htable of ict transactions
Definition: osip.h:584
ACK MESSAGE RECEIVED.
Definition: osip.h:424
6XX FOR MESSAGE RECEIVED
Definition: osip.h:450
6XX FOR INVITE RECEIVED
Definition: osip.h:419
5XX FOR INVITE SENT
Definition: osip.h:431
int sock
socket to use
Definition: osip.h:540
void osip_timers_ist_execute(osip_t *osip)
Check if an ist transactions needs a timer event.
Structure for INVITE CLIENT TRANSACTION.
Definition: osip.h:209
type_t type
Event Type.
Definition: osip.h:630
osip_srv_entry_t srventry[10]
result table
Definition: osip.h:319
int osip_nict_set_destination(osip_nict_t *nict, char *destination, int port)
Set the host and port destination used for sending the SIP message.
int weight
weight
Definition: osip.h:290
enum osip_transport_error_callback_type osip_transport_error_callback_type_t
Enumeration for callback type used when a transport error is detected.
4XX FOR MESSAGE RECEIVED
Definition: osip.h:448
Invite Server (incoming) Transaction.
Definition: osip.h:160
struct timeval timer_a_start
Timer A (retransmission)
Definition: osip.h:211
int osip_transaction_set_your_instance(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
int osip_transaction_get_destination(osip_transaction_t *transaction, char **ip, int *port)
Get target ip and port for this request.
void osip_set_application_context(osip_t *osip, void *pointer)
Set a pointer in a osip_t element.
3XX FOR INVITE SENT
Definition: osip.h:429
Event is an incoming final response (not 2XX)
Definition: osip.h:136
osip_ict_t * ict_context
internal ict context
Definition: osip.h:389
char ipaddress[512]
ipaddress result
Definition: osip.h:293
int naptr_state
naptr state
Definition: osip.h:342
void osip_stop_retransmissions_from_dialog(osip_t *osip, struct osip_dialog *dialog)
Stop out of fsm retransmissions (ACK or 200 Ok) associated to a given dialog.
osip_message_t * ack
ack message if needed
Definition: osip.h:535
osip_message_cb_t msg_callbacks[OSIP_MESSAGE_CALLBACK_COUNT]
message callbacks
Definition: osip.h:578
struct timeval timer_k_start
Timer K.
Definition: osip.h:236
int osip_transaction_execute(osip_transaction_t *transaction, osip_event_t *evt)
Consume one osip_event_t element previously added in the fifo.
Structure for transaction handling.
Definition: osip.h:362
end of Server INVITE transaction
Definition: osip.h:483
osip_message_t * sip
SIP message (optional)
Definition: osip.h:632
CANCEL RECEIVED.
Definition: osip.h:457
2XX FOR MESSAGE RECEIVED
Definition: osip.h:445
void * reserved1
User Defined Pointer.
Definition: osip.h:396
struct osip_srv_record sipsctp_record
sctp SRV result
Definition: osip.h:349
char name[512]
name
Definition: osip.h:313
1XX FOR INVITE RECEIVED
Definition: osip.h:413
int osip_set_transport_error_callback(osip_t *osip, int type, osip_transport_error_cb_t cb)
Set a callback for each transaction operation related to network error.
struct osip_srv_record sipudp_record
udp SRV result
Definition: osip.h:345
CANCEL MESSAGE SENT.
Definition: osip.h:439
void * osip_nist_hastable
htable of nist transactions
Definition: osip.h:587
SUBSCRIBE RECEIVED.
Definition: osip.h:459
char protocol[64]
transport protocol
Definition: osip.h:315
int osip_transaction_set_out_socket(osip_transaction_t *transaction, int sock)
Set the socket for outgoing message.
transport error for NIST
Definition: osip.h:497
int osip_transaction_free(osip_transaction_t *transaction)
Free all resource in a osip_transaction_t element.
struct timeval timer_j_start
Timer J.
Definition: osip.h:273
struct osip_dialog * dialog
related dialog
Definition: osip.h:533
int transactionid
identifier of the related osip transaction
Definition: osip.h:631
3XX FOR MESSAGE SENT
Definition: osip.h:466
int osip_set_message_callback(osip_t *osip, int type, osip_message_cb_t cb)
Set a callback for each transaction operation.
struct osip_srv_record sipdtls_record
dtls SRV result
Definition: osip.h:348
Structure for INVITE SERVER TRANSACTION.
Definition: osip.h:252
int port
port of next hop
Definition: osip.h:238
struct timeval srv_is_broken
time when we considered SRV entry broken
Definition: osip.h:294
osip_kill_callback_type
Enumeration for callback type used when transaction is over.
Definition: osip.h:481
void * your_instance
User Defined Pointer.
Definition: osip.h:364
int transactionid
Internal Transaction Identifier.
Definition: osip.h:365
end of Client Non-INVITE transaction
Definition: osip.h:484
int srv_state
srv state
Definition: osip.h:314
Timer A.
Definition: osip.h:113
osip_event_t * osip_parse(const char *buf, size_t length)
Create a sipevent from a SIP message string.
osip_transaction_t * osip_transaction_find(osip_list_t *transactions, osip_event_t *evt)
Search for a transaction that match this event (MUST be a MESSAGE event).
5XX FOR MESSAGE RECEIVED
Definition: osip.h:449
void * reserved2
User Defined Pointer.
Definition: osip.h:397
osip_srv_record_t record
memory space for SRV record
Definition: osip.h:394
osip_from_t * from
CALL-LEG definition (From)
Definition: osip.h:369
char * destination
IP used to send requests.
Definition: osip.h:216
int osip_transaction_set_reserved5(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
int timer_b_length
Timer B B = 64* T1.
Definition: osip.h:212
int priority
priority
Definition: osip.h:289
struct timeval start
Time of first retransmission.
Definition: osip.h:536
int port
port of next hop
Definition: osip.h:217
INVITE MESSAGE RECEIVED.
Definition: osip.h:422
osip_list_t ixt_retransmissions
list of ixt elements
Definition: osip.h:576
void(* osip_transport_error_cb_t)(int type, osip_transaction_t *, int error)
Callback definition for transport error announcements.
Definition: osip.h:516
RESPONSE RECEIVED AGAIN.
Definition: osip.h:451
int port
port
Definition: osip.h:292
osip_naptr_t * naptr_record
memory space for NAPTR record
Definition: osip.h:395
transport error for IST
Definition: osip.h:495
int timer_j_length
Timer J = 64*T1 (else 0)
Definition: osip.h:272
struct osip_dialog * osip_stop_200ok_retransmissions(osip_t *osip, osip_message_t *ack)
Stop the out of fsm 200 Ok retransmissions matching an incoming ACK.
void(* osip_message_cb_t)(int type, osip_transaction_t *, osip_message_t *)
Callback definition for message announcements.
Definition: osip.h:506
END OF ENUM.
Definition: osip.h:475
Timer I.
Definition: osip.h:125
ACK MESSAGE RETRANSMITTED.
Definition: osip.h:412
2XX FOR INVITE RECEIVED AGAIN
Definition: osip.h:415
2XX FOR INVITE RETRANSMITTED
Definition: osip.h:428
void * osip_transaction_get_reserved1(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
void * nist_fastmutex
mutex for NIST transaction
Definition: osip.h:565
4XX FOR INVITE RECEIVED
Definition: osip.h:417
Structure for osip handling.
Definition: osip.h:558
Non-Invite Server (incoming) Transaction.
Definition: osip.h:162
int osip_transaction_set_srv_record(osip_transaction_t *transaction, osip_srv_record_t *record)
Set SRV lookup information to be used by state machine.
void * ist_fastmutex
mutex for IST transaction
Definition: osip.h:563
int osip_ist_execute(osip_t *osip)
Consume ALL pending osip_event_t previously added in the fifos of ist transactions.
RESPONSE RETRANSMITTED.
Definition: osip.h:433
osip_message_t * msg2xx
buffer to retransmit
Definition: osip.h:534
2XX FOR MESSAGE RECEIVED AGAIN
Definition: osip.h:446
int rweight
rweight
Definition: osip.h:291
int out_socket
Optional place for outgoing message.
Definition: osip.h:384
int osip_transaction_init(osip_transaction_t **transaction, osip_fsm_type_t ctx_type, osip_t *osip, osip_message_t *request)
Allocate an osip_transaction_t element.
void * id_mutex
mutex for unique transaction id generation
Definition: osip.h:567
TIMER B EXPIRATION: NO REMOTE ANSWER.
Definition: osip.h:472
Event is an incoming ACK request.
Definition: osip.h:132
osip_list_t osip_ict_transactions
list of ict transactions
Definition: osip.h:571
Definition of the From header.
Definition: osip_from.h:48
Event is an outgoing NON-INVITE and NON-ACK request.
Definition: osip.h:141
int(* cb_send_message)(osip_transaction_t *, osip_message_t *, char *, int, int)
callback to send message
Definition: osip.h:582
Event is an outgoing 2XX response.
Definition: osip.h:143
INVITE MESSAGE RECEIVED AGAN.
Definition: osip.h:423
struct timeval timer_b_start
Timer B (fire when transaction timeout)
Definition: osip.h:213
int timer_h_length
Timer H H = 64* T1.
Definition: osip.h:255
NOTIFY MESSAGE SENT.
Definition: osip.h:440
Timer E.
Definition: osip.h:118
int osip_transaction_set_naptr_record(osip_transaction_t *transaction, osip_naptr_t *record)
Set NAPTR lookup information to be used by state machine.
void * reserved5
User Defined Pointer.
Definition: osip.h:400
int osip_find_transaction_and_add_event(osip_t *osip, osip_event_t *evt)
Search for a transaction that match this event (MUST be a MESSAGE event) and add this event if a tran...
void osip_set_cb_send_message(osip_t *cf, int(*cb)(osip_transaction_t *, osip_message_t *, char *, int, int))
Register the callback used to send SIP message.
int interval
delay between retransmission, in ms
Definition: osip.h:537
Event to 'kill' the transaction before termination.
Definition: osip.h:146
4XX FOR MESSAGE SENT
Definition: osip.h:467
char * dest
destination host
Definition: osip.h:538
UNKNOWN REQUEST MESSAGE SENT.
Definition: osip.h:442
BYE RECEIVED.
Definition: osip.h:454
int timer_k_length
Timer K K = T4 (else = 0)
Definition: osip.h:235
osip_fsm_type_t ctx_type
Type of the transaction.
Definition: osip.h:388
osip_transaction_t * osip_create_transaction(osip_t *osip, osip_event_t *evt)
Create a transaction for this event (MUST be a SIP REQUEST event).
Event is an outgoing ACK request.
Definition: osip.h:140
state_t state
Current state of the transaction.
Definition: osip.h:378
osip_list_t osip_nist_transactions
list of nist transactions
Definition: osip.h:574
int osip_transaction_set_reserved6(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
Timer F.
Definition: osip.h:119
Event is an incoming informational response.
Definition: osip.h:134
int osip_set_kill_transaction_callback(osip_t *osip, int type, osip_kill_transaction_cb_t cb)
Set a callback for transaction operation related to the end of transactions.
osip_fifo_t * transactionff
events must be added in this fifo
Definition: osip.h:366
Invite Client (outgoing) Transaction.
Definition: osip.h:159
ACK MESSAGE SENT.
Definition: osip.h:411
INVITE MESSAGE SENT.
Definition: osip.h:409
osip_transaction_t * __osip_find_transaction(osip_t *osip, osip_event_t *evt, int consume)
Some race conditions can happen in multi threaded applications.
1XX FOR MESSAGE SENT
Definition: osip.h:463
end of Client INVITE transaction
Definition: osip.h:482
int keep_in_cache
keep in cache value
Definition: osip.h:344
Definition of the Via header.
Definition: osip_via.h:47
osip_fsm_type_t
Enumeration for transaction type.
Definition: osip.h:158
char srv[512]
srv
Definition: osip.h:288
time_t birth_time
birth date of transaction
Definition: osip.h:380
SUBSCRIBE MESSAGE SENT.
Definition: osip.h:441
int timer_f_length
Timer F B = 64* T1.
Definition: osip.h:233
struct timeval timer_e_start
Timer E (retransmission)
Definition: osip.h:232
struct timeval timer_h_start
Timer H (fire if no ACK is received)
Definition: osip.h:256
void osip_start_200ok_retransmissions(osip_t *osip, struct osip_dialog *dialog, osip_message_t *msg200ok, int sock)
Start out of fsm 200 Ok retransmissions.
ACK MESSAGE RECEIVED AGAIN.
Definition: osip.h:425
REQUEST MESSAGE RETRANMITTED.
Definition: osip.h:443
char domain[512]
domain
Definition: osip.h:341
void osip_response_get_destination(osip_message_t *response, char **address, int *portnum)
Search in a SIP response the destination where the message should be sent.
int preference
preference
Definition: osip.h:317
Event is an outgoing final response (not 2XX)
Definition: osip.h:144
void * osip_transaction_get_reserved5(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
INVITE MESSAGE RETRANSMITTED.
Definition: osip.h:410
void * osip_transaction_get_reserved2(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
void osip_event_free(osip_event_t *event)
Free all resource in a sipevent.
osip_call_id_t * callid
CALL-LEG definition (Call-ID)
Definition: osip.h:371
osip_to_t * to
CALL-LEG definition (To)
Definition: osip.h:370
Event is an incoming INVITE request.
Definition: osip.h:131
int timer_e_length
Timer E A=T1, A=2xT1...
Definition: osip.h:231
void osip_retransmissions_execute(osip_t *osip)
Send required retransmissions.
void osip_timers_ict_execute(osip_t *osip)
Check if an ict transactions needs a timer event.
Timer J.
Definition: osip.h:128
osip_list_t osip_nict_transactions
list of nict transactions
Definition: osip.h:573
oSIP SIP Parser additionnal Routines
Structure for referencing a dialog.
Definition: osip_dialog.h:60
osip_message_t * orig_request
Initial request.
Definition: osip.h:374
int osip_nist_execute(osip_t *osip)
Consume ALL pending osip_event_t previously added in the fifos of nist transactions.
void * reserved6
User Defined Pointer.
Definition: osip.h:401
OPTIONS RECEIVED.
Definition: osip.h:455
Definition of the Call-Id header.
Definition: osip_call_id.h:45
transport error for NICT
Definition: osip.h:496
osip_event_t * osip_new_outgoing_sipmessage(osip_message_t *sip)
Allocate a sipevent (we know this message is an OUTGOING SIP message).
osip_cseq_t * cseq
CALL-LEG definition (CSeq)
Definition: osip.h:372
int osip_transaction_set_reserved4(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
Structure for SRV record entry.
Definition: osip.h:287
INFO RECEIVED.
Definition: osip.h:456
void * config
(internal) transaction is managed by osip_t
Definition: osip.h:386
void osip_timers_gettimeout(osip_t *osip, struct timeval *lower_tv)
Retreive the minimum timer value to be used by an application so that the osip_timer_*_execute method...
Structure for 2XX retransmission management.
Definition: osip.h:531
Timer G.
Definition: osip.h:123
void * ixt_fastmutex
mutex for IXT transaction
Definition: osip.h:566
5XX FOR MESSAGE SENT
Definition: osip.h:468
UNKNWON REQUEST RECEIVED AGAIN.
Definition: osip.h:462
6XX FOR INVITE SENT
Definition: osip.h:432
osip_transport_error_callback_type
Enumeration for callback type used when a transport error is detected.
Definition: osip.h:493
osip_list_t osip_ist_transactions
list of ist transactions
Definition: osip.h:572
void osip_timers_nist_execute(osip_t *osip)
Check if a nist transactions needs a timer event.
int index
index
Definition: osip.h:318
struct osip_srv_record siptls_record
tls SRV result
Definition: osip.h:347
void(* osip_kill_transaction_cb_t)(int type, osip_transaction_t *)
Callback definition for end of transaction announcements.
Definition: osip.h:511
void * osip_ist_hastable
htable of ist transactions
Definition: osip.h:585
int osip_transaction_set_reserved1(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
int timer_g_length
Timer G G=MIN(T1*2,T2) for unreliable trans.
Definition: osip.h:253
void osip_start_ack_retransmissions(osip_t *osip, struct osip_dialog *dialog, osip_message_t *ack, char *dest, int port, int sock)
Start out of fsm ACK retransmissions.
Max event.
Definition: osip.h:147
Timer D.
Definition: osip.h:115
void * osip_nict_hastable
htable of nict transactions
Definition: osip.h:586
int port
destination port
Definition: osip.h:539
void * osip_transaction_get_your_instance(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
int osip_transaction_set_reserved2(osip_transaction_t *transaction, void *ptr)
Set a pointer to your personal context associated with this transaction.
osip_nict_t * nict_context
internal nict context
Definition: osip.h:391
int timer_i_length
Timer I I = T4 for unreliable (or 0)
Definition: osip.h:257
void * osip_transaction_get_reserved4(osip_transaction_t *transaction)
Get a pointer to your personal context associated with this transaction.
void * application_context
User defined Pointer.
Definition: osip.h:560
struct osip_srv_record siptcp_record
tcp SRV result
Definition: osip.h:346
enum osip_kill_callback_type osip_kill_callback_type_t
Enumeration for callback type used when transaction is over.
int timer_d_length
Timer D D >= 32s for unreliable tr (or 0)
Definition: osip.h:214
3XX FOR INVITE RECEIVED
Definition: osip.h:416
void * nict_fastmutex
mutex for NICT transaction
Definition: osip.h:564
Timer H.
Definition: osip.h:124
oSIP fifo Routines
Structure for SRV record entry.
Definition: osip.h:312
REGISTER RECEIVED.
Definition: osip.h:453
struct timeval timer_i_start
Timer I (absorb all ACK)
Definition: osip.h:258
Event is an outgoing informational response.
Definition: osip.h:142
Structure for osip event handling.
Definition: osip.h:629
Structure for NON-INVITE CLIENT TRANSACTION.
Definition: osip.h:230
RESPONSE RECEIVED AGAIN.
Definition: osip.h:420
Structure for NON-INVITE SERVER TRANSACTION.
Definition: osip.h:271
int osip_ict_set_destination(osip_ict_t *ict, char *destination, int port)
Set the host and port destination used for sending the SIP message.
void osip_release(osip_t *osip)
Free all resource in a osip_t element.
int order
order
Definition: osip.h:316
int osip_ict_execute(osip_t *osip)
Consume ALL pending osip_event_t previously added in the fifos of ict transactions.
type_t
Enumeration for event type.
Definition: osip.h:111
Non-Invite Client (outgoing) Transaction.
Definition: osip.h:161
osip_message_t * ack
ack request sent
Definition: osip.h:376
Event is an outgoing INVITE request.
Definition: osip.h:139
int osip_transaction_add_event(osip_transaction_t *transaction, osip_event_t *evt)
Add a SIP event in the fifo of a osip_transaction_t element.
Timer B.
Definition: osip.h:114