1 /* 2 * Copyright (c) 2004-2006 Maxim Sobolev <sobomax@FreeBSD.org> 3 * Copyright (c) 2006-2015 Sippy Software, Inc., http://www.sippysoft.com 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29 struct cfg; 30 struct rtpp_socket; 31 struct sockaddr; 32 struct rtp_packet; 33 struct sthread_args; 34 struct rtpp_log; 35 struct rtpp_netaddr; 36 37 DEFINE_METHOD(rtpp_socket, rtpp_socket_bind, int, const struct sockaddr *, 38 int); 39 DEFINE_METHOD(rtpp_socket, rtpp_socket_settos, int, int); 40 DEFINE_METHOD(rtpp_socket, rtpp_socket_setrbuf, int, int); 41 DEFINE_METHOD(rtpp_socket, rtpp_socket_setnonblock, int); 42 DEFINE_METHOD(rtpp_socket, rtpp_socket_settimestamp, int); 43 DEFINE_METHOD(rtpp_socket, rtpp_socket_send_pkt, int, 44 struct sthread_args *, const struct sockaddr *, int, struct rtp_packet *, 45 struct rtpp_log *); 46 DEFINE_METHOD(rtpp_socket, rtpp_socket_send_pkt_na, int, 47 struct sthread_args *, struct rtpp_netaddr *, struct rtp_packet *, 48 struct rtpp_log *); 49 DEFINE_METHOD(rtpp_socket, rtpp_socket_rtp_recv, struct rtp_packet *, 50 double, struct sockaddr *, int); 51 DEFINE_METHOD(rtpp_socket, rtpp_socket_getfd, int); 52 53 struct rtpp_socket { 54 struct rtpp_refcnt *rcnt; 55 /* Public methods */ 56 METHOD_ENTRY(rtpp_socket_bind, bind); 57 METHOD_ENTRY(rtpp_socket_settos, settos); 58 METHOD_ENTRY(rtpp_socket_setrbuf, setrbuf); 59 METHOD_ENTRY(rtpp_socket_setnonblock, setnonblock); 60 METHOD_ENTRY(rtpp_socket_settimestamp, settimestamp); 61 METHOD_ENTRY(rtpp_socket_send_pkt, send_pkt); 62 METHOD_ENTRY(rtpp_socket_send_pkt_na, send_pkt_na); 63 METHOD_ENTRY(rtpp_socket_rtp_recv, rtp_recv); 64 METHOD_ENTRY(rtpp_socket_getfd, getfd); 65 }; 66 67 struct rtpp_socket *rtpp_socket_ctor(int, int); 68