Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wtp_init.c File Reference
#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 WTPInitMachineinit_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 WTPInitMachineinit_machine_find_or_create (WAPEvent *event)
 
static WAPEventcreate_tr_abort_ind (WTPInitMachine *sm, long abort_reason)
 
static WAPEventcreate_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 WTPInitMachineinit_machine_find (WAPAddrTuple *tuple, long tid, long mid)
 

Variables

static Listinit_machines = NULL
 
static Counterinit_machine_id_counter = NULL
 
static int tidnew = 1
 
static Listqueue = NULL
 
static enum { ... }  initiator_run_status = limbo
 
static wap_dispatch_func_tdispatch_to_wdp
 
static wap_dispatch_func_tdispatch_to_wsp
 
static long init_timer_freq = -1
 

Macro Definition Documentation

#define ADDRTUPLE (   name)    init_machine->name = NULL;
#define ADDRTUPLE (   name)    wap_addr_tuple_destroy(init_machine->name);
#define ENUM (   name)    init_machine->name = INITIATOR_NULL_STATE;
#define ENUM (   name)    init_machine->name = INITIATOR_NULL_STATE;
#define EVENT (   name)    init_machine->name = NULL;
#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 INTEGER (   name)    init_machine->name = 0;
#define INTEGER (   name)    init_machine->name = 0;
#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 
)
Value:
if (init_machine->state == init_state && \
event->type == event_type && \
(condition)) { \
action \
init_machine->state = next_state; \
debug("wap.wtp", 0, "WTP_INIT %ld: New state %s", \
init_machine->mid, #next_state); \
} else
#define TIMER (   name)    init_machine->name = gwtimer_create(queue);
#define TIMER (   name)    gwtimer_destroy(init_machine->name);

Enumeration Type Documentation

anonymous enum
Enumerator
limbo 
running 
terminating 

Definition at line 101 of file wtp_init.c.

static enum @104 initiator_run_status

Function Documentation

static WAPEvent * create_tr_abort_ind ( WTPInitMachine sm,
long  abort_reason 
)
static

Definition at line 520 of file wtp_init.c.

References INITIATOR_INDICATION, WTPInitMachine::mid, wap_addr_tuple_duplicate(), and wap_event_create.

521 {
522  WAPEvent *event;
523 
524  event = wap_event_create(TR_Abort_Ind);
525 
526  event->u.TR_Abort_Ind.abort_code = abort_reason;
527  event->u.TR_Abort_Ind.addr_tuple =
528  wap_addr_tuple_duplicate(sm->addr_tuple);
529  event->u.TR_Abort_Ind.handle = sm->mid;
530  event->u.TR_Abort_Ind.ir_flag = INITIATOR_INDICATION;
531 
532  return event;
533 }
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
Definition: wap_addr.c:125
unsigned long mid
Definition: wtp_init.h:90
#define wap_event_create(type)
Definition: wap_events.h:107
static WAPEvent * create_tr_invoke_cnf ( WTPInitMachine machine)
static

Definition at line 503 of file wtp_init.c.

References gw_assert(), WTPInitMachine::mid, wap_addr_tuple_duplicate(), and wap_event_create.

504 {
505  WAPEvent *event;
506 
507  gw_assert(init_machine != NULL);
508  event = wap_event_create(TR_Invoke_Cnf);
509  event->u.TR_Invoke_Cnf.handle = init_machine->mid;
510  event->u.TR_Invoke_Cnf.addr_tuple =
511  wap_addr_tuple_duplicate(init_machine->addr_tuple);
512 
513  return event;
514 }
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
Definition: wap_addr.c:125
#define wap_event_create(type)
Definition: wap_events.h:107
gw_assert(wtls_machine->packet_to_send!=NULL)
static void handle_init_event ( WTPInitMachine machine,
WAPEvent event 
)
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().

302 {
303  WAPEvent *wsp_event = NULL;
304 
305  debug("wap.wtp", 0, "WTP_INIT: initiator machine %ld, state %s,"
306  " event %s.",
307  init_machine->mid,
308  name_init_state(init_machine->state),
309  wap_event_name(event->type));
310 
311  #define INIT_STATE_NAME(state)
312  #define ROW(init_state, event_type, condition, action, next_state) \
313  if (init_machine->state == init_state && \
314  event->type == event_type && \
315  (condition)) { \
316  action \
317  init_machine->state = next_state; \
318  debug("wap.wtp", 0, "WTP_INIT %ld: New state %s", \
319  init_machine->mid, #next_state); \
320  } else
321  #include "wtp_init_states.def"
322  {
323  error(1, "WTP_INIT: handle_init_event: unhandled event!");
324  debug("wap.wtp.init", 0, "WTP_INIT: handle_init_event:"
325  "Unhandled event was:");
326  wap_event_dump(event);
327  wap_event_destroy(event);
328  return;
329  }
330 
331  if (event != NULL) {
332  wap_event_destroy(event);
333  }
334 
335  if (init_machine->state == INITIATOR_NULL_STATE)
336  init_machine_destroy(init_machine);
337 }
void error(int err, const char *fmt,...)
Definition: log.c:612
void wap_event_dump(WAPEvent *event)
Definition: wap_events.c:181
static unsigned char * name_init_state(int s)
Definition: wtp_init.c:284
static void init_machine_destroy(void *sm)
Definition: wtp_init.c:261
const char * wap_event_name(WAPEventName type)
Definition: wap_events.c:169
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
WAPEventName type
Definition: wap_events.h:88
void wap_event_destroy(WAPEvent *event)
Definition: wap_events.c:102
static WTPInitMachine * init_machine_create ( WAPAddrTuple tuple,
unsigned short  tid,
int  tidnew 
)
static

Definition at line 229 of file wtp_init.c.

References counter_increase(), debug(), gwlist_append(), WTPInitMachine::mid, machine_pattern::tid, tidnew, and wap_addr_tuple_duplicate().

Referenced by init_machine_find_or_create().

231 {
232  WTPInitMachine *init_machine;
233 
234  init_machine = gw_malloc(sizeof(WTPInitMachine));
235 
236  #define ENUM(name) init_machine->name = INITIATOR_NULL_STATE;
237  #define INTEGER(name) init_machine->name = 0;
238  #define EVENT(name) init_machine->name = NULL;
239  #define TIMER(name) init_machine->name = gwtimer_create(queue);
240  #define ADDRTUPLE(name) init_machine->name = NULL;
241  #define MACHINE(field) field
242  #include "wtp_init_machine.def"
243 
244  gwlist_append(init_machines, init_machine);
245 
247  init_machine->addr_tuple = wap_addr_tuple_duplicate(tuple);
248  init_machine->tid = tid;
249  init_machine->tidnew = tidnew;
250 
251  debug("wap.wtp", 0, "WTP: Created WTPInitMachine %p (%ld)",
252  (void *) init_machine, init_machine->mid);
253 
254  return init_machine;
255 }
static int tidnew
Definition: wtp_init.c:84
void gwlist_append(List *list, void *item)
Definition: list.c:179
static List * init_machines
Definition: wtp_init.c:73
unsigned long counter_increase(Counter *counter)
Definition: counter.c:123
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
Definition: wap_addr.c:125
unsigned long mid
Definition: wtp_init.h:90
static Counter * init_machine_id_counter
Definition: wtp_init.c:78
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
static void init_machine_destroy ( void *  sm)
static

Definition at line 261 of file wtp_init.c.

References debug(), gwlist_delete_equal(), and WTPInitMachine::mid.

Referenced by handle_init_event(), and wtp_initiator_shutdown().

262 {
263  WTPInitMachine *init_machine;
264 
265  init_machine = p;
266  debug("wap.wtp", 0, "WTP: Destroying WTPInitMachine %p (%ld)",
267  (void *) init_machine, init_machine->mid);
268 
269  gwlist_delete_equal(init_machines, init_machine);
270 
271  #define ENUM(name) init_machine->name = INITIATOR_NULL_STATE;
272  #define INTEGER(name) init_machine->name = 0;
273  #define EVENT(name) wap_event_destroy(init_machine->name);
274  #define TIMER(name) gwtimer_destroy(init_machine->name);
275  #define ADDRTUPLE(name) wap_addr_tuple_destroy(init_machine->name);
276  #define MACHINE(field) field
277  #include "wtp_init_machine.def"
278  gw_free(init_machine);
279 }
static List * init_machines
Definition: wtp_init.c:73
unsigned long mid
Definition: wtp_init.h:90
long gwlist_delete_equal(List *list, void *item)
Definition: list.c:266
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
static WTPInitMachine* init_machine_find ( WAPAddrTuple tuple,
long  tid,
long  mid 
)
static

Definition at line 357 of file wtp_init.c.

References gwlist_search(), is_wanted_init_machine(), machine_pattern::mid, machine_pattern::tid, and machine_pattern::tuple.

Referenced by init_machine_find_or_create().

359 {
360  struct machine_pattern pat;
361  WTPInitMachine *m;
362 
363  pat.tuple = tuple;
364  pat.tid = tid;
365  pat.mid = mid;
366 
368  return m;
369 }
static int is_wanted_init_machine(void *a, void *b)
Definition: wtp_init.c:339
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
Definition: list.c:486
long tid
Definition: wtp.h:190
static List * init_machines
Definition: wtp_init.c:73
WAPAddrTuple * tuple
Definition: wtp.h:189
long mid
Definition: wtp.h:191
static WTPInitMachine * init_machine_find_or_create ( WAPEvent event)
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().

389 {
390  WTPInitMachine *machine = NULL;
391  long mid;
392  static long tid = -1;
394 
395  mid = -1;
396  tuple = NULL;
397 
398  switch (event->type) {
399  case RcvAck:
400  tid = event->u.RcvAck.tid;
401  tuple = event->u.RcvAck.addr_tuple;
402  break;
403 
404  case RcvAbort:
405  tid = event->u.RcvAbort.tid;
406  tuple = event->u.RcvAbort.addr_tuple;
407  break;
408 
409  case RcvErrorPDU:
410  mid = event->u.RcvErrorPDU.tid;
411  tid = event->u.RcvErrorPDU.tid;
412  tuple = event->u.RcvErrorPDU.addr_tuple;
413  break;
414 /*
415  * When we are receiving an invoke requirement, we must create a new trans-
416  * action and generate a new tid. This can be wrapped, and should have its
417  * first bit turned.
418  */
419  case TR_Invoke_Req:
420  ++tid;
421  if (tid_wrapped(tid)) {
422  tidnew = 1;
423  tid = 0;
424  }
425 
426  tid = rcv_tid(tid);
427  tuple = event->u.TR_Invoke_Req.addr_tuple;
428  mid = event->u.TR_Invoke_Req.handle;
429  break;
430 
431  case TR_Abort_Req:
432  tid = event->u.TR_Abort_Req.handle;
433  break;
434 
435  case TimerTO_R:
436  mid = event->u.TimerTO_R.handle;
437  break;
438 
439  default:
440  error(0, "WTP_INIT: machine_find_or_create: unhandled event");
441  wap_event_dump(event);
442  return NULL;
443  }
444 
445  gw_assert(tuple != NULL || mid != -1);
446  machine = init_machine_find(tuple, tid, mid);
447 
448  if (machine == NULL){
449 
450  switch (event->type){
451  case RcvAck:
452 
453 /*
454  * Case nro 2 If we do not have a tid asked for, we send a negative answer,
455  * i.e. an abort with reason INVALIDTID.
456  */
457  if (event->u.RcvAck.tid_ok) {
459  tid, tuple));
460  }
461 
462 /* Case nro 3, normal ack */
463  else
464  info(0, "WTP_INIT: machine_find_or_create: ack "
465  "received, yet having no machine");
466  break;
467 
468 /* Case nro 3, abort */
469  case RcvAbort:
470  info(0, "WTP_INIT: machine_find_or_create: abort "
471  "received, yet having no machine");
472  break;
473 
474  case TR_Invoke_Req:
475  machine = init_machine_create(tuple, tid, tidnew);
476  machine->mid = event->u.TR_Invoke_Req.handle;
477  break;
478 
479  case TR_Abort_Req:
480  error(0, "WTP_INIT: machine_find_or_create: WSP "
481  "primitive to a wrong WTP machine");
482  break;
483 
484  case TimerTO_R:
485  error(0, "WTP_INIT: machine_find_or_create: timer "
486  "event without a corresponding machine");
487  break;
488 
489  default:
490  error(0, "WTP_INIT: machine_find_or_create: unhandled"
491  "event");
492  wap_event_dump(event);
493  break;
494  }
495  }
496 
497  return machine;
498 }
void error(int err, const char *fmt,...)
Definition: log.c:612
void info(int err, const char *fmt,...)
Definition: log.c:636
static int tidnew
Definition: wtp_init.c:84
long tid
Definition: wtp.h:190
static unsigned short rcv_tid(unsigned short tid)
Definition: wtp_init.c:541
static int tid_wrapped(unsigned short tid)
Definition: wtp_init.c:536
void wap_event_dump(WAPEvent *event)
Definition: wap_events.c:181
WAPAddrTuple * tuple
Definition: wtp.h:189
unsigned long mid
Definition: wtp_init.h:90
T DUnitdata TR Invoke TR Invoke TR Result TR Abort S Connect S Suspend S Resume S Suspend S Resume S Disconnect S MethodInvoke S MethodInvoke S MethodResult S MethodInvoke S MethodResult S MethodAbort S Push S ConfirmedPush S ConfirmedPush S PushAbort RcvAck
Definition: wap_events.h:532
static WTPInitMachine * init_machine_find(WAPAddrTuple *tuple, long tid, long mid)
Definition: wtp_init.c:357
long mid
Definition: wtp.h:191
Definition: wtp.h:124
gw_assert(wtls_machine->packet_to_send!=NULL)
static WTPInitMachine * init_machine_create(WAPAddrTuple *tuple, unsigned short tid, int tidnew)
Definition: wtp_init.c:229
WAPEventName type
Definition: wap_events.h:88
WAPEvent * wtp_pack_abort(long abort_type, long abort_reason, long tid, WAPAddrTuple *address)
Definition: wtp_pack.c:223
static wap_dispatch_func_t * dispatch_to_wdp
Definition: wtp_init.c:103
union WAPEvent::@87 u
static int is_wanted_init_machine ( void *  a,
void *  b 
)
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().

