Class CMSessionEvent
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe event ID for the request to add a blocking socket channel information.static final intThe event ID for the response to the request of adding a blocking socket channel information.static final intThe event ID for the request to add a non-blocking socket channel information.static final intThe event ID for the response to the request of adding a non-blocking socket channel information.static final intThe event ID for the notification of a user joining(changing) a session.static final intThe event ID for the request of deregistering a user from the default server.static final intThe event ID for the response to the request of deregistering a user from the default server.static final intThe event ID for the request of searching for a registered user from the default server.static final intThe event ID for the response to the request of searching for a registered user.static final intThe event ID for notifying the application of intentional disconnection from a remote node by CM.static final intThe event ID for the request of joining a session.static final intThe event ID for the response to the request of joining a session.static final intThe event ID for the request of leaving the current session.static final intstatic final intThe event ID for login request from a client to the default server.static final intThe event ID for response to the login request from the default server to the client.static final intThe event ID for logout request from a client to the default server.static final intThe event ID for the request of registering a new user from the default server.static final intThe event ID for the response to the request of registering a new user.static final intThe event ID for the request to remove a blocking socket channel information.static final intThe event ID for the response to the request of removing a blocking socket channel information.static final intThe event ID for requesting available session information from the default server.static final intThe event ID for the response to the request of available session information.static final intThe event ID for the notification of a new logged-in user.static final intThe event ID for the notification of the user logout.static final intThe event ID for a chat message of a client which has logged in to the server but does not join a session.static final intThe event ID for notifying the client of unexpected disconnection from a server.Fields inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
m_bytes, m_nByteNum, m_nID, m_strDistributionGroup, m_strDistributionSession, m_strHandlerGroup, m_strHandlerSession, m_strReceiver, m_strSender -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanfindGroupInfo(String gname) findSessionInfo(String sname) intReturns the current download mode of an image file attached to SNS content.protected intReturns the channel name.intReturns the channel index.Returns the communication architecture of the server.Returns the user registration date and time.Returns the current address.Returns the current group name.intReturns the current port number.Returns the list of CMGroupInfo objects.intReturns the number of groups.Returns the host IP address.intReturns the keep-alive time.Returns the password.intReturns the return code.Returns the list of CMSessionInfo objects.Returns the session name.intReturns the number of sessions.getTalk()Returns the chatting message.intReturns UDP port number.Returns the user name.intReturns if the new file-transfer scheme is on or off.intReturns if the server authenticates a user or not.intReturns if the server uses multiple sessions or not.intReturns if the user authentication has succeeded or not.protected voidvoidvoidbooleanremoveGroupInfo(String gname) booleanremoveSessionInfo(String sname) voidsetAttachDownloadScheme(int nScheme) voidsetChannelName(String name) voidsetChannelNum(int num) voidsetCommArch(String commArch) voidsetCreationTime(String time) voidsetCurrentAddress(String addr) voidsetCurrentGroupName(String gname) voidsetCurrentPort(int port) voidsetFileTransferScheme(int bFileTransferScheme) voidsetGroupNum(int num) voidsetHostAddress(String host) voidsetKeepAliveTime(int nSecond) voidsetLoginScheme(int bLoginScheme) voidsetPassword(String passwd) voidsetReturnCode(int code) voidsetSessionName(String sname) voidsetSessionNum(int num) voidsetSessionScheme(int bSessionScheme) voidvoidsetUDPPort(int port) voidsetUserName(String uname) voidsetValidUser(int bValid) protected voidunmarshallBody(ByteBuffer msg) Methods inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
allocate, equals, getDistributionGroup, getDistributionSession, getHandlerGroup, getHandlerSession, getID, getInt2BytesFromByteBuffer, getReceiver, getSender, getStringFromByteBuffer, marshall, marshallHeader, putInt2BytesToByteBuffer, putStringToByteBuffer, setByteNum, setDistributionGroup, setDistributionSession, setHandlerGroup, setHandlerSession, setID, setReceiver, setSender, toString, unmarshall, unmarshallHeader
-
Field Details
-
LOGIN
public static final int LOGINThe event ID for login request from a client to the default server.event direction: client -> default server
The LOGIN event is sent when the client calls
CMClientStub.loginCM(String, String)orCMClientStub.syncLoginCM(String, String).
The following fields are used for this event:- user name :
getUserName() - password :
getPassword() - host address :
getHostAddress() - UDP port of the user :
getUDPPort() - keep-alive time of the user :
getKeepAliveTime()
- See Also:
- user name :
-
LOGOUT
public static final int LOGOUTThe event ID for logout request from a client to the default server.event direction: client -> default server
The LOGOUT event is sent when the client calls
CMClientStub.logoutCM().
The following field is used for this event:- user name:
getUserName()
- See Also:
- user name:
-
LOGIN_ACK
public static final int LOGIN_ACKThe event ID for response to the login request from the default server to the client.event direction: default server -> client
The default server sends the LOGIN_ACK event to the client as the response to the
LOGINevent.
The following fields are used for this event:- response code:
isValidUser()
1: valid user, 0: invalid user - communication architecture:
getCommArch()
CM_CS: This CM network is client-server model
CM_PS: This CM network is peer-server model - file-transfer scheme:
isFileTransferScheme()
1: to use a separate channel and thread to transfer a file
0: to use the default socket channel to transfer a file - login scheme:
isLoginScheme()
1: The default server authenticates the requesting user
0: The default server does not authenticates the requesting user - session scheme:
isSessionScheme()
1: The login user should select and join a session.
0: The login user automatically joins a default session. - download scheme of attached files in SNS content:
getAttachDownloadScheme()
0: full mode, 1: partial mode, 2: prefetch mode, 3: none - server UDP port:
getUDPPort()
- See Also:
- response code:
-
REQUEST_SESSION_INFO
public static final int REQUEST_SESSION_INFOThe event ID for requesting available session information from the default server.event direction: client -> default server
The REQUEST_SESSION_INFO event is sent when the client calls
CMClientStub.requestSessionInfo().
The following field is used for this event:- user name:
getUserName()
- See Also:
- user name:
-
RESPONSE_SESSION_INFO
public static final int RESPONSE_SESSION_INFOThe event ID for the response to the request of available session information.event direction: default server -> client
The RESPONSE_SESSION_INFO event is the reply of the
REQUEST_SESSION_INFOevent.
The following fields are used for this event:- number of sessions:
getSessionNum() - list of session information:
getSessionInfoList()
- See Also:
- number of sessions:
-
JOIN_SESSION
public static final int JOIN_SESSIONThe event ID for the request of joining a session.event direction: client -> default server
The JOIN_SESSION event is sent when the client calls
CMClientStub.joinSession(String)andCMClientStub.syncJoinSession(String).
The following fields are used for this event:- user name :
getUserName() - session name :
getSessionName()
- See Also:
- user name :
-
JOIN_SESSION_ACK
public static final int JOIN_SESSION_ACKThe event ID for the response to the request of joining a session.event direction: default session -> client
The JOIN_SESSION_ACK event is the reply of the
JOIN_SESSIONevent.
The following fields are used for this event:- number of groups:
getGroupNum() - list of group information:
getGroupInfoList()
- See Also:
- number of groups:
-
LEAVE_SESSION
public static final int LEAVE_SESSIONThe event ID for the request of leaving the current session.event direction: client -> default server
The LEAVE_SESSION event is sent when the client calls
CMClientStub.leaveSession().
The following fields are used for this event:- user name:
getUserName() - session name:
getSessionName()
- See Also:
- user name:
-
LEAVE_SESSION_ACK
public static final int LEAVE_SESSION_ACK- See Also:
-
SESSION_TALK
public static final int SESSION_TALKThe event ID for a chat message of a client which has logged in to the server but does not join a session.event direction: client -> server -> client
The SESSION_TALK event is sent when the client calls
CMClientStub.chat(String, String).
The following fields are used for this event:- user name:
getUserName() - chat message:
getTalk()
- See Also:
- user name:
-
SESSION_ADD_USER
public static final int SESSION_ADD_USERThe event ID for the notification of a new logged-in user.event direction: default server -> client
The default server sends the SESSION_ADD_USER event to the existing users to notify them of a new logged-in user.
The following fields are used for this event:- user name:
getUserName() - host address:
getHostAddress() - user's current session name:
getSessionName()
- See Also:
- user name:
-
SESSION_REMOVE_USER
public static final int SESSION_REMOVE_USERThe event ID for the notification of the user logout.event direction: default server -> client
The default server sends the SESSION_REMOVE_USER event to the existing users to notify that a user has logged out from the default server.
The following fields are used for this event:- user name:
getUserName()
- See Also:
- user name:
-
CHANGE_SESSION
public static final int CHANGE_SESSIONThe event ID for the notification of a user joining(changing) a session.event direction: default server -> client
The default server sends the CHANGE_SESSION event to the existing users to notify that a user has joined a session.
The following fields are used for this event:- user name:
getUserName() - session name:
getSessionName()
- See Also:
- user name:
-
ADD_NONBLOCK_SOCKET_CHANNEL
public static final int ADD_NONBLOCK_SOCKET_CHANNELThe event ID for the request to add a non-blocking socket channel information.event direction: client -> server
The ADD_NONBLOCK_SOCKET_CHANNEL is sent when the client calls
CMClientStub.addNonBlockSocketChannel(int, String)orCMClientStub.syncAddNonBlockSocketChannel(int, String).
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>0) for the socket channel.
- See Also:
- channel name:
-
ADD_NONBLOCK_SOCKET_CHANNEL_ACK
public static final int ADD_NONBLOCK_SOCKET_CHANNEL_ACKThe event ID for the response to the request of adding a non-blocking socket channel information.event direction: server -> client
The ADD_NONBLOCK_SOCKET_CHANNEL_ACK event is the reply of the
ADD_NONBLOCK_SOCKET_CHANNELevent.
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>0) for the socket channel. - return code:
getReturnCode()
0: channel addition at the server has completed.
other value: channel addition at the server has failed.
- See Also:
- channel name:
-
ADD_BLOCK_SOCKET_CHANNEL
public static final int ADD_BLOCK_SOCKET_CHANNELThe event ID for the request to add a blocking socket channel information.event direction: client -> server
event direction: client -> client in the p2p file transferThe ADD_BLOCK_SOCKET_CHANNEL is sent when the client calls
CMClientStub.addBlockSocketChannel(int, String)orCMClientStub.syncAddBlockSocketChannel(int, String).
A file sender client also can send this event to a file receiver client to make a dedicated channel if the FILE_TRANSFER_SCHEME field is set to 1 in the server CM configuration file (cm-server.conf).
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>=0) for the socket channel.
- See Also:
- channel name:
-
ADD_BLOCK_SOCKET_CHANNEL_ACK
public static final int ADD_BLOCK_SOCKET_CHANNEL_ACKThe event ID for the response to the request of adding a blocking socket channel information.event direction: server -> client
The ADD_BLOCK_SOCKET_CHANNEL_ACK event is the reply of the
ADD_BLOCK_SOCKET_CHANNELevent.
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>=0) for the socket channel. - return code:
getReturnCode()
0: channel addition at the server has completed.
other value: channel addition at the server has failed.
- See Also:
- channel name:
-
REMOVE_BLOCK_SOCKET_CHANNEL
public static final int REMOVE_BLOCK_SOCKET_CHANNELThe event ID for the request to remove a blocking socket channel information.event direction: client -> server
event direction: client -> client in the p2p file transferThe REMOVE_BLOCK_SOCKET_CHANNEL is sent when the client calls
CMClientStub.removeBlockSocketChannel(int, String), orCMClientStub.syncRemoveBlockSocketChannel(int, String).
A file sender or receiver client also can send this event to finish or cancel the file transfer with a dedicated channel if the FILE_TRANSFER_SCHEME field is set to 1 in the server CM configuration file (cm-server.conf).
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>=0) for the socket channel.
- See Also:
- channel name:
-
REMOVE_BLOCK_SOCKET_CHANNEL_ACK
public static final int REMOVE_BLOCK_SOCKET_CHANNEL_ACKThe event ID for the response to the request of removing a blocking socket channel information.event direction: server -> client
The REMOVE_BLOCK_SOCKET_CHANNEL_ACK event is the reply of the
REMOVE_BLOCK_SOCKET_CHANNELevent.
The following fields are used for this event:- channel name:
getChannelName()
The name of a server to which the client establishes a connection. - channel index:
getChannelNum()
the index(>=0) for the socket channel. - return code:
getReturnCode()
0: the channel has been removed successfully.
other value: channel removal at the server has failed.
- See Also:
- channel name:
-
REGISTER_USER
public static final int REGISTER_USERThe event ID for the request of registering a new user from the default server.event direction: client -> default server
The REGISTER_USER event is sent when the client calls
CMClientStub.registerUser(String, String).
The following fields are used for this event:- user name:
getUserName() - password:
getPassword()
- See Also:
- user name:
-
REGISTER_USER_ACK
public static final int REGISTER_USER_ACKThe event ID for the response to the request of registering a new user.event direction: default server -> client
The REGISTER_USER_ACK event is the reply of the
REGISTER_USERevent.
The following fields are used for this event:- return code:
getReturnCode()
1: registration success.
0: registration failed. - user name:
getUserName() - registration date and time:
getCreationTime()
- See Also:
- return code:
-
DEREGISTER_USER
public static final int DEREGISTER_USERThe event ID for the request of deregistering a user from the default server.event direction: client -> default server
The DEREGISTER_USER event is sent when the client calls
CMClientStub.deregisterUser(String, String).
The following fields are used for this event:- user name:
getUserName() - password:
getPassword()
- See Also:
- user name:
-
DEREGISTER_USER_ACK
public static final int DEREGISTER_USER_ACKThe event ID for the response to the request of deregistering a user from the default server.event direction: default server -> client
The DEREGISTER_USER_ACK event is the reply of the
DEREGISTER_USERevent.
The following fields are used for this event:- return code:
getReturnCode()
0: deregistration failed
1: deregistration success - user name:
getUserName()
- See Also:
- return code:
-
FIND_REGISTERED_USER
public static final int FIND_REGISTERED_USERThe event ID for the request of searching for a registered user from the default server.event direction: client -> default server
The FIND_REGISTERED_USER event is sent when the client calls
CMClientStub.findRegisteredUser(String).
The following field is used for this event:- user name:
getUserName()
- See Also:
- user name:
-
FIND_REGISTERED_USER_ACK
public static final int FIND_REGISTERED_USER_ACKThe event ID for the response to the request of searching for a registered user.event direction: default server -> client
The FIND_REGISTERED_USER_ACK event is the reply of the
FIND_REGISTERED_USERevent.
The following fields are used for this event:- return code:
getReturnCode()
0: user not found
1: user found - user name:
getUserName() - registration date and time:
getCreationTime()
- See Also:
- return code:
-
UNEXPECTED_SERVER_DISCONNECTION
public static final int UNEXPECTED_SERVER_DISCONNECTIONThe event ID for notifying the client of unexpected disconnection from a server.event direction: client CM -> client application (local event)
The client CM delivers the UNEXPECTED_SERVER_DISCONNECTION event to its application when it detects the disconnection from a server CM.
The following fields are used for this event:- channel name:
getChannelName()
name of disconnected server. - channel index:
getChannelNum()
index of the disconnected non-blocking socket channel.
- See Also:
- channel name:
-
INTENTIONALLY_DISCONNECT
public static final int INTENTIONALLY_DISCONNECTThe event ID for notifying the application of intentional disconnection from a remote node by CM.event direction: CM -> application (local event)
CM delivers the INTENTIONALLY_DISCONNECT event to its application when it disconnects a problematic non-blocking socket channel. A non-blocking socket channel is regarded as problematic if
(1) CM receives a malformed CM event.
(2) the server keep-alive task enables and it detects the expiration of the keep-alive time of the channel. The server CM enables the keep-alive task if the KEEP_ALIVE_TIME field of the configuration file is set to a value greater than 0.The following fields are used for this event:
- channel name:
getChannelName()
name of remote node with the problematic socket channel disconnected by the local CM. - channel index:
getChannelNum()
index of the problematic non-blocking socket channel disconnected by the local CM.
- See Also:
- channel name:
-
-
Constructor Details
-
CMSessionEvent
public CMSessionEvent() -
CMSessionEvent
-
-
Method Details
-
setHostAddress
-
getHostAddress
Returns the host IP address.- Returns:
- the IP address.
-
setUDPPort
public void setUDPPort(int port) -
getUDPPort
public int getUDPPort()Returns UDP port number.- Returns:
- UDP port number.
-
setPassword
-
getPassword
Returns the password.- Returns:
- password.
-
setUserName
-
getUserName
Returns the user name.- Returns:
- user name.
-
setValidUser
public void setValidUser(int bValid) -
isValidUser
public int isValidUser()Returns if the user authentication has succeeded or not.- Returns:
- 1 if the user is authenticated; 0 otherwise.
-
setSessionName
-
getSessionName
Returns the session name.- Returns:
- session name.
-
setCommArch
-
getCommArch
Returns the communication architecture of the server.- Returns:
- communication architecture.
"CM_CS" or "CM_PS".
-
setFileTransferScheme
public void setFileTransferScheme(int bFileTransferScheme) -
isFileTransferScheme
public int isFileTransferScheme()Returns if the new file-transfer scheme is on or off.- Returns:
- 1 if the new file-transfer scheme is on; 0 otherwise.
-
setLoginScheme
public void setLoginScheme(int bLoginScheme) -
isLoginScheme
public int isLoginScheme()Returns if the server authenticates a user or not.- Returns:
- 1 if the user authentication is used; 0 otherwise.
-
setSessionScheme
public void setSessionScheme(int bSessionScheme) -
isSessionScheme
public int isSessionScheme()Returns if the server uses multiple sessions or not.- Returns:
- 1 if multiple sessions are used; 0 otherwise.
-
setAttachDownloadScheme
public void setAttachDownloadScheme(int nScheme) -
getAttachDownloadScheme
public int getAttachDownloadScheme()Returns the current download mode of an image file attached to SNS content.- Returns:
- the download mode.
0: full (original image)
1: partial (thumbnail image)
2: prefetch (prefetch original image)
3: none (text information)
-
setReturnCode
public void setReturnCode(int code) -
getReturnCode
public int getReturnCode()Returns the return code.- Returns:
- 1 for successful return code; 0 otherwise.
-
setTalk
-
getTalk
Returns the chatting message.- Returns:
- chatting message.
-
setCurrentGroupName
-
getCurrentGroupName
Returns the current group name.- Returns:
- the current group name.
-
setCurrentAddress
-
getCurrentAddress
Returns the current address.- Returns:
- the current address.
-
setCurrentPort
public void setCurrentPort(int port) -
getCurrentPort
public int getCurrentPort()Returns the current port number.- Returns:
- the current port number.
-
setChannelName
-
getChannelName
Returns the channel name.- Returns:
- the channel name.
-
setChannelNum
public void setChannelNum(int num) -
getChannelNum
public int getChannelNum()Returns the channel index.- Returns:
- the channel index.
-
setSessionNum
public void setSessionNum(int num) -
getSessionNum
public int getSessionNum()Returns the number of sessions.- Returns:
- the number of sessions.
-
setGroupNum
public void setGroupNum(int num) -
getGroupNum
public int getGroupNum()Returns the number of groups.- Returns:
- the number of groups.
-
setCreationTime
-
getCreationTime
Returns the user registration date and time.- Returns:
- the user registration date and time.
-
setKeepAliveTime
public void setKeepAliveTime(int nSecond) -
getKeepAliveTime
public int getKeepAliveTime()Returns the keep-alive time.- Returns:
- the keep-alive time.
-
addSessionInfo
-
removeSessionInfo
-
removeAllSessionInfoObjects
public void removeAllSessionInfoObjects() -
findSessionInfo
-
getSessionInfoList
Returns the list of CMSessionInfo objects.- Returns:
- the list of CMSessionInfo objects.
-
addGroupInfo
-
removeGroupInfo
-
removeAllGroupInfoObjects
public void removeAllGroupInfoObjects() -
findGroupInfo
-
getGroupInfoList
Returns the list of CMGroupInfo objects.- Returns:
- the list of CMGroupInfo objects.
-
getByteNum
protected int getByteNum()- Overrides:
getByteNumin classCMEvent
-
marshallBody
protected void marshallBody()- Specified by:
marshallBodyin classCMEvent
-
unmarshallBody
- Specified by:
unmarshallBodyin classCMEvent
-