Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wap.h File Reference

#include "wap_events.h"
#include "wap_addr.h"

Include dependency graph for wap.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef void wap_dispatch_func_t (WAPEvent *event)

Functions

void wap_dispatch_datagram (WAPEvent *event)
void wap_init (wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *application_dispatch)
void wap_shutdown (void)
void wtp_resp_init (wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *session_dispatch, wap_dispatch_func_t *push_dispatch, long timer_freq)
void wtp_resp_dispatch_event (WAPEvent *event)
void wtp_resp_shutdown (void)
void wtp_initiator_init (wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *session_dispatch, long timer_freq)
void wtp_initiator_dispatch_event (WAPEvent *event)
void wtp_initiator_shutdown (void)
void wsp_unit_init (wap_dispatch_func_t *datagram_dispatch, wap_dispatch_func_t *application_dispatch)
void wsp_unit_dispatch_event (WAPEvent *event)
void wsp_unit_shutdown (void)
void wsp_session_init (wap_dispatch_func_t *responder_dispatch, wap_dispatch_func_t *initiator_dispatch, wap_dispatch_func_t *application_dispatch, wap_dispatch_func_t *ota_dispatch)
void wsp_session_dispatch_event (WAPEvent *event)
void wsp_session_shutdown (void)
void wsp_push_client_init (wap_dispatch_func_t *dispatch_self, wap_dispatch_func_t *dispatch_wtp_resp)
void wsp_push_client_shutdown (void)
void wsp_push_client_dispatch_event (WAPEvent *e)


Typedef Documentation

typedef void wap_dispatch_func_t(WAPEvent *event)
 

Definition at line 85 of file wap.h.


Function Documentation

void wap_dispatch_datagram WAPEvent event  ) 
 

Definition at line 67 of file wap.c.

References debug(), event, gw_assert, gwlist_destroy(), gwlist_extract_first(), gwlist_len(), WAPEvent::type, WAPEvent::u, wap_event_destroy(), wap_event_dump(), warning(), wsp_unit_dispatch_event(), wtp_event_is_for_responder(), wtp_initiator_dispatch_event(), wtp_resp_dispatch_event(), and wtp_unpack_wdp_datagram().

Referenced by main().

00068 {
00069     gw_assert(dgram != NULL);
00070 
00071     if (dgram->type != T_DUnitdata_Ind) {
00072     warning(0, "wap_dispatch_datagram got event of unexpected type.");
00073     wap_event_dump(dgram);
00074     wap_event_destroy(dgram);
00075         return;
00076     }
00077 
00078     /* XXX Assumption does not hold for client side */
00079     if (dgram->u.T_DUnitdata_Ind.addr_tuple->local->port == CONNECTIONLESS_PORT) {
00080     wsp_unit_dispatch_event(dgram);
00081     } else {
00082         List *events;
00083 
00084         events = wtp_unpack_wdp_datagram(dgram);
00085 
00086         if (!events) {
00087             debug("wap.wap", 0, "ignoring truncated datagram");
00088             wap_event_dump(dgram);
00089             wap_event_destroy(dgram);
00090             return;
00091         }
00092 
00093         while (gwlist_len(events) > 0) {
00094         WAPEvent *event;
00095 
00096         event = gwlist_extract_first(events);
00097             if (wtp_event_is_for_responder(event))
00098                 wtp_resp_dispatch_event(event);
00099             else
00100                 wtp_initiator_dispatch_event(event);
00101         }
00102 
00103         wap_event_destroy(dgram);
00104         gwlist_destroy(events, NULL);
00105     }
00106 }

Here is the call graph for this function:

void wap_init wap_dispatch_func_t datagram_dispatch,
wap_dispatch_func_t application_dispatch
 

void wap_shutdown void   ) 
 

void wsp_push_client_dispatch_event WAPEvent e  ) 
 

Definition at line 177 of file wsp_push_client.c.

References gwlist_produce(), and push_client_queue.

Referenced by main().

00178 {
00179     gwlist_produce(push_client_queue, e);
00180 }

Here is the call graph for this function:

void wsp_push_client_init wap_dispatch_func_t dispatch_self,
wap_dispatch_func_t dispatch_wtp_resp
 

Definition at line 145 of file wsp_push_client.c.

References counter_create(), dispatch_to_self, dispatch_to_wtp_resp, gw_assert, gwlist_add_producer(), gwlist_create, gwthread_create, limbo, main_thread(), push_client_machine_id_counter, push_client_machines, push_client_queue, and push_client_run_status.

Referenced by main().

00147 {
00148     push_client_machines = gwlist_create();
00149     push_client_machine_id_counter = counter_create();
00150 
00151     push_client_queue = gwlist_create();
00152     gwlist_add_producer(push_client_queue);
00153 
00154     dispatch_to_self = dispatch_self;
00155     dispatch_to_wtp_resp = dispatch_wtp_resp;
00156 
00157     gw_assert(push_client_run_status == limbo);
00158     push_client_run_status = running;
00159     gwthread_create(main_thread, NULL);
00160 }

