| 
    Kannel: Open Source WAP and SMS gateway
    svn-r5336
    
   | 
 
#include "gwlib/gwlib.h"#include "wtp_init.h"#include "wtp_pack.h"#include "wap.h"#include "wtp_init_machine.def"#include "wtp_init_states.def"Go to the source code of this file.
Macros | |
| #define | ENUM(name) init_machine->name = INITIATOR_NULL_STATE; | 
| #define | INTEGER(name) init_machine->name = 0; | 
| #define | EVENT(name) init_machine->name = NULL; | 
| #define | TIMER(name) init_machine->name = gwtimer_create(queue); | 
| #define | ADDRTUPLE(name) init_machine->name = NULL; | 
| #define | MACHINE(field) field | 
| #define | ENUM(name) init_machine->name = INITIATOR_NULL_STATE; | 
| #define | INTEGER(name) init_machine->name = 0; | 
| #define | EVENT(name) wap_event_destroy(init_machine->name); | 
| #define | TIMER(name) gwtimer_destroy(init_machine->name); | 
| #define | ADDRTUPLE(name) wap_addr_tuple_destroy(init_machine->name); | 
| #define | MACHINE(field) field | 
| #define | INIT_STATE_NAME(state) case state: return (unsigned char *) #state; | 
| #define | ROW(state, event, condition, action, new_state) | 
| #define | INIT_STATE_NAME(state) | 
| #define | ROW(init_state, event_type, condition, action, next_state) | 
Enumerations | |
| enum | { limbo, running, terminating } | 
Functions | |
| static void | main_thread (void *arg) | 
| static WTPInitMachine * | init_machine_create (WAPAddrTuple *tuple, unsigned short tid, int tidnew) | 
| static void | init_machine_destroy (void *sm) | 
| static void | handle_init_event (WTPInitMachine *machine, WAPEvent *event) | 
| static WTPInitMachine * | init_machine_find_or_create (WAPEvent *event) | 
| static WAPEvent * | create_tr_abort_ind (WTPInitMachine *sm, long abort_reason) | 
| static WAPEvent * | create_tr_invoke_cnf (WTPInitMachine *machine) | 
| static int | tid_wrapped (unsigned short tid) | 
| static void | send_abort (WTPInitMachine *machine, long type, long reason) | 
| static void | send_ack (WTPInitMachine *machine, long ack_type, int rid_flag) | 
| static unsigned short | rcv_tid (unsigned short tid) | 
| static void | start_initiator_timer_R (WTPInitMachine *machine) | 
| static void | stop_initiator_timer (Timer *timer) | 
| void | wtp_initiator_init (wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *session_dispatch, long timer_freq) | 
| void | wtp_initiator_shutdown (void) | 
| void | wtp_initiator_dispatch_event (WAPEvent *event) | 
| static unsigned char * | name_init_state (int s) | 
| static int | is_wanted_init_machine (void *a, void *b) | 
| static WTPInitMachine * | init_machine_find (WAPAddrTuple *tuple, long tid, long mid) | 
Variables | |
| static List * | init_machines = NULL | 
| static Counter * | init_machine_id_counter = NULL | 
| static int | tidnew = 1 | 
| static List * | queue = NULL | 
| static enum { ... } | initiator_run_status = limbo | 
| static wap_dispatch_func_t * | dispatch_to_wdp | 
| static wap_dispatch_func_t * | dispatch_to_wsp | 
| static long | init_timer_freq = -1 | 
| #define ADDRTUPLE | ( | name | ) | wap_addr_tuple_destroy(init_machine->name); | 
| #define EVENT | ( | name | ) | wap_event_destroy(init_machine->name); | 
| #define INIT_STATE_NAME | ( | state | ) | case state: return (unsigned char *) #state; | 
| #define INIT_STATE_NAME | ( | state | ) | 
| #define MACHINE | ( | field | ) | field | 
| #define MACHINE | ( | field | ) | field | 
| #define ROW | ( | state, | |
| event, | |||
| condition, | |||
| action, | |||
| new_state | |||
| ) | 
| #define ROW | ( | init_state, | |
| event_type, | |||
| condition, | |||
| action, | |||
| next_state | |||
| ) | 
| #define TIMER | ( | name | ) | init_machine->name = gwtimer_create(queue); | 
| #define TIMER | ( | name | ) | gwtimer_destroy(init_machine->name); | 
| anonymous enum | 
| Enumerator | |
|---|---|
| limbo | |
| running | |
| terminating | |
Definition at line 101 of file wtp_init.c.
      
  | 
  static | 
Definition at line 520 of file wtp_init.c.
References INITIATOR_INDICATION, WTPInitMachine::mid, wap_addr_tuple_duplicate(), and wap_event_create.
      
  | 
  static | 
Definition at line 503 of file wtp_init.c.
References gw_assert(), WTPInitMachine::mid, wap_addr_tuple_duplicate(), and wap_event_create.
      
  | 
  static | 
Definition at line 301 of file wtp_init.c.
References debug(), error(), init_machine_destroy(), WTPInitMachine::mid, name_init_state(), WAPEvent::type, wap_event_destroy(), wap_event_dump(), and wap_event_name().
Referenced by main_thread().
      
  | 
  static | 
