msg  1.12.11devel
msg_addr.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef MSG_ADDR_H
27 #define MSG_ADDR_H
28 
29 
38 #ifndef MSG_H
39 #include <sofia-sip/msg.h>
40 #endif
41 #ifndef SU_H
42 #include <sofia-sip/su.h>
43 #endif
44 
45 SOFIA_BEGIN_DECLS
46 
49 
50 SOFIAPUBFUN su_sockaddr_t *msg_addr(msg_t *msg);
51 
52 SOFIAPUBFUN int msg_get_address(msg_t *msg, su_sockaddr_t *, socklen_t *);
53 SOFIAPUBFUN int msg_set_address(msg_t *msg, su_sockaddr_t const *, socklen_t);
54 
55 SOFIAPUBFUN void msg_addr_copy(msg_t *dst, msg_t const *src);
56 
57 SOFIAPUBFUN int msg_errno(msg_t const *msg);
58 SOFIAPUBFUN void msg_set_errno(msg_t *msg, int err);
59 
60 enum {
62  msg_min_size = 512,
64  msg_min_block = 8192,
66  msg_n_fragments = 8
67 };
68 
72 typedef struct su_iovec_s msg_iovec_t;
73 #define mv_base siv_base
74 #define mv_len siv_len
75 
76 SOFIAPUBFUN isize_t msg_iovec(msg_t *msg, msg_iovec_t vec[], isize_t veclen);
77 
78 SOFIAPUBFUN issize_t msg_recv_iovec(msg_t *msg,
79  msg_iovec_t vec[], isize_t veclen, usize_t n,
80  int exact);
81 SOFIAPUBFUN isize_t msg_recv_commit(msg_t *msg, usize_t n, int eos);
82 
83 SOFIAPUBFUN issize_t msg_recv_buffer(msg_t *msg, void **return_buffer);
84 
86 
87 SOFIAPUBFUN int msg_set_next(msg_t *msg, msg_t *next);
88 
90 
91 SOFIAPUBFUN issize_t msg_buf_external(msg_t *msg,
92  usize_t N,
93  usize_t blocksize);
94 
95 SOFIA_END_DECLS
96 
97 #endif /* !defined(MSG_ADDR_H) */
Base message interface.
@ msg_n_fragments
Number of external buffers.
Definition: msg_addr.h:66
@ msg_min_size
Minimum size of a message buffer.
Definition: msg_addr.h:62
@ msg_min_block
Minimum size of external buffer.
Definition: msg_addr.h:64
Message object.
Definition: msg_internal.h:59
issize_t msg_buf_external(msg_t *msg, usize_t N, usize_t blocksize)
Allocate a list of external buffers.
Definition: msg_parser.c:738
isize_t msg_recv_commit(msg_t *msg, usize_t n, int eos)
Commit n bytes of buffers.
Definition: msg_parser.c:527
isize_t msg_iovec(msg_t *msg, msg_iovec_t vec[], isize_t veclen)
Fill an I/O vector with message contents.
Definition: msg_parser.c:2069
int msg_set_address(msg_t *msg, su_sockaddr_t const *su, socklen_t sulen)
Set message address.
Definition: msg.c:329
issize_t msg_recv_iovec(msg_t *msg, msg_iovec_t vec[], isize_t veclen, usize_t n, int exact)
Obtain I/O vector for receiving the data.
Definition: msg_parser.c:339
void msg_addr_zero(msg_t *msg)
Zero the message address.
Definition: msg.c:269
void msg_clear_committed(msg_t *msg)
Clear committed data.
Definition: msg_parser.c:608
issize_t msg_recv_buffer(msg_t *msg, void **return_buffer)
Obtain a buffer for receiving data.
Definition: msg_parser.c:470
void msg_set_errno(msg_t *msg, int err)
Set error number associated with message.
Definition: msg.c:431
int msg_set_next(msg_t *msg, msg_t *next)
Set next message of the stream.
Definition: msg_parser.c:591
msg_t * msg_next(msg_t *msg)
Get a next message of the stream.
Definition: msg_parser.c:564
int msg_get_address(msg_t *msg, su_sockaddr_t *su, socklen_t *return_len)
Get message address.
Definition: msg.c:303
su_addrinfo_t * msg_addrinfo(msg_t *msg)
Get addrinfo structure.
Definition: msg.c:354
int msg_errno(msg_t const *msg)
Get error number associated with message.
Definition: msg.c:418
su_sockaddr_t * msg_addr(msg_t *msg)
Get pointer to socket address structure.
Definition: msg.c:284
void msg_addr_copy(msg_t *dst, msg_t const *src)
Copy message address.
Definition: msg.c:371
struct addrinfo su_addrinfo_t
#define SOFIAPUBFUN

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.