SmartFTP FTP Library
IFTPServerState Interface Reference

import "sfFTPLib.idl";

Public Member Functions

HRESULT EvaluateParserFormat ([out, retval] ParserFormat *retval)
HRESULT GetCaseSensitivity ([out, retval] CaseSensitivity *retval)
 Determines if the remote file system distinguishes between uppercase and lowercase filenames.
HRESULT GetServerCapabilityState ([in] ServerCapability capability, [out, retval] ServerCapabilityState *retval)
HRESULT IsHashAlgoAvailable ([in] HashAlgo algo, [out, retval] VARIANT_BOOL *retval)
 Checks if the server supports a specific hashing algorithm.
HRESULT LookupFeature ([in] BSTR key, [out] BSTR *value, [out, retval] VARIANT_BOOL *retval)
 Checks if a specific server feature is supported and retrieves its parameters.

Properties

long CodePage [get]
 Retrieves the Windows Code Page identifier used for filename encoding.
DataProtection DataProtection [get]
 Retrieves the current security level of the data channel.
DataProtection CommandProtection [get]
 Retrieves the security level of the Control (Command) channel.
DataTransferType DataTransferType [get]
 Retrieves the currently active data transfer mode.
DataTransferMode DataTransferMode [get]
 Retrieves the currently active data transfer mode (Stream, Block, or Compressed).
ServerType ServerType [get]
 Retrieves the identified type or operating system of the remote server.
ServerSoftware ServerSoftware [get]
 Retrieves the specific server software family detected by the component.
VARIANT_BOOL PBSZ [get]
 Indicates whether the Protection Buffer Size (PBSZ) has been successfully negotiated.
VARIANT_BOOL SSCN [get]
 Retrieves the status of the Set Secure Connection Negotiation (SSCN) mode.
BSTR WorkingDirectory [get]
 Retrieves the current remote working directory.
BSTR HomeDirectory [get]
 Retrieves the initial login directory for the user.
BSTR SYSTReply [get]
 Retrieves the server's response to the SYST command.
BSTR FEATReply [get]
 Retrieves the raw server response to the FEAT command.
BSTR WelcomeMessage [get]
 Retrieves the initial greeting message sent by the server.
IFTPServerId ServerId [get]
 Retrieves the server identification details obtained via the CSID command.
OperatingSystem OperatingSystem [get]
 Retrieves the detected operating system family of the remote server.

Member Function Documentation

◆ EvaluateParserFormat()

HRESULT IFTPServerState::EvaluateParserFormat ( [out, retval] ParserFormat * retval)

◆ GetCaseSensitivity()

HRESULT IFTPServerState::GetCaseSensitivity ( [out, retval] CaseSensitivity * retval)

Determines if the remote file system distinguishes between uppercase and lowercase filenames.

This method retrieves the case sensitivity setting of the connected server, which dictates how file lookups and equality checks are performed.

Mechanism: The library infers this setting primarily from the server's response to the SYST (System Type) command:

Parameters
[out]retvalPointer to a CaseSensitivity enum receiving the status.

◆ GetServerCapabilityState()

HRESULT IFTPServerState::GetServerCapabilityState ( [in] ServerCapability capability,
[out, retval] ServerCapabilityState * retval )

◆ IsHashAlgoAvailable()

HRESULT IFTPServerState::IsHashAlgoAvailable ( [in] HashAlgo algo,
[out, retval] VARIANT_BOOL * retval )

Checks if the server supports a specific hashing algorithm.

This method determines whether the connected FTP server implements the requested hash algorithm (e.g., CRC32, MD5, SHA-1).

This information is usually derived from the server's response to the FEAT command (specifically the HASH feature negotiation) or by detecting support for legacy commands like XCRC, XMD5, or XSHA1.

Parameters
[in]algoThe HashAlgo enumeration value to check.
[out]retvalPointer to a VARIANT_BOOL indicating the result:
  • VARIANT_TRUE: The algorithm is supported and ready for use.
  • VARIANT_FALSE: The algorithm is not supported by this server.

◆ LookupFeature()

HRESULT IFTPServerState::LookupFeature ( [in] BSTR key,
[out] BSTR * value,
[out, retval] VARIANT_BOOL * retval )

Checks if a specific server feature is supported and retrieves its parameters.

This method queries the internal map of features populated by the server's response to the FEAT command (RFC 2389).

Key vs. Value:

  • Key: The feature name (e.g., "MDTM", "REST", "HASH").
  • Value: Optional parameters provided by the server (e.g., for "HASH", the value might be "SHA-1;MD5;CRC32"). If the feature is a simple flag, the value may be empty.
