Networking Java Solutions Homework Header size Get The Header Bitstream Header New

Document Type
Homework Help
Book Title
Computer Networking: A Top-Down Approach 6th Edition
Authors
James F. Kurose, Keith W. Ross
RTPpacket.java
//class RTPpacket
public class RTPpacket{
//size of the RTP header:
static int HEADER_SIZE = 12;
//Bitstream of the RTP header
public byte[] header;
//size of the RTP payload
public int payload_size;
//Bitstream of the RTP payload
Extension = 0;
CC = 0;
Marker = 0;
Ssrc = 0;
//fill changing header fields:
//header[0] = ...
// .....
//fill the payload bitstream:
//--------------------------
payload_size = data_length;
Version = 2;
Padding = 0;
Extension = 0;
CC = 0;
Marker = 0;
for (int i=HEADER_SIZE; i < packet_size; i++)
payload[i-HEADER_SIZE] = packet[i];
//interpret the changing fields of the header:
PayloadType = header[1] & 127;
SequenceNumber = unsigned_int(header[3]) +
}
//--------------------------
//getpayload_length: return the length of the payload
//--------------------------
public int getpayload_length() {
return(payload_size);
}
for (int i=0; i < HEADER_SIZE; i++)
packet[i] = header[i];
for (int i=0; i < payload_size; i++)
packet[i+HEADER_SIZE] = payload[i];
//return total size of the packet
return(SequenceNumber);
}
//--------------------------
//getpayloadtype
//--------------------------
public int getpayloadtype() {
else
System.out.print("0");
System.out.print(" ");
}
System.out.println();
*/
}
//return the unsigned value of 8-bit integer nb
}
}

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.