public class AIMConnection extends Thread
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
AIMConnection(AIMSession sess,
int type,
String dest)
Creates a new AIM connection.
|
AIMConnection(AIMSession sess,
int type,
String dest,
ProxyConnection pc)
Creates a new AIM connection with a proxy.
|
Modifier and Type | Method and Description |
---|---|
void |
addCookie(MsgCookie cookie)
Add a message cookie for this session.
|
void |
addGroup(int version)
Add a group for this connection.
|
void |
addRate(RateClass rate)
Adds a rate to this connection.
|
int |
cleanCookies(int maxAge)
Clean message cookies.
|
int |
cleanSNACs(int maxAge)
Clean the SNAC hash table.
|
void |
close()
Close a connection.
|
void |
connect()
Connects to the ip:port specified in dest.
|
static void |
connKill(AIMSession sess)
Closes all connections in the guven session.
|
void |
deregisiterListener(int family,
int subtype,
Listener listener)
Remove a listener for this connection.
|
void |
enqueueFrame(AIMFrame frame)
Push a frame onto the transmit queue.
|
static AIMConnection |
findByGroup(AIMSession sess,
int group)
Find a connection that supports the given SNAC group.
|
static AIMConnection |
findByType(AIMSession sess,
int type)
Finds the first connection of a given type belonging to this session.
|
RateClass |
findRate(int classID)
Find a rate by the guven class ID.
|
RateClass |
findRate(int family,
int subtype)
Find a rate by a given SNAC family and SNAC subtype.
|
int |
getFlags()
Get the value of flags.
|
long |
getForcedLatency()
Get value of forcedLatency.
|
ArrayList |
getGroups()
Get the value of groups.
|
String |
getHost()
Get the value of host.
|
Hashtable |
getICQHashtable()
Get the value of ihash.
|
InputStream |
getInputStream()
Get the value of is.
|
Object |
getInternal()
Get value of interbal.
|
long |
getLastActivity()
Get value of lastActivity.
|
Iterator |
getListeners(int family,
int subtype)
Get the connection listeners for the given SNAC family.
|
ArrayList |
getMembers()
Get the value of members.
|
HashMap |
getMsgCookies()
Get the value of msgCookies.
|
OutputStream |
getOutputStream()
Get the value of os.
|
int |
getPort()
Get the value of port.
|
ArrayList |
getRates()
Gets the value of rates.
|
Queue |
getReceiveQueue()
Get the value of receiveQueue.
|
int |
getRetries()
Get the value of retries.
|
int |
getRetryTime()
Get the value of retryTime.
|
AIMSession |
getSess()
Get the value of sess.
|
Socket |
getSocket()
Get the value of socket.
|
int |
getSubtype()
Get the value of subtype.
|
Queue |
getTransmitQueue()
Get the value of transmitQueue.
|
int |
getType()
Get the value of type.
|
boolean |
isInSess(AIMSession sess)
Determines whether this connection belongs to the given sesion.
|
static void |
killAllInSess(AIMSession sess)
Kills all connections belonging to this session.
|
void |
logOff(AIMSession sess)
Log off of this connection.
|
ListenerEntry |
lookupListenerEntry(int family,
int subtype)
Look up a listener entry for this connection.
|
ListenerEntry |
lookupListenerEntryCreate(int family,
int subtype)
Look up a listener entry for this connection.
|
int |
nextId()
Get the next SNAC ID.
|
int |
nextMsgId()
Get the next Msg ID.
|
int |
nextPacketId()
Get the next ICQ Packet ID.
|
int |
nextSeq()
Get the next FLAP sequence number.
|
SNAC |
peekSNAC(int id)
Peek at a SNAC in the SNAC hash table.
|
void |
registerListener(int family,
int subtype,
Listener listener)
Add the given listener to the given listener entry family for this
connection.
|
MsgCookie |
remCookie(MsgCookie cookie)
Remove a message cookie for this session.
|
SNAC |
remSNAC(int id)
Remove a SNAC from the SNAC hash table.
|
void |
run()
The run method for this connection.
|
void |
sendFrame(AIMFrame frame)
Send a frame over the socket.
|
void |
sendSignoff(AIMConnection conn)
Send a sign off.
|
void |
setFlags(int flags)
Set the value of flags.
|
void |
setForcedLatency(long forcedLatency)
Set value of forcedLatency.
|
void |
setGroups(ArrayList groups)
Set the value of groups.
|
void |
setHost(String host)
Set the value og host.
|
void |
setInternal(Object internal)
Set value of internal.
|
void |
setLastActivity(long lastActivity)
Set the value of lastActivity.
|
void |
setPort(int port)
Set the value of port.
|
void |
setRetries(int retries)
Set the value of retries.
|
void |
setRetryTime(int retryTime)
Set the value of retryTime.
|
void |
setSocket(Socket socket)
Set the value of socket.
|
void |
setSubtype(int subtype)
Set the value of subtype.
|
void |
setType(int type)
Set the value of type.
|
boolean |
supportsGroup(int group)
Find if a given group is supported by this connection.
|
void |
updateRate(int classID)
Update the rate with the given class ID.
|
void |
updateRate(int family,
int subtype)
Update the rate with the given SNAC family and subtype.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public AIMConnection(AIMSession sess, int type, String dest, ProxyConnection pc)
sess
- the oscar sessiontype
- the type of connectiondest
- the destination ip:port as a stringpc
- ProxyConnectionpublic AIMConnection(AIMSession sess, int type, String dest)
sess
- the oscar sessiontype
- the type of connectiondest
- the destination ip:port as a stringpublic int nextSeq()
public int nextId()
public int nextPacketId()
public int nextMsgId()
public int getRetries()
public void setRetries(int retries)
retries
- Value to assign to retries.public void connect() throws IOException
IOException
- if an error occurspublic ArrayList getMembers()
public void addGroup(int version)
version
- the group versionpublic ArrayList getGroups()
public void setGroups(ArrayList groups)
groups
- Value to assign to groupspublic boolean supportsGroup(int group)
group
- the grouppublic static AIMConnection findByGroup(AIMSession sess, int group)
sess
- the oscar sessiongroup
- the SNAC grouppublic boolean isInSess(AIMSession sess)
sess
- the oscar sessionpublic static void killAllInSess(AIMSession sess)
sess
- the oscar sessionpublic ArrayList getRates()
public void addRate(RateClass rate)
rate
- the rate to addpublic RateClass findRate(int classID)
classID
- the class IDpublic RateClass findRate(int family, int subtype)
family
- the SNAC familysubtype
- the SNAC subtypepublic InputStream getInputStream()
public OutputStream getOutputStream()
public String getHost()
public void setHost(String host)
host
- Value to assign to host.public int getPort()
public void setPort(int port)
port
- Value to assign to port.public int getType()
public void setType(int type)
type
- Value to assign to type.public static void connKill(AIMSession sess)
sess
- the oscar session.public void sendSignoff(AIMConnection conn) throws IOException
conn
- the bos connection for this sessionIOException
- if an error occurspublic void close()
public Queue getTransmitQueue()
public Queue getReceiveQueue()
public void run()
public void sendFrame(AIMFrame frame) throws IOException
frame
- the frame to sendIOException
- if an error occurspublic void enqueueFrame(AIMFrame frame)
frame
- the frame to enqueuepublic ListenerEntry lookupListenerEntry(int family, int subtype)
family
- the SNAC familysubtype
- the SNAC subtypepublic ListenerEntry lookupListenerEntryCreate(int family, int subtype)
family
- the SNAC familysubtype
- the SNAC subtypepublic void registerListener(int family, int subtype, Listener listener)
family
- the SNAC familysubtype
- the SNAC subtypelistener
- the SNAC listenerpublic void deregisiterListener(int family, int subtype, Listener listener)
family
- the SNAC familysubtype
- the SNAC subtypelistener
- the SNAC listenerpublic Iterator getListeners(int family, int subtype)
family
- the SNAC familysubtype
- the SNAC subtypepublic SNAC peekSNAC(int id)
id
- the SNAC ID to look forpublic SNAC remSNAC(int id)
id
- the SNAC IDpublic int cleanSNACs(int maxAge)
maxAge
- maximum age of the SNAC's in secondspublic void logOff(AIMSession sess)
sess
- the oscar sessionpublic int getFlags()
public void setFlags(int flags)
flags
- Value to assign to flags.public Socket getSocket()
public void setSocket(Socket socket)
socket
- Value to assign to socket.public Object getInternal()
public void setInternal(Object internal)
internal
- Value to assign to internal.public long getLastActivity()
public void setLastActivity(long lastActivity)
lastActivity
- Value to assign to lastActivity.public long getForcedLatency()
public void setForcedLatency(long forcedLatency)
forcedLatency
- Value to assign to forcedLatency.public int getSubtype()
public void setSubtype(int subtype)
subtype
- Value to assign to subtype.public void updateRate(int classID)
classID
- the class IDpublic void updateRate(int family, int subtype)
family
- the SNAC familysubtype
- the SNAC subtypepublic int getRetryTime()
public void setRetryTime(int retryTime)
retryTime
- Value to assign to retryTime.public AIMSession getSess()
public Hashtable getICQHashtable()
public HashMap getMsgCookies()
public void addCookie(MsgCookie cookie)
cookie
- the message cookie to addpublic MsgCookie remCookie(MsgCookie cookie)
cookie
- the MessageCookie to remove.public int cleanCookies(int maxAge)
maxAge
- max age before cleaning the cookiepublic static AIMConnection findByType(AIMSession sess, int type)
sess
- the oscar sessiontype
- the type