169 debug(
"wap.wsp", 0,
"wsp_push_client_shutdown: %ld push client machines" 209 #define PUSH_CLIENT_STATE_NAME(state) case state : return (unsigned char *)#state; 210 #define ROW(state, event, condition, action, new_state) 213 return (
unsigned char *)
"unknown state";
230 if (e->
type == TR_Invoke_Ind) {
238 if (pdu == NULL || pdu->
type != ConfirmedPush) {
246 debug(
"wap.wsp", 0,
"WSP_PUSH: WSPPushClientMachine %ld, state %s," 251 #define PUSH_CLIENT_STATE_NAME(state) 252 #define ROW(push_state, event_type, condition, action, next_state) \ 253 if (cpm->state == push_state && \ 254 e->type == event_type && \ 257 cpm->state = next_state; \ 258 debug("wap.wsp", 0, "WSP_PUSH %ld: new state %s", \ 259 cpm->client_push_id, #next_state); \ 263 error(0,
"WSP_PUSH: handle_event: unhandled event!");
264 debug(
"wap.wsp", 0,
"Unhandled event was:");
273 if (cpm->state == PUSH_CLIENT_NULL_STATE)
283 transid = *(
long *)b;
284 return m->transaction_id == transid;
315 transid = e->
u.TR_Invoke_Ind.handle;
318 case S_ConfirmedPush_Res:
319 transid = e->
u.S_ConfirmedPush_Res.client_push_id;
322 case S_PushAbort_Req:
323 transid = e->
u.S_PushAbort_Req.push_id;
330 transid = e->
u.TR_Abort_Ind.handle;
334 debug(
"wap.wsp", 0,
"WSP PUSH: push_client_find_or_create: unhandled" 351 case S_ConfirmedPush_Res:
352 case S_PushAbort_Req:
353 error(0,
"WSP_PUSH_CLIENT: POT primitive to a nonexisting" 354 " push client machine");
358 error(0,
"WSP_PUSH_CLIENT: internal abort to a nonexisting" 359 " push client machine");
363 error(0,
"WSP_PUSH_CLIENT: WTP abort to a nonexisting push client" 368 error(0,
"WSP_PUSH_CLIENT: Cannot handle event type %s",
382 debug(
"wap.wsp", 0,
"WSP_PUSH_CLIENT: Created WSPPushClientMachine %p",
385 #define INTEGER(name) m->name = 0; 386 #define HTTPHEADERS(name) m->name = NULL; 387 #define MACHINE(fields) fields 390 m->state = PUSH_CLIENT_NULL_STATE;
391 m->transaction_id = transid;
404 debug(
"wap.wsp", 0,
"Destroying WSPPushClientMachine %p", (
void *) m);
407 #define INTEGER(name) m->name = 0; 408 #define HTTPHEADERS(name) http_destroy_headers(m->name); 409 #define MACHINE(fields) fields; 422 e->
u.S_ConfirmedPush_Ind.client_push_id = cpm->client_push_id;
423 e->
u.S_ConfirmedPush_Ind.push_headers =
436 e->
u.S_PushAbort_Ind.push_id = cpm->client_push_id;
437 e->
u.S_PushAbort_Ind.reason = abort_reason;
451 e->
u.S_ConfirmedPush_Res.client_push_id = cpm->client_push_id;
462 e->
u.TR_Abort_Req.abort_type =
USER;
463 e->
u.TR_Abort_Req.abort_reason = reason;
464 e->
u.TR_Abort_Req.handle = cpm->client_push_id;
475 e->
u.TR_Invoke_Res.handle = cpm->transaction_id;
void error(int err, const char *fmt,...)
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
void wsp_push_client_shutdown(void)
static int push_client_machine_has_transid(void *a, void *b)
static WAPEvent * indicate_confirmedpush(WSPPushClientMachine *cpm, Octstr *push_body)
gw_assert(wtls_machine->packet_to_send !=NULL)
void counter_destroy(Counter *counter)
void gwlist_append(List *list, void *item)
void gwlist_produce(List *list, void *item)
long gwlist_len(List *list)
static void push_client_machine_destroy(void *a)
static Counter * push_client_machine_id_counter
static WAPEvent * response_responder_invoke(WSPPushClientMachine *cpm)
static WSPPushClientMachine * push_client_machine_create(long cpid)
void wap_event_dump(WAPEvent *event)
void gwthread_join_every(gwthread_func_t *func)
static unsigned char * name_push_client_state(int name)
unsigned long counter_increase(Counter *counter)
void wsp_push_client_dispatch_event(WAPEvent *e)
static WAPEvent * send_abort_to_responder(WSPPushClientMachine *cpm, long reason)
Counter * counter_create(void)
void wap_event_assert(WAPEvent *event)
void gwlist_remove_producer(List *list)
void wap_event_destroy_item(void *event)
static WAPEvent * indicate_pushabort(WSPPushClientMachine *cpm, long abort_reason)
#define octstr_duplicate(ostr)
const char * wap_event_name(WAPEventName type)
long gwlist_delete_equal(List *list, void *item)
static WSPPushClientMachine * push_client_machine_find_using_transid(long transid)
#define wap_event_create(type)
#define gwthread_create(func, arg)
static List * push_client_machines
void wsp_pdu_destroy(WSP_PDU *pdu)
static void main_thread(void *)
static List * push_client_queue
void wtp_resp_dispatch_event(WAPEvent *event)
void * gwlist_consume(List *list)
wap_dispatch_func_t * dispatch_to_self
void debug(const char *place, int err, const char *fmt,...)
static void push_client_event_handle(WSPPushClientMachine *cpm, WAPEvent *e)
List * http_header_duplicate(List *headers)
static WSPPushClientMachine * push_client_machine_find_or_create(WAPEvent *e)
wap_dispatch_func_t * dispatch_to_wtp_resp
static WAPEvent * response_confirmedpush(WSPPushClientMachine *cpm)
void gwlist_add_producer(List *list)
static enum @90 push_client_run_status
WSP_PDU * wsp_pdu_unpack(Octstr *data)
void wap_event_destroy(WAPEvent *event)
void wap_dispatch_func_t(WAPEvent *event)
void wsp_push_client_init(wap_dispatch_func_t *dispatch_self, wap_dispatch_func_t *dispatch_wtp_resp)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)