msfuncs.c File Reference

#include "msfuncs.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include "../../dprint.h"
#include "../../config.h"
#include "../../ut.h"
#include "../../forward.h"
#include "../../resolve.h"
#include "../../globals.h"
#include "../../udp_server.h"
#include "../../pt.h"

Include dependency graph for msfuncs.c:

Go to the source code of this file.

Defines

#define CONTACT_PREFIX   "Contact: <"
#define CONTACT_PREFIX_LEN   (sizeof(CONTACT_PREFIX)-1)
#define CONTACT_SUFFIX   ">;msilo=yes"CRLF
#define CONTACT_SUFFIX_LEN   (sizeof(CONTACT_SUFFIX)-1)

Functions

int m_apo_escape (char *src, int slen, char *dst, int dlen)
int m_build_body (str *body, time_t date, str msg, time_t sdate)
int m_build_headers (str *buf, str ctype, str contact, time_t date)
int m_extract_content_type (char *src, int len, content_type_t *ctype, int flag)
int ms_extract_time (str *time_str, int *time_val)
int timetToSipDateStr (time_t date, char *buf, int bufLen)

Variables

int ms_add_date


Define Documentation

#define CONTACT_PREFIX   "Contact: <"

Definition at line 39 of file msfuncs.c.

Referenced by m_build_headers().

#define CONTACT_PREFIX_LEN   (sizeof(CONTACT_PREFIX)-1)

Definition at line 41 of file msfuncs.c.

Referenced by m_build_headers().

#define CONTACT_SUFFIX   ">;msilo=yes"CRLF

Definition at line 40 of file msfuncs.c.

Referenced by m_build_headers().

#define CONTACT_SUFFIX_LEN   (sizeof(CONTACT_SUFFIX)-1)

Definition at line 42 of file msfuncs.c.

Referenced by m_build_headers().


Function Documentation

int m_apo_escape ( char *  src,
int  slen,
char *  dst,
int  dlen 
)

apostrophes escaping

  • src: source buffer
  • slen: length of source buffer
  • dst: destination buffer
  • dlen: max length of destination buffer return: destination length => OK; -1 => error

Definition at line 55 of file msfuncs.c.

int m_build_body ( str body,
time_t  date,
str  msg,
time_t  sdate 
)

build MESSAGE body --- add incoming time and 'from'

expects - max buf len of the resulted body in body->len

  • body->s MUST be allocated return: 0 OK ; -1 error

Definition at line 243 of file msfuncs.c.

References _str::len, ms_add_date, and _str::s.

Referenced by m_dump(), and m_send_ontimer().

int m_build_headers ( str buf,
str  ctype,
str  contact,
time_t  date 
)

build MESSAGE headers

Add Content-Type, Contact and Date headers if they exist expects - max buf len of the resulted body in body->len

  • body->s MUST be allocated return: 0 OK ; -1 error

Definition at line 194 of file msfuncs.c.

References CONTACT_PREFIX, CONTACT_PREFIX_LEN, CONTACT_SUFFIX, CONTACT_SUFFIX_LEN, CRLF, CRLF_LEN, _str::len, _str::s, and timetToSipDateStr().

Referenced by m_dump(), and m_send_ontimer().

int m_extract_content_type ( char *  src,
int  len,
content_type_t ctype,
int  flag 
)

extract the value of Content-Type header

  • src: pointer to C-T content
  • len: length of src
  • ctype: parsed C-T
  • flag: what to parse - bit mask of CT_TYPE, CT_CHARSET, CT_MSGR

return: 0 OK ; -1 error

Definition at line 131 of file msfuncs.c.

References CT_CHARSET, CT_MSGR, CT_TYPE, _str::len, LM_DBG, _str::s, and _content_type::type.

Referenced by m_store().

int ms_extract_time ( str time_str,
int *  time_val 
)

Definition at line 287 of file msfuncs.c.

References _str::len, LM_ERR, NULL, and _str::s.

Referenced by m_store().

int timetToSipDateStr ( time_t  date,
char *  buf,
int  bufLen 
)

Build a RFC 3261 compliant Date string from a time_t value

  • date: input of time_t to build the string from
  • buf: pointer to string for output
  • bufLen: length of buf param

return: >0 length of data copied to buf ; <0 error occured

Definition at line 95 of file msfuncs.c.

References len, and snprintf.

Referenced by m_build_headers().


Variable Documentation

Definition at line 144 of file msilo.c.

Referenced by m_build_body().


Generated on Wed May 23 20:00:40 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6