Package rtpi

Examples of rtpi.IllegalValueException


  super(pid);
  payloadType=APP;
  name=n;
  data=d;
  if (name.length!=4) {
      throw new IllegalValueException("RtcpiApplicationPacket: illegal name length: "+name.length+" should be 4");
  }
  if (data.length%4!=0) {
      throw new IllegalValueException("RtcpiApplicationPacket: illegal data length: "+data.length+" should be divisble by 4");
  }

  length=1+data.length/4;
    }
View Full Code Here


    }

    private void setSourceDescriptionItems(LinkedList its) throws IllegalValueException {
  items=its;
  if (items==null || items.size()==0 || items.size()>31) {
      throw new IllegalValueException("RtcpiSourceDescriptionPacket: Can't set empty entries list");
  }

  count = items.size();

  SourceDescriptionItem item = (SourceDescriptionItem) items.getFirst();
  if (item.getType()!=SourceDescriptionItem.CNAME) {
      throw new IllegalValueException("RtcpiSourceDescriptionPacket: First element in entries list is not a CNAME entry");
  }

  length = 0; // first calculate them on a byte basis, then devide it by 4!
   
  for(ListIterator iter=items.listIterator();iter.hasNext();) {
View Full Code Here

     * @param d The item data.
     */

     public SourceDescriptionItem(int t, byte[] d) throws IllegalValueException {
  if (t<1 || t>7) {
      throw new IllegalValueException("SourceDescriptionItem: illegal SDES type");
  }
  if (d.length>255) {
      throw new IllegalValueException("SourceDescriptionItem: item too long (more than 255 bytes)");
  }     
  type=t;
  data=d;
    }
View Full Code Here

     * @param p The PRIV item prefix.
     */

    public SourceDescriptionItem(byte[] d, byte[] p) throws IllegalValueException {
  if (d.length+p.length>253) {
      throw new IllegalValueException("SourceDescriptionItem: item too long (more than 255 bytes,including prefix info)");
  }
  type=PRIV;
  data=d;
  prefix=p;
    }
View Full Code Here

     * @return The prefix of this PRIV item.
     */

    public byte[] getPrefix() throws IllegalValueException {
  if (type!=PRIV) {
      throw new IllegalValueException("SourceDescriptionItem: cannot get prefix for a non PRIV item");
  }
  return prefix;
    }
View Full Code Here

    }

    void setSubcomponentReportInfo(int applicationLevelNames, LinkedList subs) throws IllegalValueException {
  subcomponents=subs;
  if (subcomponents==null || subcomponents.size()==0 || subcomponents.size()>31) {
      throw new IllegalValueException("RtcpiSubcomponentReportPacket: Can't set empty entries list");
  }

  reserved=applicationLevelNames;

  count = subcomponents.size();

  length = 1+subcomponents.size()*2; // 1 is for active list, header does not count towards length!

  if (reserved!=1) { // no application level names
      return;
  }
 
  SubcomponentReportInfo info = null;

  for(ListIterator iter=subcomponents.listIterator();iter.hasNext();) {
      info = (SubcomponentReportInfo) iter.next();
      byte[] name=info.getApplicationLevelName();
      if (name==null || name.length>255)
    throw new IllegalValueException("RtcpiSubcomponentReportPacket: no application level name present");
      int entryLength=name.length + 1; // without padding
      length += (entryLength+(4-entryLength%4)%4)/4; // with padding
  }
    }
View Full Code Here

  }
 
  ListIterator iter = packets.listIterator();
 
  if (!iter.hasNext()) {
      throw new IllegalValueException("UdpUnreliable: empty RTP/I ADU");
  }

  RtpiDataPacket packet = (RtpiDataPacket) iter.next();

  if (packet.getFragmentCount()!=0) {
      throw new IllegalValueException("UdpUnreliable: fragment count of the first packet is not 0");
  }

  int sequenceNumber=packet.getSequenceNumber();
  int fragmentCount=packet.getFragmentCount();
  int type=packet.getType();
  int payloadType=packet.getPayloadType();
  int priority=packet.getPriority();
  int participantID=packet.getParticipantID();
  long subcomponentID=packet.getSubcomponentID();
  long timestamp=packet.getTimestamp();

  while (iter.hasNext()) {
      packet=(RtpiDataPacket) iter.next();
      if (sequenceNumber!=packet.getSequenceNumber()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different sequence numbers");
      }
      if (((++fragmentCount)%0x0000FFFF)!=packet.getFragmentCount()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have non contiguous fragment counts");
      }
      if (type!=packet.getType()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different types");
      }
      if (payloadType!=packet.getPayloadType()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different payload types");
      }
      if (priority!=packet.getPriority()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different priorities");
      }
      if (participantID!=packet.getParticipantID()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different paticipant IDs");
      }
      if (subcomponentID!=packet.getSubcomponentID()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different sub-component IDs");
      }
      if (timestamp!=packet.getTimestamp()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different timestamps");
      }
  }   

  if (packet.getEnd()!=1) {
      throw new IllegalValueException("UdpUnreliable: end bit not set in last packet of RTP/I ADU");
  }

        messages.put(new Message(Message.TRANSMIT_RTPI_ADU, packets));
    }