340 {
341  struct machine_pattern *pat;
342  WTPInitMachine *m;
343 
344  m = a;
345  pat = b;
346 
347  if (m->mid == pat->mid)
348  return 1;
349 
350  if (pat->mid != -1)
351  return 0;
352 
353  return m->tid == pat->tid &&
354  wap_addr_tuple_same(m->addr_tuple, pat->tuple);
355 }
long tid
Definition: wtp.h:190
WAPAddrTuple * tuple
Definition: wtp.h:189
unsigned long mid
Definition: wtp_init.h:90
long mid
Definition: wtp.h:191
int wap_addr_tuple_same(WAPAddrTuple *a, WAPAddrTuple *b)
Definition: wap_addr.c:118
static void main_thread ( void *  arg)
static

Definition at line 214 of file wtp_init.c.

References gwlist_consume(), handle_init_event(), init_machine_find_or_create(), initiator_run_status, running, and wap_event_destroy().

Referenced by wtp_initiator_init(), and wtp_initiator_shutdown().

215 {
216  WTPInitMachine *sm;
217  WAPEvent *e;
218 
219  while (initiator_run_status == running &&
220  (e = gwlist_consume(queue)) != NULL) {
222  if (sm == NULL)
224  else
225  handle_init_event(sm, e);
226  }
227 }
static void handle_init_event(WTPInitMachine *machine, WAPEvent *event)
Definition: wtp_init.c:301
static enum @104 initiator_run_status
static WTPInitMachine * init_machine_find_or_create(WAPEvent *event)
Definition: wtp_init.c:388
void * gwlist_consume(List *list)
Definition: list.c:427
static List * queue
Definition: wtp_init.c:89
void wap_event_destroy(WAPEvent *event)
Definition: wap_events.c:102
static unsigned char* name_init_state ( int  s)
static

