Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

fsm.h

00001 /*
00002   The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
00003   Copyright (C) 2001,2002,2003  Aymeric MOIZARD jack@atosc.org
00004   
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 /* This is for internal use only.                      */
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 /* load state machine structure for (UAC || UAS) for (INVITE || REQUEST) */
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 /* These methods are the "exection method" for the finite */
00083 /* state machine.                                         */
00084 
00085 /************************/
00086 /* FSM  ---- > ICT      */
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 /* FSM  ---- > IST      */
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 /* FSM  ---- > NICT    */
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 /* void nict_rcv_23456xx2(osip_transaction_t *nict, osip_event_t *evt); */
00130 
00131 /************************/
00132 /* FSM  ---- > NIST     */
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 /* Internal Methods     */
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

Generated on Tue Feb 22 00:59:46 2005 for libosip by  doxygen 1.4.1