net.kano.joscar.rvcmd.getfile
Class GetFileReqRvCmd

java.lang.Object
  extended byRvCommand
      extended byAbstractRvCmd
          extended byAbstractRequestRvCmd
              extended byGetFileReqRvCmd

public class GetFileReqRvCmd
extends AbstractRequestRvCmd

A rendezvous command used to request browsing another user's files via a "Get File" connection. This command is also used to "redirect" a Get File connection to a new TCP "location" should a connection attempt as per the initial request's connection information block fail.

Note that several fields of this command are not yet understood:


Field Summary
static java.lang.String CHARSET_DEFAULT
          A charset value used in Get File requests by WinAIM regardless of file content or platform.
static int CODE_DEFAULT
          The "code" value always used by WinAIM.
static ByteBlock EXTRABLOCK_DEFAULT
          An "extra data block" used by WinAIM 5.2.
static long FLAG_EXPAND_DYNAMIC
          A flag used to indicate that the user's entire shared file list should not be listed recursively on connect but rather only a single directory, with subdirectories being listed dynamically as they are viewed by the user.
static int PROTOVERSION_DEFAULT
          The "protocol version" used by WinAIM 5.2 beta.
static int PROTOVERSION_OLD
          The "protocol version" used by WinAIM 5.1.* and older.
 
Fields inherited from class AbstractRequestRvCmd
FPRESENT_DEFAULT, REQTYPE_INITIALREQUEST, REQTYPE_REDIRECT
 
Fields inherited from class RvCommand
RVSTATUS_ACCEPT, RVSTATUS_DENY, RVSTATUS_REQUEST
 
Constructor Summary
GetFileReqRvCmd(int requestType, RvConnectionInfo connInfo)
          Creates a new outgoing Get File session request / redirect with the given request type and the given connection information block.
GetFileReqRvCmd(int requestType, RvConnectionInfo connInfo, java.lang.String charset, int code, int protoVersion, long flags, ByteBlock extraBlock)
          Creates a new outgoing Get File session request / redirect (depending on requestType) with the given properties.
GetFileReqRvCmd(RecvRvIcbm icbm)
          Creates a new Get File session request from the given incoming Get File request RV ICBM.
GetFileReqRvCmd(RvConnectionInfo connInfo)
          Creates a new outgoing initial Get File session request with the given connection information block and a default set of other properties.
GetFileReqRvCmd(RvConnectionInfo connInfo, long flags)
          Creates a new outgoing initial Get File session request with the given connection information block and set of flags as well as a default set of other properties.
 
Method Summary
 java.lang.String getCharset()
          Returns the charset name sent in this request.
 int getCode()
          Returns the "code" value sent in this request.
 RvConnectionInfo getConnInfo()
          Returns the connection information block sent in this request/redirection.
 ByteBlock getExtraBlock()
          Returns this request's "extra data block" value.
 long getFlags()
          Returns the bit flags sent in this request.
 int getProtoVersion()
          Returns the "protocol version" value sent in this command.
protected  boolean hasServiceData()
          Returns whether this RV command's TLV list should contain a "service data block" TLV.
 java.lang.String toString()
           
protected  void writeRvTlvs(java.io.OutputStream out)
          Writes this RV command's list of rendezvous TLV's to the given stream.
protected  void writeServiceData(java.io.OutputStream out)
          Writes this RV command's "service data block."
 
Methods inherited from class AbstractRequestRvCmd
getRequestType, isFPresent, writeHeaderRvTlvs
 
Methods inherited from class AbstractRvCmd
getRvTlvs, getServiceData, writeRvData
 
Methods inherited from class RvCommand
getCapabilityBlock, getRvStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHARSET_DEFAULT

public static final java.lang.String CHARSET_DEFAULT
A charset value used in Get File requests by WinAIM regardless of file content or platform.

See Also:
Constant Field Values

CODE_DEFAULT

public static final int CODE_DEFAULT
The "code" value always used by WinAIM.

See Also:
Constant Field Values

PROTOVERSION_DEFAULT

public static final int PROTOVERSION_DEFAULT
The "protocol version" used by WinAIM 5.2 beta.

See Also:
Constant Field Values

PROTOVERSION_OLD

public static final int PROTOVERSION_OLD
The "protocol version" used by WinAIM 5.1.* and older.

See Also:
Constant Field Values

FLAG_EXPAND_DYNAMIC

public static final long FLAG_EXPAND_DYNAMIC
A flag used to indicate that the user's entire shared file list should not be listed recursively on connect but rather only a single directory, with subdirectories being listed dynamically as they are viewed by the user. This feature was added in WinAIM 5.2 beta to improve performance when sharing many files and should be used whenever possible.

See Also:
Constant Field Values

EXTRABLOCK_DEFAULT

public static final ByteBlock EXTRABLOCK_DEFAULT
An "extra data block" used by WinAIM 5.2. As of this writing, this block's significance is unknown.

Constructor Detail

GetFileReqRvCmd

public GetFileReqRvCmd(RecvRvIcbm icbm)
Creates a new Get File session request from the given incoming Get File request RV ICBM.

Parameters:
icbm - an incoming Get File request RV ICBM

GetFileReqRvCmd

