Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

RTPProtocol::RTPCoder Class Reference

Inheritance diagram for RTPProtocol::RTPCoder:

Inheritance graph
[legend]
Collaboration diagram for RTPProtocol::RTPCoder:

Collaboration graph
[legend]
List of all members.

Public Methods

void send (Marshaller message) throws JonathanException
void prepare (Marshaller m) throws JonathanException
boolean direct ()
ReplyInterface prepareInvocation (Marshaller m) throws JonathanException
synchronized void close ()
void finalize ()

Private Methods

 RTPCoder (Session_High next, int mtu)

Private Attributes

Session_High next_session
short cur_sequence_no
int current_timestamp
int mtu
RTPHeader rtp_header
int max_length

Constructor & Destructor Documentation

RTPProtocol::RTPCoder::RTPCoder ( Session_High next,
int mtu ) [inline, private]
 

Definition at line 199 of file RTPProtocol.java.

00199                                            {
00200          this.next_session=next;
00201          this.mtu=mtu;
00202          cur_sequence_no=0;
00203          rtp_header=new RTPHeader();
00204          rtp_header.payload=INVOC_PAYLOAD;
00205          max_length=mtu-RTPHeader.length-4;                             
00206       }


Member Function Documentation

synchronized void RTPProtocol::RTPCoder::close ( ) [inline]
 

Closes the session, letting the associated resources be released or reused.

Sessions may have an exclusive access to a communication resource. It is thus very important to ensure that they are properly closed if they are no longer in use.

Reimplemented from Session_High.

Definition at line 233 of file RTPProtocol.java.

00233                                        {
00234          if (next_session != null) {
00235             next_session.close();
00236             next_session=null;
00237          }
00238       }

boolean RTPProtocol::RTPCoder::direct ( ) [inline]
 

Return false if the prepare or prepareInvocation must be used, true otherwise.

A true return means that the target protocols headers are added when the message is sent, and not before. Invoking one of the prepare methods would in that case return without having changed anything to the provided marshaler.

Returns:
true if the prepare methods need not be used.

Reimplemented from Session_High.

Definition at line 224 of file RTPProtocol.java.

00224                               {
00225          return false;
00226       }

void RTPProtocol::RTPCoder::finalize ( ) [inline]
 

Definition at line 240 of file RTPProtocol.java.

00240                              {
00241          close();
00242       }

void RTPProtocol::RTPCoder::prepare ( Marshaller marshaller ) [inline]
 

Lets the target session write its own headers into the provided message (one-way case).

Protocols usually need to add headers in the front of messages before sending them down the net. It may be much more efficient to add these headers before the actual message is written. The prepare (and prepareInvocation methods are provided for this purpose. Therefore, an entity wishing to send a message down a protocol stack must first prepare that message by invoking the appropriate method (unless a call to direct returns true), and then write its own data to the message.

The prepare method must only be used to prepare messages with a one-way semantics (no reply expected); If a reply is expected, use prepareInvocation instead.

Parameters:
m   a marshaller representing the message
Exceptions:
JonathanException   if something goes wrong.

Reimplemented from Session_High.

Definition at line 212 of file RTPProtocol.java.

00212                                                                  {
00213          // newt.prepare ?
00214          byte[] header = new byte[12];          
00215          rtp_header.timestamp = current_timestamp++;
00216          rtp_header.sequence_no=cur_sequence_no++;
00217          rtp_header.marker=false;
00218          rtp_header.encode(header);
00219                 
00220          m.writeByteArray(header,0,12);
00221       }

ReplyInterface RTPProtocol::RTPCoder::prepareInvocation ( Marshaller marshaller ) [inline]
 

Reimplemented from Session_High.

Definition at line 228 of file RTPProtocol.java.

00228                                                                                      {
00229          throw new InternalException("RTP session don't handle invocations.");
00230       }

void RTPProtocol::RTPCoder::send ( Marshaller message ) [inline]
 

Sends the message down the protocol stack.

The sent message must have been prepared first, unless a call to direct returns true.

It is the responsibility of the recipient of the message to close it.

Parameters:
m   the message to send;
Exceptions:
JonathanException   if something goes wrong.
See also:
prepareInvocation(Marshaller) , prepare(Marshaller)

Reimplemented from Session_High.

Definition at line 208 of file RTPProtocol.java.

00208                                                                     {
00209         // assumes next_seesion is direct ?                             
00210          next_session.send(message);            
00211       }


Member Data Documentation

short RTPProtocol::RTPCoder::cur_sequence_no [private]
 

Definition at line 193 of file RTPProtocol.java.

int RTPProtocol::RTPCoder::current_timestamp [private]
 

Definition at line 194 of file RTPProtocol.java.

int RTPProtocol::RTPCoder::max_length [private]
 

Definition at line 197 of file RTPProtocol.java.

int RTPProtocol::RTPCoder::mtu [private]
 

Definition at line 195 of file RTPProtocol.java.

Session_High RTPProtocol::RTPCoder::next_session [private]
 

Definition at line 192 of file RTPProtocol.java.

RTPHeader RTPProtocol::RTPCoder::rtp_header [private]
 

Definition at line 196 of file RTPProtocol.java.


The documentation for this class was generated from the following file:
Generated at Fri May 31 19:25:14 2002 for Jonathan by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001