159 static unsigned short rcv_tid(
unsigned short tid);
   195     debug(
"wap.wtp", 0, 
"wtp_initiator_shutdown: %ld init_machines left",
   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   248      init_machine->tid = 
tid;
   249      init_machine->tidnew = 
tidnew;
   251      debug(
"wap.wtp", 0, 
"WTP: Created WTPInitMachine %p (%ld)", 
   252        (
void *) init_machine, init_machine->
mid);
   266      debug(
"wap.wtp", 0, 
"WTP: Destroying WTPInitMachine %p (%ld)", 
   267         (
void *) init_machine, init_machine->
mid);
   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   278      gw_free(init_machine);
   287        #define INIT_STATE_NAME(state) case state: return (unsigned char *) #state;   288        #define ROW(state, event, condition, action, new_state)   291            return (
unsigned char *)
"unknown state";
   305      debug(
"wap.wtp", 0, 
"WTP_INIT: initiator machine %ld, state %s,"   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 && \   317          init_machine->state = next_state; \   318          debug("wap.wtp", 0, "WTP_INIT %ld: New state %s", \   319                    init_machine->mid, #next_state); \   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:");
   335       if (init_machine->state == INITIATOR_NULL_STATE)
   353     return m->tid == pat->
tid && 
   392     static long tid = -1; 
   398     switch (event->
type) {
   400         tid = 
event->u.RcvAck.tid;
   401         tuple = 
event->u.RcvAck.addr_tuple;
   405         tid = 
event->u.RcvAbort.tid;
   406         tuple = 
event->u.RcvAbort.addr_tuple;
   410         mid = 
event->u.RcvErrorPDU.tid;
   411         tid = 
event->u.RcvErrorPDU.tid;
   412         tuple = 
event->u.RcvErrorPDU.addr_tuple;
   427         tuple = 
event->u.TR_Invoke_Req.addr_tuple;
   428         mid = 
event->u.TR_Invoke_Req.handle;
   432         tid = 
event->u.TR_Abort_Req.handle;
   436         mid = 
event->u.TimerTO_R.handle;
   440     error(0, 
"WTP_INIT: machine_find_or_create: unhandled event");
   448     if (machine == NULL){
   450     switch (event->
type){
   464                  info(0, 
"WTP_INIT: machine_find_or_create: ack "   465                      "received, yet having no machine");
   470             info(0, 
"WTP_INIT: machine_find_or_create: abort "   471                  "received, yet having no machine");
   476             machine->
mid = 
event->u.TR_Invoke_Req.handle;
   480             error(0, 
"WTP_INIT: machine_find_or_create: WSP "   481                   "primitive to a wrong WTP machine");
   485         error(0, 
"WTP_INIT: machine_find_or_create: timer "   486                        "event without a corresponding machine");
   490             error(0, 
"WTP_INIT: machine_find_or_create: unhandled"   509     event->u.TR_Invoke_Cnf.handle = init_machine->
mid;
   510     event->u.TR_Invoke_Cnf.addr_tuple = 
   526     event->u.TR_Abort_Ind.abort_code = abort_reason;
   527     event->u.TR_Abort_Ind.addr_tuple = 
   529     event->u.TR_Abort_Ind.handle = sm->
mid;
   538     return tid > (1 << 15);
   556     timer_event->
u.TimerTO_R.handle = machine->
mid;
   566     debug(
"wap.wtp_init", 0, 
"stopping timer");
   583     e = 
wtp_pack_ack(ack_type, rid_flag, machine->tid, machine->addr_tuple);
 static int is_wanted_init_machine(void *a, void *b)
 
void error(int err, const char *fmt,...)
 
void info(int err, const char *fmt,...)
 
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
 
static void stop_initiator_timer(Timer *timer)
 
static void send_abort(WTPInitMachine *machine, long type, long reason)
 
gw_assert(wtls_machine->packet_to_send !=NULL)
 
void counter_destroy(Counter *counter)
 
void gwlist_append(List *list, void *item)
 
static unsigned short rcv_tid(unsigned short tid)
 
void gwlist_produce(List *list, void *item)
 
long gwlist_len(List *list)
 
static void handle_init_event(WTPInitMachine *machine, WAPEvent *event)
 
static void start_initiator_timer_R(WTPInitMachine *machine)
 
static List * init_machines
 
static int tid_wrapped(unsigned short tid)
 
void gwtimer_stop(Timer *timer)
 
static WAPEvent * create_tr_abort_ind(WTPInitMachine *sm, long abort_reason)
 
void wap_event_dump(WAPEvent *event)
 
void gwthread_join_every(gwthread_func_t *func)
 
unsigned long counter_increase(Counter *counter)
 
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
 
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
 
void wtp_initiator_dispatch_event(WAPEvent *event)
 
static wap_dispatch_func_t * dispatch_to_wsp
 
Counter * counter_create(void)
 
static unsigned char * name_init_state(int s)
 
static enum @104 initiator_run_status
 
static void init_machine_destroy(void *sm)
 
void gwtimer_start(Timer *timer, int interval, WAPEvent *event)
 
void gwlist_remove_producer(List *list)
 
void wtp_initiator_init(wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *session_dispatch, long timer_freq)
 
static WTPInitMachine * init_machine_find(WAPAddrTuple *tuple, long tid, long mid)
 
void wap_event_destroy_item(void *event)
 
static WAPEvent * create_tr_invoke_cnf(WTPInitMachine *machine)
 
static void main_thread(void *arg)
 
const char * wap_event_name(WAPEventName type)
 
long gwlist_delete_equal(List *list, void *item)
 
#define wap_event_create(type)
 
void timers_shutdown(void)
 
static Counter * init_machine_id_counter
 
#define gwthread_create(func, arg)
 
WAPEvent * wtp_pack_ack(long ack_type, int rid_flag, long tid, WAPAddrTuple *address)
 
static WTPInitMachine * init_machine_find_or_create(WAPEvent *event)
 
int wap_addr_tuple_same(WAPAddrTuple *a, WAPAddrTuple *b)
 
static WTPInitMachine * init_machine_create(WAPAddrTuple *tuple, unsigned short tid, int tidnew)
 
void * gwlist_consume(List *list)
 
void debug(const char *place, int err, const char *fmt,...)
 
WAPEvent * wtp_pack_abort(long abort_type, long abort_reason, long tid, WAPAddrTuple *address)
 
void wtp_initiator_shutdown(void)
 
static wap_dispatch_func_t * dispatch_to_wdp
 
static long init_timer_freq
 
void gwlist_add_producer(List *list)
 
static void send_ack(WTPInitMachine *machine, long ack_type, int rid_flag)
 
void wap_event_destroy(WAPEvent *event)
 
void wap_dispatch_func_t(WAPEvent *event)
 
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)