Package rtpi

Source Code of rtpi.RtpiStateQuery

/* The Java RTP/I library, Version 0.1 alpha.
* This library provides the functionality of RTP/I as it is specified in
* Internet Draft draft-mauve-rtpi-00.txt.
*
* Copyright (C) 2000 Martin Mauve
* University of Mannheim / Germany
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* Martin Mauve
*
* e-mail:
* mauve@informatik.uni-mannheim.de
*
* paper mail:
* Martin Mauve
* University of Mannheim
* Lehrstuhl Praktische Informatik IV
* L15, 16
* 68131 Mannheim
* Germany
*/

package rtpi;

import java.util.LinkedList;
import java.util.ListIterator;

import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.OutputStream;
import java.io.IOException;


import rtpi.packets.RtpiDataPacket;

/**
* This class represents rtpi state query ADUs that are sent or
* received. Do not try to put any data in this ADU or read
* data from the ADU. State queries do not carry payload data!
*
* @author Martin Mauve.
*/

public class RtpiStateQuery extends RtpiData {
   
    /**
     * Create a new ADU for the transmission over the
     * network.
     *
     * @param pID The ID of the local participant.
     * @param subID The ID of the affected subcomponent.
     * @param seqNo The sequence number of the ADU.
     * @param pType The payload type of the ADU.
     * @param pri The priority of this ADU.
     * @param ts The timestamp of the ADU. The value will be
     *           automatically clipped to a 32 bit value;
     * @param pls The amount of bytes required for the combined RTP/I
     *            packet header (rtpi.packets.RtpiDataPacket.HEADER_SIZE)
     *            and the reliability header (depending on the reliability
     *            mechanism) used. If this value is not caluclated correctly
     *            then the packet will have to be copied one additional time
     *            before it can be sent. This decreases efficiency but should
     *            still work. There is a utility function Rtpi.getCombinedHeaderSize
     *            which returns this value.
     */
   
    public RtpiStateQuery(int pID,
         long subID,
         int seqNo,
         int pType,
         int pri,
         long ts,
         int pls
         ) throws IllegalValueException {
  super(pID, subID, RtpiDataPacket.STATE_QUERY, seqNo, pType, pri, ts, pls);
  payloadLength=0;
  payload=new byte[pls];
  type=RtpiDataPacket.STATE_QUERY;
    }

    RtpiStateQuery(RtpiDataPacket packet) throws IllegalRtpiAduTypeException {
  super(packet);
  if (type!=RtpiDataPacket.STATE_QUERY) {
      throw new IllegalRtpiAduTypeException("RtpiStateQuery: recieved illegal Adu type for decoding: "+type);
  }
    }

    RtpiStateQuery(LinkedList list) throws IllegalRtpiAduTypeException {
  super(list);
  if (type!=RtpiDataPacket.STATE_QUERY) {
      throw new IllegalRtpiAduTypeException("RtpiStateQuery: recieved illegal Adu type for decoding: "+type);
  }
    }

    /**
     * Don't call this method!
     */

    public OutputStream getOutputStream() throws IOException {
  System.err.println("RtpiStateQuery: error, getOutputStream called!");
  return null;
    }

    /**
     * Don't call this method!
     */

    public void outputComplete() {
  System.err.println("RtpiStateQuery: error, outputComplete called!")
    }


    /**
     * Don't call this method!
     */

    public ByteArrayInputStream getInputStream() {
  System.err.println("RtpiStateQuery: error, getInputStream called!");
  return null;
    }

    LinkedList packetize(int transportPayloadSize) {
  LinkedList packets=new LinkedList();
  RtpiDataPacket packet = new RtpiDataPacket(payload, payloadStart, payloadLength);
  setPacketFields(packet, 0, 1);
  packets.add(packet);
  return packets;
    }     
}
   
TOP

Related Classes of rtpi.RtpiStateQuery

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.