Parameters
[in]keyThe name of the feature to look up (case-insensitive).
[out]valuePointer to a BSTR that receives the feature's parameter string (if any).
  • If the feature exists but has no parameters, this returns an empty string.
[out]retvalPointer to a VARIANT_BOOL indicating the result:
  • VARIANT_TRUE: The feature key was found in the map.
  • VARIANT_FALSE: The feature is not supported by the connected server.

Property Documentation

◆ CodePage

long IFTPServerState::CodePage
getproperty

Retrieves the Windows Code Page identifier used for filename encoding.

This property represents the character encoding scheme that the library is currently using to interpret file names and server responses.

Why is this important? FTP was originally designed for 7-bit ASCII. Modern servers handle international characters (accents, Kanji, Cyrillic) differently:

  • Modern Servers: Support UTF-8 (Code Page 65001) explicitly via the OPTS UTF8 ON command.
  • Legacy Servers: Use specific 8-bit code pages (e.g., Windows-1252 for Western Europe, Shift-JIS for Japan).

If this value does not match the server's actual configuration, file names may appear garbled.

Common Values:

  • 65001: UTF-8 (Universal). The preferred standard.
  • 1252: ANSI Latin 1 (Western European).
  • 0 (CP_ACP): The local system's default ANSI code page.
Parameters
[out]retvalPointer to a long that receives the Code Page ID.

◆ CommandProtection

DataProtection IFTPServerState::CommandProtection
getproperty

Retrieves the security level of the Control (Command) channel.

This property indicates whether the main connection used to send commands (like USER, PASS, LIST) is currently encrypted.

Significance:

  • ftpDataProtectionClear : You are using standard FTP. Your username, password, and command history are being sent in plain text.
  • ftpDataProtectionPrivate : You are using FTPS (Explicit or Implicit). The TLS handshake was successful, and the control stream is encrypted.

Relationship to Data Protection: It is possible to have an encrypted Command channel (Private) but an unencrypted Data channel (Clear) if the PROT P command has not been issued. However, you generally cannot have an encrypted Data channel if the Command channel is Clear.

Parameters
[out]retvalPointer to a DataProtection enum that receives the current state.

◆ DataProtection

DataProtection IFTPServerState::DataProtection
getproperty

Retrieves the current security level of the data channel.

This property reflects the active protection level negotiated with the server via the PROT command.

Usage: Check this property before initiating a sensitive file transfer to ensure encryption is active.

Prerequisites: A value of ftpDataProtectionPrivate is only possible if:

  1. The connection is using FTPS (TLS).
  2. The PBSZ (Protection Buffer Size) command was successfully sent.
Parameters
[out]retvalPointer to a DataProtection enum that receives the current state.

◆ DataTransferMode

DataTransferMode IFTPServerState::DataTransferMode
getproperty

Retrieves the currently active data transfer mode (Stream, Block, or Compressed).

This property reflects the state established by the last successful MODE command sent to the server. If the server does not support a requested mode (such as Mode Z), this property will show the fallback mode (usually Stream) currently in effect.

Parameters
[out]retvalPointer to a DataTransferMode enum that receives the current state.

◆ DataTransferType

DataTransferType IFTPServerState::DataTransferType
getproperty

Retrieves the currently active data transfer mode.

This property reflects the last successful TYPE command sent to the server.

Parameters
[out]retvalPointer to a DataTransferType enum that receives the current state.

◆ FEATReply

BSTR IFTPServerState::FEATReply
getproperty

Retrieves the raw server response to the FEAT command.

This property contains the complete, unparsed text returned by the server when the library issues the FEAT (Feature Negotiation) command defined in RFC 2389.

Content Format: The string is typically a multi-line list where each line represents a supported extension, such as:

211-Features:
MDTM
SIZE
REST STREAM
MLST type*;size*;modify*;
211 End
Parameters
[out]retvalPointer to a BSTR that receives the FEAT reply.

◆ HomeDirectory

BSTR IFTPServerState::HomeDirectory
getproperty

Retrieves the initial login directory for the user.

This property represents the default directory assigned to the user upon successful authentication.

Difference from WorkingDirectory:

  • HomeDirectory: The fixed starting point (static).
  • WorkingDirectory : The current location, which changes as you navigate (dynamic).
Parameters
[out]retvalPointer to a BSTR that receives the home directory path.

◆ OperatingSystem

OperatingSystem IFTPServerState::OperatingSystem
getproperty

Retrieves the detected operating system family of the remote server.

This property provides a high-level classification of the remote environment. The library uses this information to adapt its internal logic for file system operations.

