input
stringlengths
10
828
output
stringlengths
5
107
public socket wrapper get socket wrapper return my socket wrapper
get the socket wrapper this socket uses
public boolean is suspended return account options get bool property suspended false
is the account suspended
public void set socket id final string idstring socket id idstring my thread set name socket id
set this sockets id
public selector get selector if is single thread return connected socket selector get connected socket selector get selector else return selector
get the selector in use by this socket
public string get suspend reason if is suspended return account options get property suspend reason else return
why is the account suspended
public void register socket final socket channel channel final connected socket socket throws closed channel exception synchronized known sockets if known sockets contains key channel selector wakeup channel register selector selection key op read selection key op connect known sockets put channel socket
register a connected socket
public void unregister socket final socket channel channel synchronized known sockets if known sockets contains key channel known sockets remove channel
unregister a connected socket
public string get ip if is ssl return my ip else return my ip
get the ip address of this socket
public void set admin final boolean value if value is admin change command manager to reflect new setting if value my command manager add sub command manager dfbnc get admin command manager else my command manager del sub command manager dfbnc get admin command manager account options set bool property admin value
change the admin setting for this account
public boolean is admin return account options get bool property admin false
is the account an admin
public void set first final boolean value account options set bool property first value
change the first time setting for this account
public void on channel self join final parser t parser final channel info c channel allow names through allow line c channel 353 allow line c channel 366 allow topic through allow line c channel 331 allow line c channel 332 allow line c channel 333
called when we join a channel
public void send bot message final string data final object args if post001 if my account null final string method my account get contact method if method equals ignore case snotice send server line notice data args else send bot line method data args else send server line notice data args else send line notice auth string format data args
send a message to the user from the bnc bot in printf format
public boolean is first return account options get bool property first true
return the value of is first
public void send all final string line final boolean ignore this for user socket socket this get account get user sockets if ignore this socket this continue socket send line line
send a given raw line to all sockets
public void send bot line final string type final string data final object args send line s bot s s s s functions get bot name functions get server name my account type nickname string format data args
send a message to the user from the bnc bot in printf format
public void set contact method final string value account options set property contact method value
change the contact method setting for this account
public void send server line final string type final string data final object args send line s s s s functions get server name my account type nickname string format data args
send a message to the user from the bnc server in printf format
public string get contact method return account options get property contact method snotice
get the contact method setting for this account
private boolean check param count final string new line final int count if new line length count send ircline consts err needmoreparams new line 0 not enough parameters return false return true
check if there is enough parameters if not return an error
public typed properties get properties return account options
get the account options typed properties file for this account
private void handle bot command final string bits try if my account null my account get command manager handle this bits catch command not found exception c send bot message unknown command s please try show commands bits 0 catch exception e send bot message exception with command s s bits 0 e get message
handle a command sent to the bot
public secure socket final socket channel channel final connected socket owner throws ioexception super channel owner try ssl engine get sslcontext create sslengine ssl engine set use client mode false ssl engine begin handshake my byte channel new sslbyte channel channel ssl engine catch exception e throw new ioexception error setting up ssl socket e get message e
create a new secure socket
protected byte channel get byte channel if my byte channel null return my socket channel else return my byte channel
used to get the byte channel for read and write operations
protected socket channel get socket channel return my socket channel
used to get the socket channel we are wrapping
public socket wrapper final socket channel channel final connected socket owner my owner owner my socket channel channel my socket channel socket
create a new socket wrapper
public void close throws ioexception if my byte channel null my byte channel my socket channel my byte channel close my socket channel close
close this socket wrapper
protected int write final byte buffer data throws ioexception return get byte channel write data
write to this socket
protected int read final byte buffer data throws ioexception return get byte channel read data
read from this socket
private sslengine result unwrap throws ioexception sslexception read in as much data as we can while my channel read in net data 0 unwrap it into the buffer in net data flip sslengine result ser my engine unwrap in net data in app data in net data compact return ser
unwrap data from in net data to in app data
public socket address get remote socket address return my socket get remote socket address
get the remote socket address for this socket
public socket address get local socket address return my socket get local socket address
get the local socket address for this socket
public plain socket final socket channel channel final connected socket owner throws ioexception super channel owner
create a new plain socket
public unable to connect exception final string message super message
create a new unable to connect exception
public void send topic final user socket user final channel info channel if channel get topic is empty user send ircline 332 my parser get local client get nickname channel channel get topic user send ircline 333 my parser get local client get nickname channel channel get topic setter channel get topic time false else user send ircline 331 my parser get local client get nickname channel no topic is set
send a topic reply for a channel to the given user
public string filter perform line final string input string result input result result replace all me my parser get local client get nickname return result
filter a perform line and return the line after substitutions have occured
public boolean is active return status id 1
ckeck if the service instance is active
public ar co liveparticipant get participant int participant id for ar co liveparticipant participant participants if participant get participant descriptor get participant id participant id return participant return null
return a participant from participant group through its participant id
public void send multicast message ar co liveparticipant from string message this send data send multicast data from super participant group message
this method sends a multicast message of the chat through send data impl
public void send unicast message ar co liveparticipant to string message this send data send unicast data to super participant group message
this method sends a unicast message of the chat through send data impl
public void next init table get name position middle hand table get name position back hand table get name position fore hand
move players to the next position and deal new cards
private void close try if socket is connected out close in close socket close out null in null socket null catch ioexception e system err println error closing connection
close stream and socket
public void clear lock lock try read position 0 write position 0 mark position 0 output stream closed false input stream closed false finally lock unlock
make this buffer ready for reuse
public int get available lock lock try return available finally lock unlock
get number of bytes that are available to be read
public int get space left lock lock try return space left finally lock unlock
get the number of bytes this buffer has free for
public int get size lock lock try return buffer length finally lock unlock
get the capacity of this buffer
private int space left if write position read position any space between the first write and the mark except one byte is available in this case it is all in one piece return read position write position 1 space at the beginning and end return buffer length 1 write position read position
space available in the buffer which can be written
override public void close throws ioexception lock lock try input stream closed true not enought data to read signal finally lock unlock
close the stream
override public void mark int read ahead limit lock lock try if input stream closed throw new ioexception input stream has been closed cannot mark a closed input stream if buffer length 1 read ahead limit mark size read ahead limit mark position read position finally lock unlock
mark the present position in the stream
override public int read throws ioexception while true synchronized circular byte buffer this if input stream closed throw new ioexception input stream has been closed cannot read from a closed input stream int available circular byte buffer this available if available 0 int result buffer read position 0xff read position if read position buffer length read position 0 ensure mark return result else if output stream closed return 1 try thread sleep 100 catch exception x throw new ioexception blocking read operation interrupted throw new runtime exception not implemented
read a single byte
override public void reset throws ioexception lock lock try if input stream closed throw new ioexception input stream has been closed cannot reset a closed input stream read position mark position finally lock unlock
reset the stream
override public void close throws ioexception lock lock try if output stream closed flush output stream closed true finally lock unlock
close the stream flushing it first
public int get processed data final byte data final int offset if output size 0 return output size for int i 0 i output size i int dx offset i 1 data dx byte output data i 0xff data dx 1 byte output data i 8 0xff int size output size 2 output size 0 return size
pull the decoded data out into a byte array at the given offset
public long timestamp return this timestamp
if two sr packet have been received jlibrtp will attempt to calculate
public long rtp timestamp return this rtp timestamp
returns the rtp timestamp of all the packets in the frame
public int payload type return this payload type
returns the payload type of the packets
public boolean marked return this any marked
returns true if any packet in the frame was marked
public long ssrc return this ssrc
the ssrc associated with this frame
public void debug print logger finest rtcp pkt sdes debug print if participants null for int i 0 i participants length i participant part participants i logger finest part ssrc part ssrc part cname part cname part loc part loc else logger finest nothing to report only valid for received packets
debug purposes only
public int complete return this is complete
checks whether the difference in sequence numbers corresponds
public void debug print logger finest rtcp pkt rr debug print if reportees null for int i 0 i reportees length i participant part reportees i logger finest part ssrc part ssrc part cname part cname else for int i 0 i reportee ssrc length i logger finest reportee ssrc reportee ssrc i time stamp lsr time stamp lsr i
debug purposes only
public string get location return loc
location registered for this participant
protected void add packet rtcp pkt a pkt if logger is loggable level fine logger fine comp rtcp pkt add packet a pkt get class if a pkt problem 0 rtcp pkts add a pkt else this problem a pkt problem
add a rtcp packet to the compound packet
protected void make picture loss indication super item count 1 fmt
make this packet a picture loss indication
public string get priv return priv
private something registered for this participant
protected void make slice loss indication int sli first int sli number int sli picture id super item count 2 fmt this sli first sli first this sli number sli number this sli picture id sli picture id
make this packet a slice loss indication
protected void make ref picture sel indic int bit padding int payload type byte bit string super item count 3 fmt this rpsi padding bit padding this rpsi payload type payload type this rpsi bit string bit string
make this packet a reference picture selection indication
public long get ssrc return this ssrc
ssrc for participant determined through rtcp sdes
protected void make app layer feedback byte bit string super item count 15 fmt this alf bit string bit string
make this packet an application specific feedback message
private void dec picture loss indic if this rtp session rtcp avpfintf null this rtp session rtcp avpfintf psfbpkt picture loss received super ssrc
decode picture loss indication
protected long get ext high seq recv return 65536 seq roll over count last seq number
calculates the extended highest sequence received by adding
protected int get fraction lost int expected last seq number last srrseq number if expected 0 expected 65536 expected int fraction 256 expected received since last sr if expected 0 fraction fraction expected else fraction 0 clear counters received since last sr 0 last srrseq number last seq number last calculated fraction fraction return fraction
get the fraction of lost packets calculated as described
private void dec app layer fb byte a raw pkt int start application message fci variable length int string length super length 2 4 alf bit string new byte string length system arraycopy a raw pkt start alf bit string 0 string length if this rtp session rtcp avpfintf null this rtp session rtcp avpfintf psfbpkt app layer fbreceived super ssrc alf bit string
decode application specific feedback message
protected long get lost pkt count long lost this get ext high seq recv this first seq number received pkts if lost 0 lost 0 return lost
the total number of packets lost during the session
private void enc ref picture sel indic byte some bytes some bytes static procs u int int to byte word rpsi padding super raw pkt 8 some bytes 1 some bytes static procs u int int to byte word rpsi payload type super raw pkt 9 some bytes 1 system arraycopy rpsi bit string 0 super raw pkt 10 rpsi bit string length
encode a reference picture selection indication
protected void set time stamp lsr long ntp1 long ntp2 use what we ve got byte high static procs u int long to byte word ntp1 byte low static procs u int long to byte word ntp2 low 3 low 1 low 2 low 0 low 1 high 3 low 0 high 2 this time stamp lsr static procs bytes to uint long low 0
set the timestamp for last sender report
private void enc app layer fb application message fci variable length system arraycopy alf bit string 0 super raw pkt 8 alf bit string length
encode application layer feedback
protected long delay since last sr if this time received lsr 1 return 0 long delay system current time millis this time received lsr convert ms into 1 65536s 1 65 536ms return long double delay 65 536
calculate the delay between the last received sender report
protected int get fmt return this item count
get the fmt feedback message type
public void debug print string builder str new string builder str append participant debug print ssrc this ssrc cname this cname if this rtp address null str append rtp this rtp address to string if this rtcp address null str append rtcp this rtcp address to string logger finest str to string logger finest packets received this received pkts
only for debugging purposes
private int unfiltered add pkt pkt buf node new node if logger is loggable level finest logger finest pkt buffer unfiltered add pkt no magic just add to the end if oldest null new node next frame queue node newest newest prev frame queue node new node newest new node else oldest new node newest new node length return 0
adds packets in the same order that they arrive
private data frame unbuffered pop frame if oldest null pkt buf node ret node oldest pop frame queue cleanup ret node ret node seq num return new data frame ret node this p rtp session app intf frame size ret node pkt get payload type else return null
will return the oldest frame without checking whether it is in
private void pop frame queue cleanup pkt buf node ret node int highest seq if 1 length there s only one frame newest null oldest null else there are more frames oldest oldest prev frame queue node oldest next frame queue node null update counters length find the highest sequence number associated with this timestamp this last seq number highest seq this last timestamp ret node time stamp
cleans the packet buffer before returning the frame
protected void debug print logger finest rtcp pkt rtpfb debug print logger finest ssrc packet sender super ssrc ssrc media source ssrc media source if this pid null this pid length 1 logger finest no feedback control information fci fields for int i 0 i this pid length i logger finest fci pid pid i blp blp i logger finest rtcp pkt rtpfb debug print
debug purposes only
protected void start next delay 2500 rtp session random next int 1000 500 this calculate delay recv thrd new rtcpreceiver thread this this rtp session sender thrd new rtcpsender thread this this rtp session recv thrd start sender thrd start
starts the session calculates delays and fires up the threads
protected boolean pkt on time long time stamp int seq num if this last seq number 1 first packet return true else if seq num this last seq number if this last seq number 3 time stamp this last timestamp return false else if seq num 3 time stamp this last timestamp return false return true
checks whether a packet is not too late i
protected void send byes sender thrd send byes
send bye packets handled by rtcp sender thread
protected void calculate delay switch rtp session rtcp mode case 0 calculate regular delay break default logger warning rtcpsession calculate delay unknown mode
calculate the delay before the next rtcp packet can be sent
public int register rtpsession rtpapp intf rtp app rtcpapp intf rtcp app debug app intf debug app if registered logger info rtpsession register can t register another application return 1 else registered true generate seq num if logger is loggable level finest logger finest rtpsession register this app intf rtp app this rtcp app intf rtcp app this debug app intf debug app recv thrd new rtpreceiver thread this app caller thrd new app caller thread this rtp app recv thrd start app caller thrd start rtcp session start return 0
registers an application rtpapp intf with the rtp session
protected void debug print logger finest pkt buffer debug print length length ssrc ssrc last seq num last seq number pkt buf node tmp node oldest int i 0 while tmp node null string str tmp node time stamp to string logger finest i seq num tmp node seq num time stamp tmp node time stamp pkt count tmp node pkt count i tmp node tmp node prev frame queue node
prints out the packet buffer oldest node first on top
synchronized protected void update avg packet int length double temp avg double this avg pkt size temp avg 15 temp avg double length 16 this avg pkt size int temp avg
update the average packet size
synchronized protected void add to app queue long target ssrc rtcp pkt app a pkt a pkt time system current time millis if this app queue null this app queue new hashtable long linked list rtcp pkt app linked list rtcp pkt app ll this app queue get target ssrc if ll null no list create and add ll new linked list rtcp pkt app this app queue put target ssrc ll ll add a pkt
adds an rtcp app application packet to the queue
synchronized protected void clean app queue long ssrc if this app queue null return if ssrc 0 this app queue remove ssrc else enumeration linked list rtcp pkt app enu this app queue elements long cur time system current time millis while enu has more elements list iterator rtcp pkt app li enu next element list iterator while li has next rtcp pkt a pkt li next remove after 60 seconds if cur time a pkt time 60000 li remove
cleans the tcp app application packet queues of any packets that are
public int add participant participant p for now we make all participants added this way persistent p unexpected false return this part db add participant 0 p
add a participant object to the participant database
public void remove participant participant p part db remove participant p
remove a participant from the database
protected boolean fb send immediately if rtp session part db ssrc table size this rtp session fb early threshold rtp session part db receivers size this rtp session fb early threshold return false return true
check whether the conditions are satisfied to send a feedbkac packet immediately
protected boolean fb send early if rtp session part db ssrc table size this rtp session fb regular threshold rtp session part db receivers size this rtp session fb regular threshold return false return true
check whether the conditions are satisfied to send a feedbkac packet immediately
protected void wake sender thread long ssrc this fb waiting ssrc this sender thrd interrupt give it a chance to catch up try thread sleep 0 1 catch exception e
wake the sender thread because of this ssrc
public boolean is ending return this end session
check whether this session is ending
private int add participant multicast int came from participant p if came from 0 logger warning participant database add participant doesnt expect application to add participants to multicast session return 1 else check this one is not redundant if this ssrc table contains p ssrc logger info participant database add participant ssrc already known long to string p ssrc return 2 else this ssrc table put p ssrc p return 0
add a multicast participant to the database