00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _FSM_H_
00021 #define _FSM_H_
00022
00023 #include <osipparser2/osip_message.h>
00024 #include <osip2/osip.h>
00025
00026 #include "xixt.h"
00027
00028 #ifndef DOXYGEN
00029
00030 typedef struct osip_statemachine osip_statemachine_t;
00031
00032 struct osip_statemachine
00033 {
00034 osip_list_t *transitions;
00035 };
00036
00043 osip_event_t *__osip_event_new (type_t type, int transactionid);
00044
00045
00046
00047 type_t evt_set_type_incoming_sipmessage (osip_message_t * sip);
00048 type_t evt_set_type_outgoing_sipmessage (osip_message_t * sip);
00049
00050
00051 void __ict_load_fsm (void);
00052 void __ist_load_fsm (void);
00053 void __nict_load_fsm (void);
00054 void __nist_load_fsm (void);
00055
00056 void __ict_unload_fsm (void);
00057 void __ist_unload_fsm (void);
00058 void __nict_unload_fsm (void);
00059 void __nist_unload_fsm (void);
00060
00061
00062 osip_statemachine_t *__ict_get_fsm (void);
00063 osip_statemachine_t *__ist_get_fsm (void);
00064
00065 osip_statemachine_t *__nict_get_fsm (void);
00066 osip_statemachine_t *__nist_get_fsm (void);
00067
00068 typedef struct _transition_t
00069 {
00070 state_t state;
00071 type_t type;
00072 void (*method) (void *, void *);
00073 }
00074 transition_t;
00075
00076 int fsm_callmethod (type_t type, state_t state,
00077 osip_statemachine_t * statemachine,
00078 void *sipevent, void *transaction);
00079
00080
00082
00083
00084
00085
00086
00087
00088
00089 void ict_snd_invite (osip_transaction_t * ict, osip_event_t * evt);
00090 void osip_ict_timeout_a_event (osip_transaction_t * ict, osip_event_t * evt);
00091 void osip_ict_timeout_b_event (osip_transaction_t * ict, osip_event_t * evt);
00092 void osip_ict_timeout_d_event (osip_transaction_t * ict, osip_event_t * evt);
00093 void ict_rcv_1xx (osip_transaction_t * ict, osip_event_t * evt);
00094 void ict_rcv_2xx (osip_transaction_t * ict, osip_event_t * evt);
00095 osip_message_t *ict_create_ack (osip_transaction_t * ict,
00096 osip_message_t * response);
00097 void ict_rcv_3456xx (osip_transaction_t * ict, osip_event_t * evt);
00098 void ict_retransmit_ack (osip_transaction_t * ict, osip_event_t * evt);
00099
00100
00101
00102
00103
00104 osip_message_t *ist_create_resp_100 (osip_transaction_t * ist,
00105 osip_message_t * request);
00106 void ist_rcv_invite (osip_transaction_t * ist, osip_event_t * evt);
00107 void osip_ist_timeout_g_event (osip_transaction_t * ist, osip_event_t * evt);
00108 void osip_ist_timeout_h_event (osip_transaction_t * ist, osip_event_t * evt);
00109 void osip_ist_timeout_i_event (osip_transaction_t * ist, osip_event_t * evt);
00110 void ist_snd_1xx (osip_transaction_t * ist, osip_event_t * evt);
00111 void ist_snd_2xx (osip_transaction_t * ist, osip_event_t * evt);
00112 void ist_snd_3456xx (osip_transaction_t * ist, osip_event_t * evt);
00113 void ist_rcv_ack (osip_transaction_t * ist, osip_event_t * evt);
00114
00115
00116
00117
00118
00119 void nict_snd_request (osip_transaction_t * nict, osip_event_t * evt);
00120 void osip_nict_timeout_e_event (osip_transaction_t * nict,
00121 osip_event_t * evt);
00122 void osip_nict_timeout_f_event (osip_transaction_t * nict,
00123 osip_event_t * evt);
00124 void osip_nict_timeout_k_event (osip_transaction_t * nict,
00125 osip_event_t * evt);
00126 void nict_rcv_1xx (osip_transaction_t * nict, osip_event_t * evt);
00127 void nict_rcv_23456xx (osip_transaction_t * nict, osip_event_t * evt);
00128
00129
00130
00131
00132
00133
00134
00135 void nist_rcv_request (osip_transaction_t * nist, osip_event_t * evt);
00136 void nist_snd_1xx (osip_transaction_t * nist, osip_event_t * evt);
00137 void nist_snd_23456xx (osip_transaction_t * nist, osip_event_t * evt);
00138 void osip_nist_timeout_j_event (osip_transaction_t * nist,
00139 osip_event_t * evt);
00140
00141
00142
00143
00144
00145
00146 void __osip_message_callback (int type, osip_transaction_t *,
00147 osip_message_t *);
00148 void __osip_kill_transaction_callback (int type, osip_transaction_t *);
00149 void __osip_transport_error_callback (int type, osip_transaction_t *,
00150 int error);
00151
00158 int __osip_transaction_set_state (osip_transaction_t * transaction,
00159 state_t state);
00160
00167 int
00168 __osip_transaction_matching_response_osip_to_xict_17_1_3 (osip_transaction_t *
00169 tr,
00170 osip_message_t *
00171 resp);
00172
00179 int
00180 __osip_transaction_matching_request_osip_to_xist_17_2_3 (osip_transaction_t *
00181 tr,
00182 osip_message_t *
00183 request);
00184
00185 #endif
00186
00187 #endif