Here is the call graph for this function:

void wsp_push_client_shutdown void   ) 
 

Definition at line 162 of file wsp_push_client.c.

References counter_destroy(), debug(), gw_assert, gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), main_thread(), push_client_machine_destroy(), push_client_machine_id_counter, push_client_machines, push_client_queue, push_client_run_status, running, and wap_event_destroy_item().

Referenced by main().

00163 {
00164     gw_assert(push_client_run_status == running);
00165     push_client_run_status = terminating;
00166     gwlist_remove_producer(push_client_queue);
00167     gwthread_join_every(main_thread);
00168 
00169     debug("wap.wsp", 0, "wsp_push_client_shutdown: %ld push client machines"
00170           "left", gwlist_len(push_client_machines));
00171     gwlist_destroy(push_client_machines, push_client_machine_destroy);
00172     gwlist_destroy(push_client_queue, wap_event_destroy_item);
00173 
00174     counter_destroy(push_client_machine_id_counter);
00175 }

Here is the call graph for this function:

void wsp_session_dispatch_event WAPEvent event  ) 
 

Definition at line 228 of file wsp_session.c.

References event, gwlist_produce(), queue, and wap_event_assert().

Referenced by main(), main_thread(), response_push_connection(), and return_session_reply().

00228                                                  {
00229     wap_event_assert(event);
00230     gwlist_produce(queue, event);
00231 }

Here is the call graph for this function:

void wsp_session_init wap_dispatch_func_t responder_dispatch,
wap_dispatch_func_t initiator_dispatch,
wap_dispatch_func_t application_dispatch,
wap_dispatch_func_t ota_dispatch
 

Definition at line 193 of file wsp_session.c.

References counter_create(), dispatch_to_appl, dispatch_to_ota, dispatch_to_wtp_init, dispatch_to_wtp_resp, gwlist_add_producer(), gwlist_create, gwthread_create, main_thread(), queue, run_status, session_id_counter, session_machines, and wsp_strings_init().

Referenced by main().

00196                                                               {
00197     queue = gwlist_create();
00198     gwlist_add_producer(queue);
00199     session_machines = gwlist_create();
00200     session_id_counter = counter_create();
00201     dispatch_to_wtp_resp = responder_dispatch;
00202     dispatch_to_wtp_init = initiator_dispatch;
00203     dispatch_to_appl = application_dispatch;
00204         dispatch_to_ota = push_ota_dispatch;
00205         wsp_strings_init();
00206     run_status = running;
00207     gwthread_create(main_thread, NULL);
00208 }

Here is the call graph for this function:

void wsp_session_shutdown void   ) 
 

Definition at line 211 of file wsp_session.c.

References counter_destroy(), debug(), gw_assert, gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), machine_destroy(), main_thread(), queue, run_status, running, session_id_counter, session_machines, wap_event_destroy_item(), and wsp_strings_shutdown().

Referenced by main().

00211                                 {
00212     gw_assert(run_status == running);
00213     run_status = terminating;
00214     gwlist_remove_producer(queue);
00215     gwthread_join_every(main_thread);
00216 
00217     gwlist_destroy(queue, wap_event_destroy_item);
00218 
00219     debug("wap.wsp", 0, "WSP: %ld session machines left.",
00220         gwlist_len(session_machines));
00221     gwlist_destroy(session_machines, machine_destroy);
00222 
00223     counter_destroy(session_id_counter);
00224         wsp_strings_shutdown();
00225 }

Here is the call graph for this function:

void wsp_unit_dispatch_event WAPEvent event  ) 
 

Definition at line 124 of file wsp_unit.c.

References event, gwlist_produce(), queue, and wap_event_assert().

Referenced by main(), return_unit_reply(), and wap_dispatch_datagram().

00124                                               {
00125     wap_event_assert(event);
00126     gwlist_produce(queue, event);
00127 }

Here is the call graph for this function:

void wsp_unit_init wap_dispatch_func_t datagram_dispatch,
wap_dispatch_func_t application_dispatch
 

Definition at line 102 of file wsp_unit.c.

References dispatch_to_appl, dispatch_to_wdp, gwlist_add_producer(), gwlist_create, gwthread_create, main_thread(), queue, run_status, and wsp_strings_init().

Referenced by main().

00103                                                               {
00104     queue = gwlist_create();
00105     gwlist_add_producer(queue);
00106     dispatch_to_wdp = datagram_dispatch;
00107     dispatch_to_appl = application_dispatch;
00108         wsp_strings_init();
00109     run_status = running;
00110     gwthread_create(main_thread, NULL);
00111 }

Here is the call graph for this function:

void wsp_unit_shutdown void   ) 
 

Definition at line 114 of file wsp_unit.c.

