Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wap_push_pap_mime.h File Reference
#include "gwlib/gwlib.h"

Go to the source code of this file.

Functions

int mime_parse (Octstr *boundary, Octstr *mime_content, Octstr **pap_content, Octstr **push_data, List **content_headers, Octstr **rdf_content)
 

Function Documentation

int mime_parse ( Octstr boundary,
Octstr mime_content,
Octstr **  pap_content,
Octstr **  push_data,
List **  content_headers,
Octstr **  rdf_content 
)

Definition at line 131 of file wap_push_pap_mime.c.

References check_control_headers(), gw_assert(), octstr_len(), parse_body_part(), parse_encapsulation(), parse_epilogue(), parse_preamble(), and warning().

Referenced by main(), and pap_request_thread().

134 {
135  int ret;
136 
137  *pap_content = NULL;
138  *push_data = NULL;
139  *content_headers = NULL;
140  *rdf_content = NULL;
141 
142  if (parse_preamble(&mime_content, boundary) < 0) {
143  warning(0, "erroneous preamble");
144  return 0;
145  }
146  if (parse_body_part(&mime_content, boundary, pap_content) <= 0) {
147  warning(0, "erroneous control entity");
148  return 0;
149  }
150  if (check_control_headers(pap_content) == 0) {
151  warning(0, "erroneous control headers");
152  return 0;
153  }
154 
155  ret = -1;
156  if ((ret = parse_encapsulation(&mime_content, boundary, push_data,
157  content_headers, rdf_content)) < 0) {
158  warning(0, "erroneous content entity (push message)");
159  return 0;
160  } else if (ret == 0) {
161  gw_assert(*rdf_content == NULL);
162  if (octstr_len(mime_content) != 0)
163  parse_epilogue(&mime_content);
164  return 1;
165  }
166 
167  if (check_control_headers(rdf_content) == 0) {
168  warning(0, "erroneous capacity (rdf) headers");
169  return 0;
170  }
171 
172  if (octstr_len(mime_content) != 0)
173  parse_epilogue(&mime_content);
174  gw_assert(octstr_len(mime_content) == 0);
175 
176  return 1;
177 }
static int parse_epilogue(Octstr **mime_content)
static int check_control_headers(Octstr **body_part)
static int parse_body_part(Octstr **multipart, Octstr *boundary, Octstr **body_part)
void warning(int err, const char *fmt,...)
Definition: log.c:624
gw_assert(wtls_machine->packet_to_send!=NULL)
long octstr_len(const Octstr *ostr)
Definition: octstr.c:340
static int parse_preamble(Octstr **mime_content, Octstr *boundary)
static int parse_encapsulation(Octstr **mime_content, Octstr *boundary, Octstr **push_data, List **content_headers, Octstr **rdf_content)
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.