1 /* 2 * Copyright (c) 2004-2006 Maxim Sobolev <sobomax@FreeBSD.org> 3 * Copyright (c) 2006-2014 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 enum rtpp_ctrl_type {RTPC_IFSUN, RTPC_UDP4, RTPC_UDP6, RTPC_SYSD, RTPC_STDIO, 30 RTPC_IFSUN_C, RTPC_TCP4, RTPC_TCP6}; 31 32 struct rtpp_ctrl_sock { 33 struct rtpp_type_linkable t; 34 enum rtpp_ctrl_type type; 35 const char *cmd_sock; 36 int controlfd_in; 37 int controlfd_out; 38 int port_ctl; /* Port number for UDP control, 0 for Unix domain */ 39 int exit_on_close; 40 struct sockaddr_storage bindaddr; 41 }; 42 43 #define RTPP_CTRL_ISDG(rcsp) ((rcsp)->type == RTPC_UDP4 || (rcsp)->type == RTPC_UDP6) 44 #define RTPP_CTRL_ISUNIX(rcsp) ((rcsp)->type == RTPC_IFSUN || (rcsp)->type == RTPC_IFSUN_C) 45 #define RTPP_CTRL_ISSTREAM(rcsp) ((rcsp)->type == RTPC_IFSUN_C || (rcsp)->type == RTPC_STDIO \ 46 || (rcsp)->type == RTPC_TCP4 || (rcsp)->type == RTPC_TCP6) 47 #define RTPP_CTRL_ACCEPTABLE(rcsp) ((rcsp)->type == RTPC_IFSUN || (rcsp)->type == RTPC_IFSUN_C \ 48 || (rcsp)->type == RTPC_TCP4 || (rcsp)->type == RTPC_TCP6) 49 50 int rtpp_controlfd_init(struct cfg *cf); 51 struct rtpp_ctrl_sock *rtpp_ctrl_sock_parse(const char *); 52 const char *rtpp_ctrl_sock_describe(struct rtpp_ctrl_sock *); 53 void rtpp_controlfd_cleanup(struct cfg *cf); 54 int rtpp_csock_addrlen(struct rtpp_ctrl_sock *); 55