229     debug(
"wap.push.ota", 0, 
"OTA: event arrived");
   232     case Pom_SessionRequest_Req:
   240     case Po_ConfirmedPush_Req:
   244     case Po_Unit_Push_Req:
   248     case Po_PushAbort_Req:
   253         debug(
"wap.push.ota", 0, 
"OTA: unhandled event");
   264     List *appid_headers, *push_headers;
   267     push_headers = e->
u.Pom_SessionRequest_Req.push_headers;
   272     wsp_event->
u.S_Unit_Push_Req.address_type =
   273         e->
u.Pom_SessionRequest_Req.address_type;
   274     if (e->
u.Pom_SessionRequest_Req.smsc_id != NULL)
   275         wsp_event->
u.S_Unit_Push_Req.smsc_id =
   278         wsp_event->
u.S_Unit_Push_Req.smsc_id = NULL;
   279     if (e->
u.Pom_SessionRequest_Req.dlr_url != NULL)
   280         wsp_event->
u.S_Unit_Push_Req.dlr_url =
   283         wsp_event->
u.S_Unit_Push_Req.dlr_url = NULL;
   284     wsp_event->
u.S_Unit_Push_Req.dlr_mask = e->
u.Pom_SessionRequest_Req.dlr_mask;
   285     if (e->
u.Pom_SessionRequest_Req.smsbox_id != NULL)
   286         wsp_event->
u.S_Unit_Push_Req.smsbox_id =
   289         wsp_event->
u.S_Unit_Push_Req.smsbox_id = NULL;    
   290     wsp_event->
u.S_Unit_Push_Req.service_name = 
   293     wsp_event->
u.S_Unit_Push_Req.push_id = 
   294         e->
u.Pom_SessionRequest_Req.push_id;
   295     wsp_event->
u.S_Unit_Push_Req.addr_tuple = 
   297     wsp_event->
u.S_Unit_Push_Req.push_headers = 
   301     wsp_event->
u.S_Unit_Push_Req.push_body = 
pack_sia(appid_headers);
   303     debug(
"wap.push.ota", 0, 
"OTA: making a connectionless session request for"   304           " creating a session");
   318     wsp_event->
u.S_Push_Req.push_headers = push_headers;
   319     if (e->
u.Po_Push_Req.push_body != NULL)
   320         wsp_event->
u.S_Push_Req.push_body = 
   323         wsp_event->
u.S_Push_Req.push_body = NULL;
   324     wsp_event->
u.S_Push_Req.session_id = e->
u.Po_Push_Req.session_handle;
   338     wsp_event->
u.S_ConfirmedPush_Req.server_push_id = 
   339         e->
u.Po_ConfirmedPush_Req.server_push_id;
   340     wsp_event->
u.S_ConfirmedPush_Req.push_headers = push_headers;
   342     if (e->
u.Po_ConfirmedPush_Req.push_body != NULL)
   343         wsp_event->
u.S_ConfirmedPush_Req.push_body =
   346         wsp_event->
u.S_ConfirmedPush_Req.push_body = NULL;
   348     wsp_event->
u.S_ConfirmedPush_Req.session_id = 
   349         e->
u.Po_ConfirmedPush_Req.session_handle;
   350     debug(
"wap.push.ota", 0, 
"OTA: making confirmed push request to wsp");
   367     gw_assert(e->
u.Po_Unit_Push_Req.service_name);
   377     wsp_event->
u.S_Unit_Push_Req.addr_tuple = 
   379     wsp_event->
u.S_Unit_Push_Req.push_id = e->
u.Po_Unit_Push_Req.push_id;
   380     wsp_event->
u.S_Unit_Push_Req.push_headers = push_headers;
   382     wsp_event->
u.S_Unit_Push_Req.address_type = 
   383         e->
u.Po_Unit_Push_Req.address_type;
   385         wsp_event->
u.S_Unit_Push_Req.smsc_id = 
smsc_id;
   387         wsp_event->
u.S_Unit_Push_Req.smsc_id = NULL;  
   389         wsp_event->
u.S_Unit_Push_Req.dlr_url = 
dlr_url;        
   391         wsp_event->
u.S_Unit_Push_Req.dlr_url = NULL;      
   392     wsp_event->
u.S_Unit_Push_Req.dlr_mask = e->
u.Po_Unit_Push_Req.dlr_mask;            
   394         wsp_event->
u.S_Unit_Push_Req.smsbox_id = 
smsbox_id;
   396         wsp_event->
u.S_Unit_Push_Req.smsbox_id = NULL;
   398     if (push_body != NULL)
   399         wsp_event->
u.S_Unit_Push_Req.push_body = push_body;
   401         wsp_event->
