#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su.h>
#include "msg_internal.h"
#include "sofia-sip/msg_parser.h"
#include "sofia-sip/msg_mclass.h"
Include dependency graph for msg.c:
Functions | |
msg_t * | msg_create (msg_mclass_t const *mc, int flags) |
Create a message. | |
msg_t * | msg_ref_create (msg_t *msg) |
Increment a message reference count. | |
void | msg_set_parent (msg_t *kid, msg_t *dad) |
Set a message parent. | |
void | msg_ref_destroy (msg_t *ref) |
Destroy a reference to a message. | |
void | msg_destroy (msg_t *msg) |
Deinitialize and free a message. | |
msg_pub_t * | msg_object (msg_t const *msg) |
Retrieve public message structure. | |
msg_pub_t * | msg_public (msg_t const *msg, void *tag) |
Retrieve public message structure of given type. | |
msg_mclass_t const * | msg_mclass (msg_t const *msg) |
Retrieve message class. | |
void | msg_addr_zero (msg_t *msg) |
Zero the message address. | |
su_sockaddr_t * | msg_addr (msg_t *msg) |
Get pointer to socket address structure. | |
int | msg_get_address (msg_t *msg, su_sockaddr_t *su, socklen_t *return_len) |
Get message address. | |
int | msg_set_address (msg_t *msg, su_sockaddr_t const *su, socklen_t sulen) |
Set message address. | |
su_addrinfo_t * | msg_addrinfo (msg_t *msg) |
Get addrinfo structure. | |
void | msg_addr_copy (msg_t *dst, msg_t const *src) |
Copy message address. | |
unsigned | msg_extract_errors (msg_t const *msg) |
Get error classification flags. | |
int | msg_errno (msg_t const *msg) |
Get error number associated with message. | |
void | msg_set_errno (msg_t *msg, int err) |
Set error number associated with message. |
su_sockaddr_t* msg_addr | ( | msg_t * | msg | ) |
Get pointer to socket address structure.
Copy message address.
Copy the addrinfo and socket address structures from src to the dst message object.
dst | pointer to destination message object | |
src | pointer to source message object |
void msg_addr_zero | ( | msg_t * | msg | ) |
Zero the message address.
Zero the address and addressinfo structures associated with the message.
su_addrinfo_t* msg_addrinfo | ( | msg_t * | msg | ) |
Get addrinfo structure.
Get pointer to the addrinfo structure associated with the message.
msg | pointer to msg object |
pointer | to addrinfo structure | |
NULL | if msg is NULL |
msg_t* msg_create | ( | msg_mclass_t const * | mc, | |
int | flags | |||
) |
Create a message.
mc | message class | |
flags | message control flags |
void msg_destroy | ( | msg_t * | msg | ) |
Deinitialize and free a message.
msg | message to be destroyed |
int msg_errno | ( | msg_t const * | msg | ) |
Get error number associated with message.
msg | pointer to msg object |
unsigned msg_extract_errors | ( | msg_t const * | msg | ) |
Get error classification flags.
If the message parser fails to parse certain headers in the message, it sets the corresponding extract error flags. The flags corresponding to each header are stored in the message parser (msg_mclass_t) structure. They are set when the header is added to the parser table.
The SIP flags are defined in <sofia-sip/sip_headers.h>. For well-known SIP headers, the flags for each header are listed in a separate text file (sip_bad_mask) read by msg_parser.awk.
The flags can be used directly by NTA (the mask triggering 400 response is set with NTATAG_BAD_REQ_MASK(), the mask triggering response messages to be dropped is set with NTATAG_BAD_RESP_MASK()). Alternatively the application can check them based on the method or required SIP features.
int msg_get_address | ( | msg_t * | msg, | |
su_sockaddr_t * | su, | |||
socklen_t * | return_len | |||
) |
Get message address.
Copy the socket address associated with the message to the supplied socket address struture.
msg | pointer to msg object | |
su | pointer to socket address structure | |
return_len | return parameter value for length of socket address structure |
msg_mclass_t const* msg_mclass | ( | msg_t const * | msg | ) |
Retrieve message class.
Get a pointer to the message class object (factory object for the message).
msg | pointer to msg object |
Retrieve public message structure.
Get a pointer to the public message structure.
msg | pointer to msg object |
Retrieve public message structure of given type.
Get a pointer to the public message structure of the given protocol.
msg | pointer to msg object | |
tag | tag of public message structure |
Increment a message reference count.
Creates a reference to a message. The referenced message is not freed until all the references have been destroyed.
msg | message of which a reference is created |
void msg_ref_destroy | ( | msg_t * | ref | ) |
Destroy a reference to a message.
ref | pointer to msg object |
int msg_set_address | ( | msg_t * | msg, | |
su_sockaddr_t const * | su, | |||
socklen_t | sulen | |||
) |
Set message address.
Copy the supplied socket address to the socket address structure associated with the message.
msg | pointer to msg object | |
su | pointer to socket address structure | |
sulen | length of socket address structure |
void msg_set_errno | ( | msg_t * | msg, | |
int | err | |||
) |
Set error number associated with message.
msg | pointer to msg object | |
err | error value (as defined in <sofia-sip/su_errno.h>). |
Set a message parent.
Set a parent for a message. The parent message is not destroyed until all its kids have been destroyed - each kid keeps a reference to its parent message.
kid | child message | |
dad | parent message |