root/vic/branches/cc/rtp/transmitter.h @ 4278

Revision 4278, 4.2 KB (checked in by soohyunc, 6 years ago)

o now, video traffic is driven by TFWC's Ack

-- i.e., removed output(pb) method in Transmitter::send() method, and

moved it to SessionManager::parse_xr_records().

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2 * Copyright (c) 1993-1995 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *      This product includes software developed by the Network Research
16 *      Group at Lawrence Berkeley National Laboratory.
17 * 4. Neither the name of the University nor of the Laboratory may be used
18 *    to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#) $Header$ (LBL)
34 * $Id$
35 */
36
37#ifndef vic_transmitter_h
38#define vic_transmitter_h
39
40#ifdef WIN32
41//#include <winsock.h>
42#else
43#include <sys/param.h>
44#include <sys/socket.h>
45#include <sys/uio.h>
46#endif
47#include "vic_tcl.h"
48#include "timer.h"
49#include "rtp.h"
50#include "inet.h"
51#include "pktbuf-rtp.h"
52#include "cc/tfwc_sndr.h"
53#include "cc/tfwc_rcvr.h"
54
55/*
56 * The base object for performing the outbound path of
57 * the application level protocol.
58 */
59class Transmitter : public TclObject, public Timer,
60        public TfwcSndr, public TfwcRcvr {
61    public:
62        Transmitter();
63        virtual void timeout();
64
65        struct buffer {
66                struct buffer* next;
67                /*
68                 * make buffer twice as big as necessary so we can
69                 * run off end while doing in-place encoding.
70                 */
71                u_char data[2 * RTP_MTU];
72        };
73/*      struct pktbuf {
74                struct pktbuf* next;
75                iovec iov[2];
76                u_char hdr[MAXHDR];
77                buffer* buf;
78                int layer;
79        };*/
80        static void dump(int fd);
81        static inline void seqno(u_int16_t s) { seqno_ = s; }
82        inline void bps(int kbps) { kbps = kbps_; }
83        inline void loop_layer(int loop_layer) { loop_layer_ = loop_layer; }
84        inline int loop_layer() { return loop_layer_; }
85        inline int mtu() { return (mtu_); }
86        void flush();
87        void send(pktbuf*);
88        inline bool is_cc_on() { return is_cc_active_; }
89        inline pktbuf* get_packet_queue() { return pb_;}
90        /*
91         * Buffer allocation hooks.
92         */
93        //pktbuf* alloch(u_int32_t, int fmt);
94        //void release(pktbuf*);
95        //pktbuf* alloc(u_int32_t, int fmt);
96protected:
97        void update(int nbytes);
98        void dump(int fd, iovec*, int iovel) const;
99        void loopback(pktbuf*);
100        void output(pktbuf* pb);
101        virtual void transmit(pktbuf* pb) = 0;
102        double gettimeofday_secs() const;
103        double txtime(pktbuf* pb);
104
105        int mtu_;               /* mtu of wire (as seen by application) */
106        msghdr mh_;
107
108        int nf_;                /* number of frames sent */
109        int nb_;                /* number of bytes sent */
110        int np_;                /* number of packets sent */
111       
112        int kbps_;              /* bit-rate for interpkt spacing */
113        double nextpkttime_;
114
115        /* packet transmission queue */
116        int busy_;
117        pktbuf* head_;
118        pktbuf* tail_;
119        pktbuf* pb_;
120
121        int loop_layer_;        /* # of layers to loop back (for testing) */
122
123        int loopback_;          /* true to loopback data packets */
124        static int dumpfd_;     /* fd to dump packet stream to */
125        static u_int16_t seqno_;
126
127        /* Cc related variables */
128        bool is_cc_active_;             /* is Cc module activated?              */
129        bool is_first_;         /* is this first CC'd data packet?      */
130
131    private:
132        static pktbuf* freehdrs_;
133        static buffer* freebufs_;
134        static int nbufs_;
135        static int nhdrs_;
136};
137
138#endif
Note: See TracBrowser for help on using the browser.