Definition at line 284 of file wtp_init.c.

Referenced by handle_init_event().

285 {
286  switch (s){
287  #define INIT_STATE_NAME(state) case state: return (unsigned char *) #state;
288  #define ROW(state, event, condition, action, new_state)
289  #include "wtp_init_states.def"
290  default:
291  return (unsigned char *)"unknown state";
292  }
293 }
static unsigned short rcv_tid ( unsigned short  tid)
static

Definition at line 541 of file wtp_init.c.

Referenced by init_machine_find_or_create(), and wtp_tid_is_valid().

542 {
543  return tid ^ 0x8000;
544 }
long tid
Definition: wtp.h:190
static void send_abort ( WTPInitMachine machine,
long  type,
long  reason 
)
static

Definition at line 571 of file wtp_init.c.

References dispatch_to_wdp, and wtp_pack_abort().

572 {
573  WAPEvent *e;
574 
575  e = wtp_pack_abort(type, reason, machine->tid, machine->addr_tuple);
576  dispatch_to_wdp(e);
577 }
int type
Definition: smsc_cimd2.c:215
WAPEvent * wtp_pack_abort(long abort_type, long abort_reason, long tid, WAPAddrTuple *address)
Definition: wtp_pack.c:223
static wap_dispatch_func_t * dispatch_to_wdp
Definition: wtp_init.c:103
static void send_ack ( WTPInitMachine machine,
long  ack_type,
int  rid_flag 
)
static