Parameters
[out]retvalPointer to an OperatingSystem enum representing the server's OS.

◆ PBSZ

VARIANT_BOOL IFTPServerState::PBSZ
getproperty

Indicates whether the Protection Buffer Size (PBSZ) has been successfully negotiated.

This property returns TRUE if the client has successfully issued the PBSZ 0 command to the server.

Parameters
[out]retvalPointer to a VARIANT_BOOL indicating the state:
  • VARIANT_TRUE: PBSZ command was sent and accepted.
  • VARIANT_FALSE: PBSZ has not been sent or failed.

◆ ServerId

IFTPServerId IFTPServerState::ServerId
getproperty

Retrieves the server identification details obtained via the CSID command.

The Context: The ServerId property provides a structured way to identify the specific brand and version of the FTP server software. This is populated after the component issues the CSID command (Client System Identification).

**Why use this over ServerType?**

  • ServerType usually returns a generic category based on the SYST command (e.g., ftpServerTypeUnix).
  • ServerId provides the specific product identity (e.g., Name: "Serv-U", Version: "15.1").

Usage: Use this property when your application needs to apply specific logic or workarounds for certain server vendors.

Note
This property returns a valid object only if the server supports the CSID extension and the command was successfully executed during the connection phase.
Parameters
[out]retvalReceives a pointer to the IFTPServerId interface.

◆ ServerSoftware

ServerSoftware IFTPServerState::ServerSoftware
getproperty

Retrieves the specific server software family detected by the component.

The Mechanism: The component attempts to identify the server software using several methods:

  1. CSID/CLNT: If the server responds to these identification commands (see ServerId).
  2. Welcome Message: Analyzing the 220 greeting banner sent upon connection.
  3. SYST Response: Analyzing the output of the SYST command.
Parameters
[out]retvalReceives the ServerSoftware enumeration value.
Returns
S_OK on success.

◆ ServerType

ServerType IFTPServerState::ServerType
getproperty

Retrieves the identified type or operating system of the remote server.

After a successful connection, the component automatically sends the SYST command to the server. This property reflects the result of that identification.

Parameters
[out]retvalPointer to a ServerType enum that receives the detected server type.

◆ SSCN

VARIANT_BOOL IFTPServerState::SSCN
getproperty

Retrieves the status of the Set Secure Connection Negotiation (SSCN) mode.

This property indicates whether the SSCN mechanism is currently active (On) or inactive (Off) for this session.

What is SSCN? SSCN (Set Secure Connection Negotiation) is a protocol extension used primarily during Secure FXP (Server-to-Server) transfers.

When transferring files directly between two secure FTP servers:

  1. Both servers must support encrypted data channels.
  2. SSCN is used to instruct the servers on how to establish this channel (specifically, who acts as the TLS client and who acts as the TLS server).

State Interpretation:

  • TRUE (On): SSCN is enabled. The server is prepared to negotiate the security of the data channel directly with another server (FXP scenario).
  • FALSE (Off): SSCN is disabled. Standard client-server security negotiation applies.
Parameters
[out]retvalPointer to a VARIANT_BOOL indicating the state:
  • VARIANT_TRUE: SSCN is on.
  • VARIANT_FALSE: SSCN is off.

◆ SYSTReply

BSTR IFTPServerState::SYSTReply
getproperty

Retrieves the server's response to the SYST command.

This property contains the raw identification string returned by the server when the library issues the SYST (System Type) command.

This command is typically sent automatically during the post-login sequence to determine the server's operating system environment.

Common Values:

  • 215 UNIX Type: L8 (Standard Unix/Linux)
  • 215 Windows_NT (Microsoft IIS)
  • 215 VMS (OpenVMS)

Usage: The library uses this string internally to:

  1. Auto-detect the correct path separator (/ vs \\endiskip).
  2. Select the appropriate directory parser.
Parameters
[out]retvalPointer to a BSTR that receives the SYST reply.

◆ WelcomeMessage

BSTR IFTPServerState::WelcomeMessage
getproperty

Retrieves the initial greeting message sent by the server.

This property contains the raw text received immediately after the TCP connection is established, but before any login credentials are sent.

Usage: Use this property to identify the server software type (fingerprinting) or to display the Message of the Day (MOTD) to the user.

◆ WorkingDirectory

BSTR IFTPServerState::WorkingDirectory
getproperty

Retrieves the current remote working directory.

This property tracks the directory path where the session is currently located on the server.

Parameters
[out]retvalPointer to a BSTR that receives the current absolute path.

The documentation for this interface was generated from the following file: