#include <sofia-sip/msg_types.h>
#include <sofia-sip/su_alloc.h>
Include dependency graph for msg.h:

Go to the source code of this file.
Defines | |
| #define | msg_home(h) |
| Cast a msg_t pointer to a su_home_t pointer. | |
| #define | MSG_FLAGS(f, v) |
| Test if all the flags in v are set in f. | |
Enumerations | |
| enum | msg_streaming_status { msg_stop_streaming, msg_start_streaming } |
| Streaming state of a msg_t object. More... | |
| enum | msg_flg_user { MSG_FLG_COMPACT, MSG_FLG_CANONIC, MSG_FLG_EXTRACT_COPY, MSG_FLG_COMMA_LISTS, MSG_FLG_MAILBOX, MSG_FLG_CHUNKING, MSG_FLG_STREAMING, MSG_FLG_THRDSAFE } |
| Flags controlling parser/printer. More... | |
| enum | msg_flg_parser { MSG_FLG_HEADERS, MSG_FLG_BODY, MSG_FLG_CHUNKS, MSG_FLG_TRAILERS, MSG_FLG_FRAGS, MSG_FLG_COMPLETE, MSG_FLG_ERROR, MSG_FLG_TOOLARGE, MSG_FLG_TRUNC, MSG_FLG_TIMEOUT } |
| Flags used by parser. More... | |
Functions | |
| msg_t * | msg_create (msg_mclass_t const *mc, int flags) |
| Create a message. | |
| void | msg_destroy (msg_t *) |
| Deinitialize and free a message. | |
| msg_t * | msg_copy (msg_t *) |
| Copy a message shallowly. | |
| msg_t * | msg_dup (msg_t const *) |
| Deep copy a message. | |
| msg_t * | msg_make (msg_mclass_t const *mc, int flags, void const *data, ssize_t len) |
| Parse a message. | |
| char * | msg_as_string (su_home_t *home, msg_t *msg, msg_pub_t *pub, int flags, size_t *return_len) |
| Convert a message to a string. | |
| void | msg_set_parent (msg_t *kid, msg_t *dad) |
| Set a message parent. | |
| msg_t * | msg_ref_create (msg_t *) |
| Increment a message reference count. | |
| void | msg_ref_destroy (msg_t *) |
| Destroy a reference to a message. | |
| msg_pub_t * | msg_public (msg_t const *msg, void *tag) |
| Retrieve public message structure of given type. | |
| msg_pub_t * | msg_object (msg_t const *msg) |
| Retrieve public message structure. | |
| msg_mclass_t const * | msg_mclass (msg_t const *msg) |
| Retrieve message class. | |
| int | msg_extract (msg_t *msg) |
| Extract and parse a message from internal buffer. | |
| unsigned | msg_extract_errors (msg_t const *msg) |
| Get error classification flags. | |
| int | msg_is_complete (msg_t const *msg) |
| Return true if message is complete. | |
| int | msg_has_error (msg_t const *msg) |
| Return true if message has parsing errors. | |
| msg_header_t ** | msg_chain_head (msg_t const *msg) |
| Return head of the fragment chain. | |
| int | msg_serialize (msg_t *msg, msg_pub_t *mo) |
| Serialize headers into the fragment chain. | |
| int | msg_prepare (msg_t *msg) |
| Encode all message fragments. | |
| void | msg_unprepare (msg_t *msg) |
| Clear 'prepared' flag. | |
| int | msg_is_prepared (msg_t const *msg) |
| Return true if message is prepared. | |
| usize_t | msg_size (msg_t const *msg) |
| Total size of message. | |
| usize_t | msg_maxsize (msg_t *msg, usize_t maxsize) |
| Set the maximum size of a message. | |
| int | msg_is_streaming (msg_t const *msg) |
| Test if streaming is in progress. | |
| void | msg_set_streaming (msg_t *msg, enum msg_streaming_status what) |
| Enable/disable streaming. | |
| unsigned | msg_mark_as_complete (msg_t *msg, unsigned mask) |
| Mark message as complete. | |
| unsigned | msg_get_flags (msg_t const *msg, unsigned mask) |
| Get message flags. | |
| unsigned | msg_set_flags (msg_t *msg, unsigned mask) |
| Set message flags. | |
| unsigned | msg_zap_flags (msg_t *msg, unsigned mask) |
| Clear message flags. | |
|
|
|
Flags controlling parser/printer.
|
|
|
Streaming state of a msg_t object.
|
|
||||||||||||||||||||||||
|
Convert a message to a string. A message is encoded and the encoding result is returned as a string. Because the message may contain binary payload (or NUL in headers), the message length is returned separately in *return_len, too. Note that the message is serialized as a side effect.
|
|
|
Copy a message shallowly. Copy a message and the header structures. The copied message will share all the strings with the original message. It will keep a reference to the original message, and the original message is not destroyed until all the copies have been destroyed.
|
|
||||||||||||
|
Create a message.
|
|
|
Deinitialize and free a message.
|
|
|
Deep copy a message. Copy a message, the header structures and all the related strings. The duplicated message does not share any (non-const) data with original. Note that the cached representation (in h_data) is not copied.
|
|
|
Extract and parse a message from internal buffer. This function parses the internal buffer and adds the parsed fragments to the message object. It marks the successfully parsed data as extracted.
|
|
|
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.
|
|
||||||||||||||||||||
|
Parse a message. Parse a text message with parser mc. The data is copied and it is not modified or referenced by the parsed message.
|
|
||||||||||||
|
Set the maximum size of a message. The function msg_maxsize() sets the maximum buffer size of a message. It returns the previous maximum size. If the maxsize is 0, maximum size is not set, but the current maximum size is returned. If the message size exceeds maxsize, msg_errno() returns ENOBUFS, MSG_FLG_TOOLARGE and MSG_FLG_ERROR flags are set. |
|
|
Retrieve message class. Get a pointer to the message class object (factory object for the message).
|
|
|
Retrieve public message structure. Get a pointer to the public message structure.
|
|
|
Encode all message fragments. The function msg_prepare() prepares a message for sending. It encodes all serialized fragments in the message. You have to call msg_serialize() before calling msg_headers_prepare() in order to make sure that all the heades and other message fragments are included in the chain. After encoding, the msg_common_s::h_data field will point to the encoding result of size msg_common_s::h_len bytes in in each fragment. When multiple header fields are represented as a comma-separated list within a single header line, the first fragment in the header will contain all the text belonging to the header. The rest of the header fields will have zero-length encoding with msg_common_s::h_data that points to the end of the line.
|
|
||||||||||||
|
Retrieve public message structure of given type. Get a pointer to the public message structure of the given protocol.
|
|
|
Increment a message reference count. Creates a reference to a message. The referenced message is not freed until all the references have been destroyed.
|
|
|
Destroy a reference to a message.
|
|
||||||||||||
|
Serialize headers into the fragment chain. The msg_serialize() collects the headers and other message components in the fragment chain. It should be called before msg_prepare().
|
|
||||||||||||
|
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.
|