-
- All Implemented Interfaces:
public class PseudoTCPBaseMain protocol logic class. To open connection use connect method. Then recv and send operations may be used for data transfer. To operate this class requires implementation of PseudoTcpNotify. Also it must be notified about the time progress. Based on https://developers.google.com/talk/libjingle/
-
-
Field Summary
Fields Modifier and Type Field Description public final static intDEFAULT_RCV_BUF_SIZEpublic final static intDEFAULT_SND_BUF_SIZEprivate shortm_rwnd_scaleprivate shortm_swnd_scale
-
Constructor Summary
Constructors Constructor Description PseudoTCPBase(PseudoTcpNotify notify, long conv)
-
Method Summary
Modifier and Type Method Description shortgetM_rwnd_scale()shortgetM_swnd_scale()voidconnect()Enqueues connect message and starts connection procedure voidnotifyMTU(int mtu)Set the MTU (maximum transmission unit) value intgetMTU()static longnow()longgetNextClock(long now)Evaluate next interval between getNextClock calls. voidnotifyClock(long now)This method should be called in time intervals retrieved from getNextClock synchronized booleannotifyPacket(Array<byte> buffer, int len)Use this method to notify protocol about packets received from the network synchronized intrecv(Array<byte> buffer, int offset, int len)Reads the data available in receive buffer. intrecv(Array<byte> buffer, int len)Reads the data available in receive buffer. intsend(Array<byte> buffer, int len)Enqueues data in the send buffer synchronized intsend(Array<byte> buffer, int offset, int len)Enqueues data in the send buffer static SegmentparseSeg(Array<byte> buffer, int size)Method can be used in debugging utilities to parse PTCP segment static StringsegToStr(Segment seg)Can be used to convert segments to text PseudoTcpStategetState()ObjectgetAckNotify()-
-
Constructor Detail
-
PseudoTCPBase
PseudoTCPBase(PseudoTcpNotify notify, long conv)
- Parameters:
notify- PseudoTcpNotify implementationconv- the conversation number used by this instance
-
-
Method Detail
-
getM_rwnd_scale
short getM_rwnd_scale()
-
getM_swnd_scale
short getM_swnd_scale()
-
connect
void connect()
Enqueues connect message and starts connection procedure
-
notifyMTU
void notifyMTU(int mtu)
Set the MTU (maximum transmission unit) value
- Parameters:
mtu- the new MTU value
-
getMTU
int getMTU()
-
now
static long now()
-
getNextClock
long getNextClock(long now)
Evaluate next interval between getNextClock calls. It is based on current protocol action timeout
- Parameters:
now- current timestamp
-
notifyClock
void notifyClock(long now)
This method should be called in time intervals retrieved from getNextClock
- Parameters:
now- current timestamp
-
notifyPacket
synchronized boolean notifyPacket(Array<byte> buffer, int len)
Use this method to notify protocol about packets received from the network
- Parameters:
buffer- packet's datalen- data length
-
recv
synchronized int recv(Array<byte> buffer, int offset, int len)
Reads the data available in receive buffer. This method returns 0 if there's no data available at the moment.
- Parameters:
buffer- destination bufferoffset- destination buffer's offsetlen- bytes to be read
-
recv
int recv(Array<byte> buffer, int len)
Reads the data available in receive buffer. This method returns 0 if there's no data available at the moment.
- Parameters:
buffer- destination bufferlen- bytes to be read
-
send
int send(Array<byte> buffer, int len)
Enqueues data in the send buffer
- Parameters:
buffer- source data bufferlen- bytes count to be sent
-
send
synchronized int send(Array<byte> buffer, int offset, int len)
Enqueues data in the send buffer
- Parameters:
buffer- source data bufferoffset- offset of the source data bufferlen- bytes count to be sent
-
parseSeg
static Segment parseSeg(Array<byte> buffer, int size)
Method can be used in debugging utilities to parse PTCP segment
- Parameters:
buffer- data to parsesize- length of the data in the buffer
-
segToStr
static String segToStr(Segment seg)
Can be used to convert segments to text
- Parameters:
seg- the Segment to format
-
getState
PseudoTcpState getState()
-
getAckNotify
Object getAckNotify()
-
-
-
-