public GetFileReqRvCmd(RvConnectionInfo connInfo)
Creates a new outgoing initial Get File session request with the given connection information block and a default set of other properties.

Using this constructor is equivalent to using new GetFileReqRvCmd(REQTYPE_INITIALREQUEST, connInfo, CHARSET_DEFAULT, CODE_DEFAULT, PROTOVERSION_DEFAULT, FLAG_EXPAND_DYNAMIC, EXTRABLOCK_DEFAULT).

Parameters:
connInfo - a block of connection information to send in this command

GetFileReqRvCmd

public GetFileReqRvCmd(RvConnectionInfo connInfo,
                       long flags)
Creates a new outgoing initial Get File session request with the given connection information block and set of flags as well as a default set of other properties.

Using this constructor is equivalent to using new GetFileReqRvCmd(REQTYPE_INITIALREQUEST, connInfo, CHARSET_DEFAULT, CODE_DEFAULT, PROTOVERSION_DEFAULT, flags, EXTRABLOCK_DEFAULT).

Parameters:
connInfo - a block of connection information to send in this command
flags - a set of flags, like FLAG_EXPAND_DYNAMIC, or 0 (for none)

GetFileReqRvCmd

public GetFileReqRvCmd(int requestType,
                       RvConnectionInfo connInfo)
Creates a new outgoing Get File session request / redirect with the given request type and the given connection information block.

Using this constructor is equivalent to using new GetFileReqRvCmd(requestType, connInfo, CHARSET_DEFAULT, CODE_DEFAULT, PROTOVERSION_DEFAULT, FLAG_EXPAND_DYNAMIC, EXTRABLOCK_DEFAULT).

Parameters:
requestType - a request type, like AbstractRequestRvCmd.REQTYPE_REDIRECT
connInfo - a block of connection information to send in this command

GetFileReqRvCmd

public GetFileReqRvCmd(int requestType,
                       RvConnectionInfo connInfo,
                       java.lang.String charset,
                       int code,
                       int protoVersion,
                       long flags,
                       ByteBlock extraBlock)
Creates a new outgoing Get File session request / redirect (depending on requestType) with the given properties.

Parameters:
requestType - a request type, like AbstractRequestRvCmd.REQTYPE_INITIALREQUEST
connInfo - a block of connection information to use for the associated connection
charset - the name of a charset (this value appears to be ignored by WinAIM); normally always CHARSET_DEFAULT
code - some sort of "code" value; normally CODE_DEFAULT
protoVersion - a "protocol version" value, like PROTOVERSION_DEFAULT
flags - a set of bit flags to send in this request, like FLAG_EXPAND_DYNAMIC or 0 (for none)
extraBlock - an "extra" block of data; normally EXTRABLOCK_DEFAULT
Method Detail

getConnInfo

public final RvConnectionInfo getConnInfo()
Returns the connection information block sent in this request/redirection.

Returns:
this command's connection information block

getCharset

public final java.lang.String getCharset()
Returns the charset name sent in this request. Note that this value appears to be ignored by the official clients; WinAIM always sends CHARSET_DEFAULT ("us-ascii"). See above for details.

Returns:
the charset name sent in this request, or null if none was sent

getCode

public final int getCode()
Returns the "code" value sent in this request. See above for details.

Returns:
this request's "code" value

getProtoVersion

public final int getProtoVersion()
Returns the "protocol version" value sent in this command. See above for details.

Returns:
this command's "protocol version" value

getFlags

public final long getFlags()
Returns the bit flags sent in this request. This will normally be a bitwise combination of "flags" like FLAG_EXPAND_DYNAMIC. For those unfamiliar with bitwise flags, one could test for a particular flag with code such as the following:
if ((getFileReq.getFlags() & GetFileReqRvCmd.FLAG_EXPAND_DYNAMIC) != 0) {
     System.out.println("Client supports dynamic file listing!");
}
 

Returns:
this request's associated bit flags

getExtraBlock

public final ByteBlock getExtraBlock()
Returns this request's "extra data block" value. See above for details.

Returns:
this request's "extra data block"

writeRvTlvs

protected void writeRvTlvs(java.io.OutputStream out)
                    throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's list of rendezvous TLV's to the given stream.

Specified by:
writeRvTlvs in class AbstractRvCmd
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

hasServiceData

protected boolean hasServiceData()
Description copied from class: AbstractRvCmd
Returns whether this RV command's TLV list should contain a "service data block" TLV. The return value of this method must be consistent throughout this object's existence. Note that if this method returns false for an object, writeServiceData will never be called on that object. The default implementation of this method returns true.

Overrides:
hasServiceData in class AbstractRvCmd
Returns:
whether or not this RV command has a "service data block"
See Also:
AbstractRvCmd.writeServiceData(java.io.OutputStream)

writeServiceData

protected void writeServiceData(java.io.OutputStream out)
                         throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's "service data block." A service data block's format changes from rendezvous to rendezvous, but generally provides information specific to the type of rendezvous being sent. For example, in a file transfer request, the file's name and size (among other fields) are sent in the service block. This method will never be called if AbstractRvCmd.hasServiceData() returns false. The default implementation of this method does not write any data to the stream.

Overrides:
writeServiceData in class AbstractRvCmd
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()