Collapse All
Parallels C API Reference Guide
PrlSrv_LoginLocal Function
PrlApi.h PHT_SERVER Example See Also

Allows to log in to the local Parallels Service (the Parallels Service running on this host) using the current user credentials.

Syntax
PRL_HANDLE PrlSrv_LoginLocal(
    PRL_HANDLE hServer, 
    PRL_CONST_STR sPrevSessionUuid, 
    PRL_UINT32 port, 
    PRL_SECURITY_LEVEL security_level
);
File
Parameters

hServer
A handle of type PHT_SERVER identifying the Parallels Service.
sPrevSessionUuid
Previous session ID. This is an optional parameter that can be used in recovering from a lost Parallels Service connection. The ID will be used to restore references to the tasks that were initiated in the previous session and are still running inside the Parallels Service. You can pass a null or an empty string value if you are not restoring any references. See PrlSrv_AttachToLostTask for more information.
port
Port number. Specify 0 (zero) to use the default port.
security_level
Communication security level to use for this connection. The security level set here will be used for all communications with the Parallels Service for the duration of this session. The minimum allowable security level can be determined using the PrlDispCfg_GetMinSecurityLevel function.
flags
A bitset of flags. Allowed next values:

0 - no flags. It's behaviour by default ( as PrlSrv_LoginLocal() )

PACF_NON_INTERACTIVE_MODE
to use non-interactive mode. In interactive mode, a client may receive questions from the Parallels Service, which it is expected to answer in order for the operation to continue. In non-interactive mode, the Parallels Service will make decisions on its own.
Returns

A handle of type PHT_JOB containing the results of this asynchronous operation, including the return code and a handle of type PHT_LOGIN_RESPONSE , containing an additional Parallels Service information.

PRL_INVALID_HANDLE if there's not enough memory to instantiate the job object.

Remarks

When performing a local login operation, no password/username is needed. The authentication and authorization will be performed using the current user account.

To get the return code from the PHT_JOB object, use the PrlJob_GetRetCode function. Possible values are:

PRL_ERR_INVALID_ARG - invalid handle was passed.

PRL_ERR_SUCCESS - function completed successfully.

To get the results from the PHT_JOB object:

  1. Use the PrlJob_GetResult function to obtain a handle to the PHT_RESULT object.
  2. Use the PrlResult_GetParam function to obtain a handle of type PHT_LOGIN_RESPONSE .
See Also
Example

The following example illustrates how to log in to locally running Parallels Service and to obtain a handle of type PHT_LOGIN_RESPONSE .

// Log in.
hJob = PrlSrv_LoginLocal( hServer, NULL, 0, PSL_LOW_SECURITY );
PrlJob_Wait( hJob, 10000 );

// Get the results of the login operation.
PrlJob_GetResult( hJob, &hJobResult );
PrlHandle_Free( hJob );

// Get the PHT_LOGIN_RESPONSE handle from the job result.
PRL_HANDLE hHandle;
PrlResult_GetParam( hJobResult, &hHandle );
Links
Copyright © 1999-2011 Parallels Holdings, Ltd. and its affiliates. All rights reserved.
What do you think about this topic? Send feedback!