View Full Code Here

     *                of four bytes in length.
     */
    public void setReliabilityHeader(byte[] header) throws IllegalValueException {
  if (header==null) {
      throw new IllegalValueException("RtpiDataPacket: Reliability header needs to be a non null value");
  }

  if ((header.length+1)%4!=0) {
      throw new IllegalValueException("RtpiDataPacket: The size of a reliability header need to be a multiple of 4 bytes");
  }
  extension=1;
  reliabilityHeader=header;
  reliabilityHeaderLength=(header.length+1)/4-1;
View Full Code Here

  }
 
  ListIterator iter = packets.listIterator();
 
  if (!iter.hasNext()) {
      throw new IllegalValueException("UdpUnreliable: empty RTP/I ADU");
  }

  RtpiDataPacket packet = (RtpiDataPacket) iter.next();

  if (packet.getFragmentCount()!=0) {
      throw new IllegalValueException("UdpUnreliable: fragment count of the first packet is not 0");
  }

  int sequenceNumber=packet.getSequenceNumber();
  int fragmentCount=packet.getFragmentCount();
  int type=packet.getType();
  int payloadType=packet.getPayloadType();
  int priority=packet.getPriority();
  int participantID=packet.getParticipantID();
  long subcomponentID=packet.getSubcomponentID();
  long timestamp=packet.getTimestamp();

  while (iter.hasNext()) {
      packet=(RtpiDataPacket) iter.next();
      if (sequenceNumber!=packet.getSequenceNumber()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different sequence numbers");
      }
      if (((++fragmentCount)%0x0000FFFF)!=packet.getFragmentCount()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have non contiguous fragment counts");
      }
      if (type!=packet.getType()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different types");
      }
      if (payloadType!=packet.getPayloadType()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different payload types");
      }
      if (priority!=packet.getPriority()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different priorities");
      }
      if (participantID!=packet.getParticipantID()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different paticipant IDs");
      }
      if (subcomponentID!=packet.getSubcomponentID()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different sub-component IDs");
      }
      if (timestamp!=packet.getTimestamp()) {
    throw new IllegalValueException("UdpUnreliable: packets of the same RTP/I ADU have different timestamps");
      }
  }   

  if (packet.getEnd()!=1) {
      throw new IllegalValueException("UdpUnreliable: end bit not set in last packet of RTP/I ADU");
  }

        messages.put(new Message(Message.TRANSMIT_RTPI_ADU, packets));
    }
View Full Code Here

TOP

Related Classes of rtpi.IllegalValueException

Copyright © 2018 www.massapicom. 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.