References gw_assert, gwlist_destroy(), gwlist_remove_producer(), gwthread_join_every(), main_thread(), queue, run_status, running, wap_event_destroy_item(), and wsp_strings_shutdown().

Referenced by main().

00114                              {
00115     gw_assert(run_status == running);
00116     run_status = terminating;
00117     gwlist_remove_producer(queue);
00118     gwthread_join_every(main_thread);
00119     gwlist_destroy(queue, wap_event_destroy_item);
00120         wsp_strings_shutdown();
00121 }

Here is the call graph for this function:

void wtp_initiator_dispatch_event WAPEvent event  ) 
 

Definition at line 204 of file wtp_init.c.

References event, gwlist_produce(), and queue.

Referenced by main(), and wap_dispatch_datagram().

00205 {
00206     gwlist_produce(queue, event);
00207 }

Here is the call graph for this function:

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, and timers_init().

Referenced by main().

00170 {
00171     init_machines = gwlist_create();
00172     init_machine_id_counter = counter_create();
00173      
00174     queue = gwlist_create();
00175     gwlist_add_producer(queue);
00176 
00177     dispatch_to_wdp = datagram_dispatch;
00178     dispatch_to_wsp = session_dispatch;
00179 
00180     timers_init();
00181     init_timer_freq = timer_freq;
00182 
00183     gw_assert(initiator_run_status == limbo);
00184     initiator_run_status = running;
00185     gwthread_create(main_thread, NULL);
00186 }

Here is the call graph for this function:

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, timers_shutdown(), and wap_event_destroy_item().

Referenced by main().

00189 {
00190     gw_assert(initiator_run_status == running);
00191     initiator_run_status = terminating;
00192     gwlist_remove_producer(queue);
00193     gwthread_join_every(main_thread);
00194 
00195     debug("wap.wtp", 0, "wtp_initiator_shutdown: %ld init_machines left",
00196           gwlist_len(init_machines));
00197     gwlist_destroy(init_machines, init_machine_destroy);
00198     gwlist_destroy(queue, wap_event_destroy_item);
00199 
00200     counter_destroy(init_machine_id_counter);
00201     timers_shutdown();
00202 }

Here is the call graph for this function:

void wtp_resp_dispatch_event WAPEvent event  ) 
 

Definition at line 253 of file wtp_resp.c.

References event, gwlist_produce(), and resp_queue.

Referenced by main(), push_client_event_handle(), and wap_dispatch_datagram().

00254 {
00255     gwlist_produce(resp_queue, event);
00256 }

Here is the call graph for this function:

void wtp_resp_init wap_dispatch_func_t datagram_dispatch,
wap_dispatch_func_t session_dispatch,
wap_dispatch_func_t push_dispatch,
long  timer_freq
 

Definition at line 211 of file wtp_resp.c.

References counter_create(), dispatch_to_push, dispatch_to_wdp, dispatch_to_wsp, gw_assert, gwlist_add_producer(), gwlist_create, gwthread_create, limbo, main_thread(), resp_machine_id_counter, resp_machines, resp_queue, resp_run_status, resp_timer_freq, timers_init(), and wtp_tid_cache_init().

Referenced by main().

00215 {
00216     resp_machines = gwlist_create();
00217     resp_machine_id_counter = counter_create();
00218 
00219     resp_queue = gwlist_create();
00220     gwlist_add_producer(resp_queue);
00221 
00222     dispatch_to_wdp = datagram_dispatch;
00223     dispatch_to_wsp = session_dispatch;
00224     dispatch_to_push = push_dispatch;
00225 
00226     timers_init();
00227     resp_timer_freq = timer_freq;
00228     wtp_tid_cache_init();
00229 
00230     gw_assert(resp_run_status == limbo);
00231     resp_run_status = running;
00232     gwthread_create(main_thread, NULL);
00233 }

Here is the call graph for this function:

void wtp_resp_shutdown void   ) 
 

Definition at line 235 of file wtp_resp.c.

References counter_destroy(), debug(), gw_assert, gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), main_thread(), resp_machine_destroy(), resp_machine_id_counter, resp_machines, resp_queue, resp_run_status, running, timers_shutdown(), wap_event_destroy_item(), and wtp_tid_cache_shutdown().

Referenced by main().

00236 {
00237     gw_assert(resp_run_status == running);
00238     resp_run_status = terminating;
00239     gwlist_remove_producer(resp_queue);
00240     gwthread_join_every(main_thread);
00241 
00242     debug("wap.wtp", 0, "wtp_resp_shutdown: %ld resp_machines left",
00243           gwlist_len(resp_machines));
00244     gwlist_destroy(resp_machines, resp_machine_destroy);
00245     gwlist_destroy(resp_queue, wap_event_destroy_item);
00246 
00247     counter_destroy(resp_machine_id_counter);
00248 
00249     wtp_tid_cache_shutdown();
00250     timers_shutdown();
00251 }

Here is the call graph for this function:

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