Definition at line 579 of file wtp_init.c.

References dispatch_to_wdp, and wtp_pack_ack().

580 {
581  WAPEvent *e;
582 
583  e = wtp_pack_ack(ack_type, rid_flag, machine->tid, machine->addr_tuple);
584  dispatch_to_wdp(e);
585 }
WAPEvent * wtp_pack_ack(long ack_type, int rid_flag, long tid, WAPAddrTuple *address)
Definition: wtp_pack.c:243
static wap_dispatch_func_t * dispatch_to_wdp
Definition: wtp_init.c:103
static void start_initiator_timer_R ( WTPInitMachine machine)
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.

551 {
552  WAPEvent *timer_event;
553  int seconds;
554 
555  timer_event = wap_event_create(TimerTO_R);
556  timer_event->u.TimerTO_R.handle = machine->mid;
557  if (machine->u_ack)
559  else
561  gwtimer_start(machine->timer, seconds, timer_event);
562 }
unsigned long mid
Definition: wtp_init.h:90
void gwtimer_start(Timer *timer, int interval, WAPEvent *event)
Definition: timers.c:254
#define wap_event_create(type)
Definition: wap_events.h:107
static long init_timer_freq
Definition: wtp_init.c:109
union WAPEvent::@87 u
static void stop_initiator_timer ( Timer timer)
static