u.S_Unit_Push_Req.push_body = NULL;
   404     debug(
"wap.push.ota", 0, 
"OTA: made connectionless session service"   413     reason = e->
u.Po_PushAbort_Req.reason;
   418     wsp_event->
u.S_PushAbort_Req.push_id = e->
u.Po_PushAbort_Req.push_id;
   419     wsp_event->
u.S_PushAbort_Req.reason = reason;
   420     wsp_event->
u.S_PushAbort_Req.session_handle = 
   421         e->
u.Po_PushAbort_Req.session_id;
   442     if (e->
type == Po_Unit_Push_Req) {
   443         trusted = e->
u.Po_Unit_Push_Req.trusted << 1;
   444         authenticated = e->
u.Po_Unit_Push_Req.authenticated;
   445         last = e->
u.Po_Unit_Push_Req.last << 2;
   449     } 
else if (e->
type == Po_Push_Req) {
   450         trusted = e->
u.Po_Push_Req.trusted << 1;
   451         authenticated = e->
u.Po_Push_Req.authenticated;
   452         last = e->
u.Po_Push_Req.last << 2;
   456     } 
else if (e->
type == Po_ConfirmedPush_Req) {
   457         trusted = e->
u.Po_ConfirmedPush_Req.trusted << 1;
   458         authenticated = e->
u.Po_ConfirmedPush_Req.authenticated;
   459         last = e->
u.Po_ConfirmedPush_Req.last << 2;
   462             e->
u.Po_ConfirmedPush_Req.push_headers);
   465         debug(
"wap.ota", 0, 
"OTA: no push flag when the event is: \n");
   471     push_flag = push_flag | authenticated | trusted | last;
   484     if (e->
type == Po_Unit_Push_Req) {
   485         gw_assert(e->
u.Po_Unit_Push_Req.trusted == 0 || 
   486             e->
u.Po_Unit_Push_Req.trusted == 1);
   487         gw_assert(e->
u.Po_Unit_Push_Req.authenticated == 0 || 
   488             e->
u.Po_Unit_Push_Req.authenticated == 1);
   490             e->
u.Po_Unit_Push_Req.last == 1);
   492     } 
else if (e->
type == Po_Push_Req) {
   494             e->
u.Po_Push_Req.trusted == 1);
   495         gw_assert(e->
u.Po_Push_Req.authenticated == 0 || 
   496             e->
u.Po_Push_Req.authenticated == 1);
   498             e->
u.Po_Push_Req.last == 1);
   500     } 
else if (e->
type == Po_ConfirmedPush_Req) {
   501         gw_assert(e->
u.Po_ConfirmedPush_Req.trusted == 0 || 
   502             e->
u.Po_ConfirmedPush_Req.trusted == 1);
   503         gw_assert(e->
u.Po_ConfirmedPush_Req.authenticated == 0 || 
   504             e->
u.Po_ConfirmedPush_Req.authenticated == 1);
   505         gw_assert(e->
u.Po_ConfirmedPush_Req.last == 0 || 
   506             e->
u.Po_ConfirmedPush_Req.last == 1);
   598     unsigned char address_len;
 
static Octstr * pack_appid_list(List *headers)
 
static Octstr * service_name
 
static void make_push_request(WAPEvent *e)
 
List * http_header_find_all(List *headers, char *name)
 
void http_header_get(List *headers, long i, Octstr **name, Octstr **value)
 
void wap_push_ota_dispatch_event(WAPEvent *e)
 
static void abort_push(WAPEvent *e)
 
void http_header_add(List *headers, char *name, char *contents)
 
static wap_dispatch_func_t * dispatch_to_wsp_unit
 
gw_assert(wtls_machine->packet_to_send !=NULL)
 
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
 
void gwlist_produce(List *list, void *item)
 
static wap_dispatch_func_t * dispatch_to_wsp
 
long gwlist_len(List *list)
 
void octstr_set_bits(Octstr *ostr, long bitpos, int numbits, unsigned long value)
 
static enum @32 run_status
 
void octstr_append_char(Octstr *ostr, int ch)
 
static List * add_push_flag(WAPEvent *e)
 
static void make_unit_push_request(WAPEvent *e)
 
Octstr * wsp_pdu_pack(WSP_PDU *pdu)
 
static void make_session_request(WAPEvent *e)
 
static void check_session_request_headers(List *headers)
 
static void handle_ota_event(WAPEvent *e)
 
#define octstr_get_cstr(ostr)
 
void wap_event_dump(WAPEvent *event)
 
void gwthread_join_every(gwthread_func_t *func)
 
static Octstr * smsbox_id
 
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
 
void http_destroy_headers(List *headers)
 
WSP_PDU * wsp_pdu_create(int type)
 
static Octstr * pack_server_address(void)
 
Octstr * octstr_imm(const char *cstr)
 
void wap_push_ota_init(wap_dispatch_func_t *wsp_dispatch, wap_dispatch_func_t *wsp_unit_dispatch)
 
void gwlist_remove_producer(List *list)
 
void wap_event_destroy_item(void *event)
 
#define octstr_duplicate(ostr)
 
static void flags_assert(WAPEvent *e)
 
#define wap_event_create(type)
 
static BearerboxAddress * bearerbox_address_create(void)
 
Octstr * octstr_format(const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
static void bearerbox_address_destroy(BearerboxAddress *ba)
 
#define gwthread_create(func, arg)
 
#define octstr_create(cstr)
 
void mutex_destroy(Mutex *mutex)
 
void wsp_pdu_destroy(WSP_PDU *pdu)
 
static void reason_assert(long reason)
 
static Octstr * name(Octstr *os)
 
long octstr_len(const Octstr *ostr)
 
static BearerboxAddress * bearerbox
 
void octstr_append_decimal(Octstr *ostr, long value)
 
Octstr * get_official_ip(void)
 
void * gwlist_consume(List *list)
 
void debug(const char *place, int err, const char *fmt,...)
 
void octstr_format_append(Octstr *os, const char *fmt,...)
 
List * http_header_duplicate(List *headers)
 
void wap_push_ota_shutdown(void)
 
static void make_confirmed_push_request(WAPEvent *e)
 
int http_type_accepted(List *headers, char *type)
 
static void main_thread(void *arg)
 
void gwlist_add_producer(List *list)
 
void wap_push_ota_bb_address_set(Octstr *in)
 
static Octstr * pack_sia(List *headers)
 
void wap_event_destroy(WAPEvent *event)
 
void wap_dispatch_func_t(WAPEvent *event)
 
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
 
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)