File: fsm.h

package info (click to toggle)
libosip 0.9.7-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,852 kB
  • ctags: 1,812
  • sloc: ansic: 20,266; sh: 9,218; makefile: 215
file content (121 lines) | stat: -rw-r--r-- 4,311 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
  Copyright (C) 2001,2002,2003  Aymeric MOIZARD jack@atosc.org
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _FSM_H_
#define _FSM_H_

#include <osip/smsg.h>
#include <osip/osip.h>

/* This is for internal use only.                      */
type_t evt_settype_incoming_sipmessage (sip_t * sip);
type_t evt_settype_outgoing_sipmessage (sip_t * sip);

/* send a request on UDP.                       */
int udp_send_request (sip_t * request, url_t * proxy);

/* send a response on UDP.                       */
int udp_send_response (sip_t * response);

void ict_load_fsm ();
void ist_load_fsm ();
void nict_load_fsm ();
void nist_load_fsm ();

void ict_unload_fsm ();
void ist_unload_fsm ();
void nict_unload_fsm ();
void nist_unload_fsm ();

/* load state machine structure for (UAC || UAS) for (INVITE || REQUEST) */
statemachine_t *ict_get_fsm ();
statemachine_t *ist_get_fsm ();

statemachine_t *nict_get_fsm ();
statemachine_t *nist_get_fsm ();

typedef struct _transition_t
{
  state_t state;
  type_t type;
  void (*method) (void *, void *);
}
transition_t;

int fsm_callmethod (type_t type, state_t state,
		    statemachine_t * statemachine,
		    void *sipevent, void *transaction);


/*!! THESE ARE FOR INTERNAL USE ONLY!! */
/* These methods are the "exection method" for the finite */
/* state machine.                                         */

/************************/
/* FSM  ---- > ICT      */
/************************/

void ict_snd_invite (transaction_t * ict, sipevent_t * evt);
void ict_timeout_a_event (transaction_t * ict, sipevent_t * evt);
void ict_timeout_b_event (transaction_t * ict, sipevent_t * evt);
void ict_timeout_d_event (transaction_t * ict, sipevent_t * evt);
void ict_rcv_1xx (transaction_t * ict, sipevent_t * evt);
void ict_rcv_2xx (transaction_t * ict, sipevent_t * evt);
sip_t *ict_create_ack (transaction_t * ict, sip_t * response);
void ict_rcv_3456xx (transaction_t * ict, sipevent_t * evt);
void ict_retransmit_ack (transaction_t * ict, sipevent_t * evt);

/************************/
/* FSM  ---- > IST      */
/************************/

sip_t *ist_create_resp_100 (transaction_t * ist, sip_t * request);
void ist_rcv_invite (transaction_t * ist, sipevent_t * evt);
void ist_timeout_g_event (transaction_t * ist, sipevent_t * evt);
void ist_timeout_h_event (transaction_t * ist, sipevent_t * evt);
void ist_timeout_i_event (transaction_t * ist, sipevent_t * evt);
void ist_snd_1xx (transaction_t * ist, sipevent_t * evt);
void ist_snd_2xx (transaction_t * ist, sipevent_t * evt);
void ist_snd_3456xx (transaction_t * ist, sipevent_t * evt);
void ist_rcv_ack (transaction_t * ist, sipevent_t * evt);

/***********************/
/* FSM  ---- > NICT    */
/***********************/

void nict_snd_request (transaction_t * nict, sipevent_t * evt);
void nict_timeout_e_event (transaction_t * nict, sipevent_t * evt);
void nict_timeout_f_event (transaction_t * nict, sipevent_t * evt);
void nict_timeout_k_event (transaction_t * nict, sipevent_t * evt);
void nict_rcv_1xx (transaction_t * nict, sipevent_t * evt);
void nict_rcv_23456xx (transaction_t * nict, sipevent_t * evt);

/* void nict_rcv_23456xx2(transaction_t *nict, sipevent_t *evt); */

/************************/
/* FSM  ---- > NIST     */
/************************/

void nist_rcv_request (transaction_t * nist, sipevent_t * evt);
void nist_snd_1xx (transaction_t * nist, sipevent_t * evt);
void nist_snd_23456xx (transaction_t * nist, sipevent_t * evt);
void nist_timeout_j_event (transaction_t * nist, sipevent_t * evt);


#endif