Definition at line 564 of file wtp_init.c.

References debug(), gw_assert(), and gwtimer_stop().

565 {
566  debug("wap.wtp_init", 0, "stopping timer");
567  gw_assert(timer);
568  gwtimer_stop(timer);
569 }
void gwtimer_stop(Timer *timer)
Definition: timers.c:299
gw_assert(wtls_machine->packet_to_send!=NULL)
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
static int tid_wrapped ( unsigned short  tid)
static

Definition at line 536 of file wtp_init.c.

Referenced by init_machine_find_or_create().

537 {
538  return tid > (1 << 15);
539 }
long tid
Definition: wtp.h:190
void wtp_initiator_dispatch_event ( WAPEvent event)

Definition at line 204 of file wtp_init.c.

References gwlist_produce().

Referenced by main(), and wap_dispatch_datagram().

205 {
206  gwlist_produce(queue, event);
207 }
void gwlist_produce(List *list, void *item)
Definition: list.c:411
static List * queue
Definition: wtp_init.c:89
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_timer_freq, initiator_run_status, limbo, main_thread(), running, timer_freq, and timers_init().

Referenced by main().

170 {
173 
174  queue = gwlist_create();
176 
177  dispatch_to_wdp = datagram_dispatch;
178  dispatch_to_wsp = session_dispatch;
179 
180  timers_init();
182 
186 }
static List * init_machines
Definition: wtp_init.c:73
static wap_dispatch_func_t * dispatch_to_wsp
Definition: wtp_init.c:104
Counter * counter_create(void)
Definition: counter.c:94
static enum @104 initiator_run_status
static void main_thread(void *arg)
Definition: wtp_init.c:214
static Counter * init_machine_id_counter
Definition: wtp_init.c:78
#define gwthread_create(func, arg)
Definition: gwthread.h:90
gw_assert(wtls_machine->packet_to_send!=NULL)
void timers_init(void)
Definition: timers.c:184
#define gwlist_create()
Definition: list.h:136
static List * queue
Definition: wtp_init.c:89
static wap_dispatch_func_t * dispatch_to_wdp
Definition: wtp_init.c:103
static long init_timer_freq
Definition: wtp_init.c:109
void gwlist_add_producer(List *list)
Definition: list.c:383
static long timer_freq
Definition: wapbox.c:104
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(), initiator_run_status, main_thread(), running, terminating, timers_shutdown(), and wap_event_destroy_item().

