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 pollfd;
30 struct rtpp_session;
31 struct rtpp_sessinfo;
32 struct rtpp_socket;
33 struct rtpp_polltbl;
34 struct rtpp_weakref_obj;
35 struct rtpp_cfg_stable;
36 
37 DEFINE_METHOD(rtpp_sessinfo, rtpp_si_append, int, struct rtpp_session *,
38   int, struct rtpp_socket **);
39 DEFINE_METHOD(rtpp_sessinfo, rtpp_si_update, void, struct rtpp_session *,
40   int, struct rtpp_socket **);
41 DEFINE_METHOD(rtpp_sessinfo, rtpp_si_remove, void, struct rtpp_session *,
42   int);
43 DEFINE_METHOD(rtpp_sessinfo, rtpp_si_sync_polltbl, int, struct rtpp_polltbl *,
44   int);
45 
46 struct rtpp_polltbl_mdata;
47 
48 struct rtpp_polltbl_mdata {
49     uint64_t stuid;
50     struct rtpp_socket *skt;
51 };
52 
53 struct rtpp_polltbl {
54     struct pollfd *pfds;
55     struct rtpp_polltbl_mdata *mds;
56     int curlen;
57     int aloclen;
58     uint64_t revision;
59     struct rtpp_weakref_obj *streams_wrt;
60 };
61 
62 struct rtpp_sessinfo {
63     struct rtpp_refcnt *rcnt;
64     METHOD_ENTRY(rtpp_si_append, append);
65     METHOD_ENTRY(rtpp_si_update, update);
66     METHOD_ENTRY(rtpp_si_remove, remove);
67     METHOD_ENTRY(rtpp_si_sync_polltbl, sync_polltbl);
68 };
69 
70 struct rtpp_sessinfo *rtpp_sessinfo_ctor(struct rtpp_cfg_stable *);
71 
72 void rtpp_polltbl_free(struct rtpp_polltbl *);
73