parse_sst.c File Reference

SST parser. More...

#include "parse_sst.h"
#include "../error.h"
#include "../dprint.h"
#include "../mem/mem.h"

Include dependency graph for parse_sst.c:

Go to the source code of this file.

Defines

#define MAKE_3BYTES(a, b, c)   ( ((a)&0xFF) | (((b)&0xFF)<<8) | (((c)&0xFF)<<16) )
#define MAKE_4BYTES(a, b, c, d)   ( ((a)&0xFF) | (((b)&0xFF)<<8) | (((c)&0xFF)<<16) | (((d)&0xFF)<<24) )

Functions

void free_session_expires (struct session_expires *se)
int is_num (char c)
int is_space (char c)
unsigned lower_3bytes (unsigned d)
unsigned lower_4bytes (unsigned d)
unsigned lower_byte (char b)
struct session_expiresmalloc_session_expires (void)
enum parse_sst_result parse_min_se (struct sip_msg *msg, unsigned int *min_se)
enum parse_sst_result parse_min_se_body (struct hdr_field *hf)
enum parse_sst_result parse_session_expires (struct sip_msg *msg, struct session_expires *se)
 Parses the (should be only one instance) single instance of the "Session-Expires" or "x" header in the msg.
enum parse_sst_result parse_session_expires_body (struct hdr_field *hf)
unsigned read_3bytes (char *val)
unsigned read_4bytes (char *val)


Detailed Description

SST parser.

Definition in file parse_sst.c.


Define Documentation

#define MAKE_3BYTES ( a,
b,
 )     ( ((a)&0xFF) | (((b)&0xFF)<<8) | (((c)&0xFF)<<16) )

Definition at line 57 of file parse_sst.c.

Referenced by parse_session_expires_body().

#define MAKE_4BYTES ( a,
b,
c,
 )     ( ((a)&0xFF) | (((b)&0xFF)<<8) | (((c)&0xFF)<<16) | (((d)&0xFF)<<24) )

Definition at line 55 of file parse_sst.c.

Referenced by parse_session_expires_body().


Function Documentation

void free_session_expires ( struct session_expires  ) 

Deallocates memory previously allocated via malloc_session_expires().

Definition at line 73 of file parse_sst.c.

References pkg_free.

Referenced by clean_hdr_field().

int is_num ( char  c  )  [inline]

Definition at line 41 of file parse_sst.c.

Referenced by parse_min_se_body(), and parse_session_expires_body().

int is_space ( char  c  )  [inline]

Definition at line 40 of file parse_sst.c.

Referenced by parse_min_se_body(), and parse_session_expires_body().

unsigned lower_3bytes ( unsigned  d  )  [inline]

Definition at line 45 of file parse_sst.c.

Referenced by parse_session_expires_body().

unsigned lower_4bytes ( unsigned  d  )  [inline]

Definition at line 44 of file parse_sst.c.

Referenced by parse_session_expires_body().

unsigned lower_byte ( char  b  )  [inline]

Definition at line 43 of file parse_sst.c.

Referenced by parse_session_expires_body().

struct session_expires* malloc_session_expires ( void   )  [read]

Allocate a zeroed-out struct session_expires.

Definition at line 62 of file parse_sst.c.

References pkg_malloc.

Referenced by parse_session_expires_body().

enum parse_sst_result parse_min_se ( struct sip_msg msg,
unsigned int *  min_se 
)

enum parse_sst_result parse_min_se_body ( struct hdr_field hf  ) 

enum parse_sst_result parse_session_expires ( struct sip_msg msg,
struct session_expires se 
)

Parses the (should be only one instance) single instance of the "Session-Expires" or "x" header in the msg.

Note:
The header is not automatically parsed in parse_headers()[1] so you'll have to call this function to get the information.
Because of time constraints, this function is coded assuming there is NO WHITESPACE in any of the body -- note that the augBNF for the Session-Expires body allows sep whitespace between tokens: delta-seconds SWS ";" SWS "refresher" SWS "=" SWS ( "uac" / "uas" )

Note[1]: it looks like only the frequently-used headers are automatically parsed in parse_headers() (indicated by a parse_<name> function of the form "char* parse_<name>(char *buf, char *end, foo*) and a struct foo with a member called "error").

Parameters:
msg the sip message to examine
se the place to store session-expires information into, if provided; note that result is also available in *((struct session_expires *)msg->session_expires->parsed)
Returns:
parse_sst_result

Definition at line 175 of file parse_sst.c.

References parse_session_expires_body(), parse_sst_header_not_found, parse_sst_success, hdr_field::parsed, and sip_msg::session_expires.

Referenced by parse_msg_for_sst_info(), and sst_check_min().

enum parse_sst_result parse_session_expires_body ( struct hdr_field hf  ) 

unsigned read_3bytes ( char *  val  )  [inline]

Definition at line 50 of file parse_sst.c.

Referenced by parse_session_expires_body().

unsigned read_4bytes ( char *  val  )  [inline]

Definition at line 46 of file parse_sst.c.

Referenced by parse_session_expires_body().


Generated on Thu May 24 00:00:40 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6