- Inherits from:
- Object
- Declared in:
- DTelNetClient.h
Object
|
+---DTelNetClient
Class Description
The DTelNetClient class implements a telnet client. The class supports
negotiation of options. Also subnegotiation is supported. There is not
yet support for interrupt sending.
- Last modified:
- 31-Oct-2007 (DTelNetClient.h)
Instance Variables
- private DSocket *_client
- the client socket
- private BOOL _connected
- is the client connected ?
- private int _options[DTNC_OPTIONS]
- the negotiated state op the options
- private DData *_request
- the request to be sent to the server
- Constructors
- - (DTelNetClient *) init
- Initialise the telnet client
- Returns:
- the object
- Deconstructor
- - free
- Free the telnet client object
- Returns:
- the object
- Copy related methods
- - shallowCopy
- Do a shallow copy of the object (not implemented)
- Class methods
- + (const char *) commandToString :(unsigned char) command
- Return a string describing a command
- Parameters:
- command - the command
- Returns:
- the describing string (or NULL)
- + (const char *) optionToString :(int) option
- Return a string describing an option
- Parameters:
- option - the option
- Returns:
- the describing string (or NULL)
- Member methods
- - (BOOL) isConnected
- Check if there is a connection
- Returns:
- is there a connection with the server ?
- - (BOOL) option :(int) who :(int) option
- Check the state of an option (for the server or client)
- Parameters:
- who - the side (DTNC_SERVER or DTNC_CLIENT)
option - the option to be checked
- Returns:
- the state
- - (DSocket *) socket
- Return the local client socket object
- Returns:
- a reference to the client socket object
- Connection methods
- - (BOOL) close
- Close the connection to the telnet server
- Returns:
- success
- - (BOOL) open :(id <DSocketAddressable>) server
- Open the connection to the telnet server
- Parameters:
- server - the telnet server
- Returns:
- success
- Sending methods
- - (BOOL) AYT
- Put Are You There in the send buffer
- Returns:
- success
- - (BOOL) pendingNegotiations
- Check if there are pending negotiations with the server
- Returns:
- are there ?
- - (BOOL) pendingRequests
- Check if the send buffer has pending messages (requests or responses)
- Returns:
- are there ?
- - (BOOL) requestOpenNegotiation :(int) who :(int) option :(BOOL) state
- Put the open negotiation for an option message request in the send buffer.
- Parameters:
- who - the side the option has to implement (DTNC_SERVER, DTNC_CLIENT)
option - the option to be negotiated
state - the state for the option
- Returns:
- success
- - (BOOL) requestSubNegotiation :(int) option
- Put the request for Sub Negotiation message in the send buffer
- Parameters:
- option - the option to be requested
- Returns:
- success
- - (BOOL) respondNegotiation :(int) who :(int) option :(BOOL) accepted
- Put the negotiation response message in the request buffer.
- Parameters:
- who - the side that implements the option
option - the option
accepted - is the option accepted ?
- Returns:
- success
- - (BOOL) respondSubNegotiation :(int) option :(unsigned char *) data :(int) length
- Put the resonse Sub Negotiation message in the send buffer
- Parameters:
- option - the option to be responded
data - the data for the sub negotiation
length - the length of the data
- Returns:
- success
- - (BOOL) sendText :(const unsigned char *) text
- Put (normal) text in the send buffer and send the buffer to the server
- Parameters:
- text - the text for the server (or NULL)
- Returns:
- success
- Receiving methods
- - (BOOL) processOpenNegotiation :(int) who :(int) option :(int) state
- Process the receiving of the open negotiation request from the server (to be overridden, default: not supported)
- Parameters:
- who - the side that implements the option (DTNC_SERVER, DTNC_CLIENT)
option - the option to be negotiated
state - the suggested state for the option
- Returns:
- is the option supported ?
- - (BOOL) processRequestSubNegotiation :(int) option
- Process the request for a sub negotiation from the server. Use
sendResponseSubNegotiation to reply to this request (to be overridden)
- Parameters:
- option - the option in the request for sub negotiation
- Returns:
- success
- - (BOOL) processResponseNegotiation :(int) who :(int) option :(BOOL) accepted
- Process the receiving of an accepted negotiation response from the server (to be overridden)
- Parameters:
- who - the side that implements the option (DTNC_SERVER, DTNC_CLIENT)
option - the option that is negotiated with the server
accepted - is the option accepted ?
- Returns:
- success
- - (BOOL) processResponseSubNegotiation :(int) option :(const unsigned char *) data :(int) length
- Process the response for a sub negotiation from the server (to be overridden)
- Parameters:
- option - the option that was sub negotiated
data - the data of the sub negotiation
length - the length of the data
- Returns:
- success
- - (BOOL) processSpecialCommand :(unsigned char) command
- Process the receiving of a special command (to be overridden)
- Parameters:
- command - the received (telnet) command
- Returns:
- success
- - (DData *) receive
- Wait (blocking) for a response of the server. Depending on the contents of
the response, the methods processOpenNegotiation, processSubNegotiation
and/or processSpecialCommand will be called.
negotiations, nil for error)
- Returns:
- a (new) DData object with the received data (without the (sub)
- - (BOOL) receive :(DData *) response
- Wait (blocking) for a response of the server. Depending on the contents of
the response, the methods processOpenNegotiation, processSubNegotiation
and/or processSpecialCommand will be called. The remaining data will be
placed in the response object.
- Parameters:
- response - the DData object to be filled with the received data
- Returns:
- success
generated 05-Nov-2007 by ObjcDoc 3.0.0