Definition at line 229 of file wtp_init.c.
References counter_increase(), debug(), gwlist_append(), init_machine_id_counter, init_machines, WTPInitMachine::mid, machine_pattern::tid, tidnew, machine_pattern::tuple, and wap_addr_tuple_duplicate().
Referenced by init_machine_find_or_create().
      
  | 
  static | 
Definition at line 261 of file wtp_init.c.
References debug(), gwlist_delete_equal(), init_machines, and WTPInitMachine::mid.
Referenced by handle_init_event(), and wtp_initiator_shutdown().
      
  | 
  static | 
Definition at line 357 of file wtp_init.c.
References gwlist_search(), init_machines, is_wanted_init_machine(), machine_pattern::mid, machine_pattern::tid, and machine_pattern::tuple.
Referenced by init_machine_find_or_create().
      
  | 
  static | 
Definition at line 388 of file wtp_init.c.
References dispatch_to_wdp, error(), gw_assert(), info(), init_machine_create(), init_machine_find(), INVALIDTID, WTPInitMachine::mid, machine_pattern::mid, PROVIDER, rcv_tid(), WAPEvent::RcvAck, machine_pattern::tid, tid_wrapped(), tidnew, machine_pattern::tuple, WAPEvent::type, WAPEvent::u, wap_event_dump(), and wtp_pack_abort().
Referenced by main_thread().
      
  | 
  static | 
Definition at line 339 of file wtp_init.c.
References WTPInitMachine::mid, machine_pattern::mid, machine_pattern::tid, machine_pattern::tuple, and wap_addr_tuple_same().
Referenced by init_machine_find().
      
  | 
  static | 
Definition at line 214 of file wtp_init.c.
References gwlist_consume(), handle_init_event(), init_machine_find_or_create(), initiator_run_status, queue, running, and wap_event_destroy().
Referenced by wtp_initiator_init(), and wtp_initiator_shutdown().
      
  | 
  static | 
      
  | 
  static | 
Definition at line 541 of file wtp_init.c.
References machine_pattern::tid.
Referenced by init_machine_find_or_create(), tid_in_window(), and wtp_tid_is_valid().
      
  | 
  static | 
Definition at line 571 of file wtp_init.c.
References dispatch_to_wdp, type, and wtp_pack_abort().
      
  | 
  static | 
Definition at line 579 of file wtp_init.c.
References dispatch_to_wdp, and wtp_pack_ack().
      
  | 
  static | 
Definition at line 550 of file wtp_init.c.
References gwtimer_start(), init_timer_freq, WTPInitMachine::mid, S_R_WITH_USER_ACK, S_R_WITHOUT_USER_ACK, WAPEvent::u, and wap_event_create.
      
  | 
  static | 
Definition at line 564 of file wtp_init.c.
References debug(), gw_assert(), and gwtimer_stop().
      
  | 
  static | 
Definition at line 536 of file wtp_init.c.
References machine_pattern::tid.
Referenced by init_machine_find_or_create().
| void wtp_initiator_dispatch_event | ( | WAPEvent * | event | ) | 
Definition at line 204 of file wtp_init.c.
References gwlist_produce(), and queue.
Referenced by main(), and wap_dispatch_datagram().
| void wtp_initiator_init | ( | wap_dispatch_func_t * | datagram_dispatch, | 
| wap_dispatch_func_t * | session_dispatch, | ||
| long | timer_freq | ||
| ) | 
Definition at line 168 of file wtp_init.c.
References counter_create(), dispatch_to_wdp, dispatch_to_wsp, gw_assert(), gwlist_add_producer(), gwlist_create, gwthread_create, init_machine_id_counter, init_machines, init_timer_freq, initiator_run_status, limbo, main_thread(), queue, running, timer_freq, and timers_init().
Referenced by main().
| void wtp_initiator_shutdown | ( | void | ) | 
Definition at line 188 of file wtp_init.c.
References counter_destroy(), debug(), gw_assert(), gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), init_machine_destroy(), init_machine_id_counter, init_machines, initiator_run_status, main_thread(), queue, running, terminating, timers_shutdown(), and wap_event_destroy_item().
Referenced by main().
      
  | 
  static | 
Definition at line 103 of file wtp_init.c.
Referenced by init_machine_find_or_create(), send_abort(), send_ack(), and wtp_initiator_init().
      
  | 
  static | 
Definition at line 104 of file wtp_init.c.
Referenced by wtp_initiator_init().
      
  | 
  static | 
Definition at line 78 of file wtp_init.c.
Referenced by init_machine_create(), wtp_initiator_init(), and wtp_initiator_shutdown().
      
  | 
  static | 
Definition at line 73 of file wtp_init.c.
Referenced by init_machine_create(), init_machine_destroy(), init_machine_find(), wtp_initiator_init(), and wtp_initiator_shutdown().
      
  | 
  static | 
Definition at line 109 of file wtp_init.c.
Referenced by start_initiator_timer_R(), and wtp_initiator_init().
| enum { ... } initiator_run_status | 
Referenced by main_thread(), wtp_initiator_init(), and wtp_initiator_shutdown().
      
  | 
  static | 
Definition at line 89 of file wtp_init.c.
Referenced by main_thread(), wtp_initiator_dispatch_event(), wtp_initiator_init(), and wtp_initiator_shutdown().
      
  | 
  static | 
Definition at line 84 of file wtp_init.c.
Referenced by init_machine_create(), and init_machine_find_or_create().