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 #ifndef _RTPP_PIPE_H_
30 #define _RTPP_PIPE_H_
31 
32 struct rtpp_stats;
33 struct rtpp_pipe;
34 struct rtpp_acct_pipe;
35 
36 #define PIPE_RTP        1
37 #define PIPE_RTCP       2
38 
39 #define PP_NAME(t)      (((t) == PIPE_RTP) ? "RTP" : "RTCP")
40 
41 DEFINE_METHOD(rtpp_pipe, rtpp_pipe_get_ttl, int);
42 DEFINE_METHOD(rtpp_pipe, rtpp_pipe_decr_ttl, void);
43 DEFINE_METHOD(rtpp_pipe, rtpp_pipe_get_stats, void, struct rtpp_acct_pipe *);
44 DEFINE_METHOD(rtpp_pipe, rtpp_pipe_upd_cntrs, void, struct rtpp_acct_pipe *);
45 
46 struct rtpp_pipe {
47     /* Session for caller [0] and callee [1] */
48     struct rtpp_stream *stream[2];
49     struct rtpp_pcount *pcount;
50     /* UID */
51     uint64_t ppuid;
52     /* Session log */
53     struct rtpp_log *log;
54 
55     struct rtpp_stats *rtpp_stats;
56     struct rtpp_weakref_obj *servers_wrt;
57 
58     /* Refcounter */
59     struct rtpp_refcnt *rcnt;
60 
61     METHOD_ENTRY(rtpp_pipe_get_ttl, get_ttl);
62     METHOD_ENTRY(rtpp_pipe_decr_ttl, decr_ttl);
63     METHOD_ENTRY(rtpp_pipe_get_stats, get_stats);
64     METHOD_ENTRY(rtpp_pipe_upd_cntrs, upd_cntrs);
65 };
66 
67 struct rtpp_pipe *rtpp_pipe_ctor(uint64_t, struct rtpp_weakref_obj *,
68   struct rtpp_weakref_obj *, struct rtpp_log *,
69   struct rtpp_stats *, int);
70 
71 #endif
72