Referenced by main().

189 {
194 
195  debug("wap.wtp", 0, "wtp_initiator_shutdown: %ld init_machines left",
199 
201  timers_shutdown();
202 }
void counter_destroy(Counter *counter)
Definition: counter.c:110
long gwlist_len(List *list)
Definition: list.c:166
static List * init_machines
Definition: wtp_init.c:73
void gwthread_join_every(gwthread_func_t *func)
static enum @104 initiator_run_status
static void init_machine_destroy(void *sm)
Definition: wtp_init.c:261
void gwlist_remove_producer(List *list)
Definition: list.c:401
void wap_event_destroy_item(void *event)
Definition: wap_events.c:130
static void main_thread(void *arg)
Definition: wtp_init.c:214
void timers_shutdown(void)
Definition: timers.c:196
static Counter * init_machine_id_counter
Definition: wtp_init.c:78
gw_assert(wtls_machine->packet_to_send!=NULL)
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
static List * queue
Definition: wtp_init.c:89
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145

Variable Documentation

wap_dispatch_func_t* dispatch_to_wdp
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().

wap_dispatch_func_t* dispatch_to_wsp
static

Definition at line 104 of file wtp_init.c.

Referenced by wtp_initiator_init().

Counter* init_machine_id_counter = NULL
static

Definition at line 78 of file wtp_init.c.

List* init_machines = NULL
static

Definition at line 73 of file wtp_init.c.

long init_timer_freq = -1
static

Definition at line 109 of file wtp_init.c.

Referenced by start_initiator_timer_R(), and wtp_initiator_init().

enum { ... } initiator_run_status
List* queue = NULL
static

Definition at line 89 of file wtp_init.c.

int tidnew = 1
static

Definition at line 84 of file wtp_init.c.

Referenced by init_machine_create(), and init_machine_find_or_create().

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.