msg_addr.h 2.29 KB
Newer Older
Pekka Pessi's avatar
Pekka Pessi committed
1 2 3 4 5 6 7
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
8
 * This library is free software; you can redistribute it and/or
Pekka Pessi's avatar
Pekka Pessi committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef MSG_ADDR_H /** Defined when msg_addr.h has been included. */
Pekka Pessi's avatar
Pekka Pessi committed
26 27
#define MSG_ADDR_H 

Pekka Pessi's avatar
Pekka Pessi committed
28

29
/**@file msg_addr.h 
Pekka Pessi's avatar
Pekka Pessi committed
30 31 32 33 34 35 36 37
 * @brief Addressing and I/O interface for messages.
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 *
 * @date Created: Thu Jun  8 19:28:55 2000 ppessi
 */

#ifndef MSG_H
38
#include <sofia-sip/msg.h>
Pekka Pessi's avatar
Pekka Pessi committed
39 40
#endif
#ifndef SU_H
41
#include <sofia-sip/su.h>
Pekka Pessi's avatar
Pekka Pessi committed
42 43
#endif

44 45
SOFIA_BEGIN_DECLS

Pekka Pessi's avatar
Pekka Pessi committed
46 47 48 49 50 51 52 53 54 55
void msg_addr_zero(msg_t *msg);
su_addrinfo_t *msg_addrinfo(msg_t *msg);
su_sockaddr_t *msg_addr(msg_t *msg);
socklen_t *msg_addrlen(msg_t *msg);
void msg_addr_copy(msg_t *dst, msg_t const *src);

int msg_errno(msg_t const *msg);
void msg_set_errno(msg_t *msg, int err);

enum {
56
  /** Minimum size of a message buffer */
Pekka Pessi's avatar
Pekka Pessi committed
57
  msg_min_size = 512,
58
  /** Minimum size of external buffer */
Pekka Pessi's avatar
Pekka Pessi committed
59
  msg_min_block = 8192,
60
  /** Number of external buffers */
Pekka Pessi's avatar
Pekka Pessi committed
61 62 63 64 65 66 67 68 69 70 71 72 73
  msg_n_fragments = 8
};

typedef struct su_iovec_s msg_iovec_t;
#define mv_base siv_base
#define mv_len  siv_len

int msg_iovec(msg_t *msg, msg_iovec_t vec[], int veclen);

int msg_recv_iovec(msg_t *msg, msg_iovec_t vec[], int veclen, unsigned n, 
		   int exact);
int msg_recv_commit(msg_t *msg, unsigned n, int eos);

74
int msg_recv_buffer(msg_t *msg, void **return_buffer);
Pekka Pessi's avatar
Pekka Pessi committed
75 76 77 78 79 80 81 82 83 84 85 86

msg_t *msg_next(msg_t *msg);

int msg_set_next(msg_t *msg, msg_t *next);

void msg_clear_committed(msg_t *msg);

int msg_buf_external(msg_t *msg, 
		     unsigned N, 
		     unsigned blocksize);


87 88
SOFIA_END_DECLS

Pekka Pessi's avatar
Pekka Pessi committed
89
#endif /* !defined(MSG_ADDR_H) */