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

wap_push_pap_compiler.h File Reference

#include "wap/wap_events.h"
#include "gwlib/gwlib.h"

Include dependency graph for wap_push_pap_compiler.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.

Enumerations

enum  {
  ADDR_IPV4 = 0, ADDR_PLMN = 1, ADDR_USER = 2, ADDR_IPV6 = 3,
  ADDR_WINA = 4
}

Functions

int pap_compile (Octstr *pap_content, WAPEvent **e)
int parse_address (Octstr **attr_value, long *type_of_address)


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
ADDR_IPV4 
ADDR_PLMN 
ADDR_USER 
ADDR_IPV6 
ADDR_WINA 

Definition at line 72 of file wap_push_pap_compiler.h.

00072      {
00073     ADDR_IPV4 = 0,
00074     ADDR_PLMN = 1,
00075     ADDR_USER = 2,
00076     ADDR_IPV6 = 3,
00077     ADDR_WINA = 4
00078 };


Function Documentation

int pap_compile Octstr pap_content,
WAPEvent **  e
 

Definition at line 349 of file wap_push_pap_compiler.c.

References error(), octstr_get_cstr, octstr_len(), octstr_search_char(), octstr_strip_blanks(), parse_document(), wap_event_destroy(), and warning().

Referenced by main(), pap_request_thread(), and receive_push_reply().

00350 {
00351     xmlDocPtr doc_p;
00352     size_t oslen;
00353     int ret;
00354 
00355     if (octstr_search_char(pap_content, '\0', 0) != -1) {
00356         warning(0, "PAP COMPILER: pap_compile: pap source contained a \\0"
00357                    " character");
00358         return -2;
00359     }
00360 
00361     octstr_strip_blanks(pap_content);
00362     oslen = octstr_len(pap_content);
00363     doc_p = xmlParseMemory(octstr_get_cstr(pap_content), oslen);
00364     if (doc_p == NULL) {
00365         goto error;
00366     }
00367 
00368     if ((ret = parse_document(doc_p, e)) < 0) { 
00369         goto parserror;
00370     }
00371 
00372     xmlFreeDoc(doc_p);
00373     return 0;
00374 
00375 parserror:
00376     xmlFreeDoc(doc_p);
00377     wap_event_destroy(*e);
00378     *e = NULL;
00379     return ret;
00380 
00381 error:
00382     warning(0, "PAP COMPILER: pap_compile: parse error in pap source");
00383     xmlFreeDoc(doc_p);
00384     wap_event_destroy(*e);
00385     *e = NULL;
00386     return -2;
00387 }

Here is the call graph for this function:

int parse_address Octstr **  attr_value,
long *  type_of_address
 

Definition at line 1491 of file wap_push_pap_compiler.c.

References info(), octstr_delete(), octstr_destroy(), octstr_duplicate, octstr_get_char(), octstr_get_cstr, octstr_len(), octstr_search_char(), parse_ppg_specifier(), parse_wappush_client_address(), and warning().

Referenced by parse_address_value().

01492 {
01493     long pos;
01494     Octstr *copy;
01495 
01496     pos = octstr_len(*address) - 1;
01497 /*
01498  * Delete first separator, if there is one. This will help our parsing later.
01499  */
01500     if (octstr_get_char(*address, 0) == '/')
01501         octstr_delete(*address, 0, 1);
01502 
01503 /*
01504  * WAP-209, chapter 8 states that addresses with telephone numbers
01505  * should not have a ppg specifier. WAP-151 grammar, however, makes it
01506  * mandatory. Best way to solve this contradiction seems to be regarding
01507  * ppg specifier optional - MMSC is very important type of pi.
01508  */
01509     if (octstr_search_char(*address, '@', 0) >= 0) {
01510         if ((pos = parse_ppg_specifier(address, pos)) < 0)
01511         return -2;
01512     }
01513 
01514     if ((pos = parse_wappush_client_address(address, pos, 
01515             type_of_address)) == -2) {
01516         warning(0, "illegal client address");
01517         return -2;
01518     } else if (pos == -1) {
01519         warning(0, "unimplemented feature");
01520         return -1;
01521     }
01522 
01523     info(0, "client address was <%s>, accepted", 
01524          octstr_get_cstr(copy = octstr_duplicate(*address)));    
01525     octstr_destroy(copy);
01526 
01527     return pos;
01528 }

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.