VirtualFileClient¶
-
class
kanzi::connect
::
VirtualFileClient
: public AbstractServiceClient¶ Base class for local and remote virtual http file clients.
Subclassed by VirtualFileLocalClient, VirtualFileRemoteClient
Public Types
-
enum
RegistrationStatus
¶ Values:
-
enumerator
NotRegistered
¶ Registration not yet started.
-
enumerator
RegistrationInProgress
¶ Registration of a path is in progress.
-
enumerator
RegistrationFailed
¶ Registration failed, most likely because same registration already existed.
-
enumerator
Registered
¶ Registration succeeded.
-
enumerator
-
typedef enum kanzi::connect::VirtualFileClient::RegistrationStatus
RegistrationStatus
-
typedef shared_ptr<void>
RegistrationToken
¶ Token used to identify registration.
Public Functions
-
inline virtual
~VirtualFileClient
()¶ C++ destructor - performs cleanup.
-
inline virtual string
getIdentifier
() const¶ Returns the type of the service.
- Returns
Identifier of the service, as a string.
-
virtual string
getPath
(RegistrationToken token) const = 0¶ Retrieve the path associated with the registration.
- Parameters
token – The token that identifies the registration.
- Returns
full path in form: http://<server>:8080/somepath/ empty string is returned if registration has failed, or it is still in progress.
-
virtual RegistrationToken
registerPath
(const string &scheme, const string &pathProposal, VirtualFileProvider *provider) = 0¶ Registers a path to HTTP Server.
Registration is an asynchronous operation for remote clients.
- Parameters
scheme – Requested protocol. Either HTTP or HTTPS expected. If you do not set a value, uses HTTP.
pathProposal – clients proposal of the path where the serving is to be done.
provider – pointer to callback interface that is, if successfully registered, invoked for every file request made under the registered path. Caller must guarantee that the provided callback interface remains valid until corresponding unregisterPath call is made.
- Returns
Opaque token that identifies this registration.
-
inline virtual void
registerRegistrationStatusChangeCallback
(RegistrationToken, RegistrationStatusChangeCallback*)¶ Register registration status change callback.
Registration is meaningful only for remote clients since status does not change for local clients.
- Parameters
token – identification token.
callback – interface to be invoked when registration status changes.
-
virtual RegistrationStatus
registrationStatus
(RegistrationToken token) = 0¶ Checks the registration status.
For remote operations registration is asynchronous and thus it is not complete until this method returns either Registered or RegistrationFailed. Also, if for example connection is lost, then the registration status changes even if it has been completed earlier.
- Parameters
token – The token that identifies the registration.
- Returns
enumerated status.
-
virtual void
unregisterPath
(RegistrationToken token) = 0¶ Unregisters previously registered path.
- Parameters
token – opaque handle got using the registerPath
-
inline virtual void
unregisterRegistrationStatusChangeCallback
(RegistrationToken)¶ Clears previously registered status change callback.
- Parameters
token – path registration token.
Public Static Functions
-
static string
Type
()¶ Type of the client.
- Returns
type as string
-
class
RegistrationStatusChangeCallback
¶ Callback interface.
-
enum