MATLAB Production Server C Client  R2016b
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
mpsClientRuntime Struct Reference

MATLAB Production Server client API container. More...

#include <mps/client.h>

Data Fields

mpsStatus(* createConfig )(mpsClientConfig **config)
 Initialize pointer to MATLAB Production Server client configuration instance with default values. More...
 
void(* destroyConfig )(mpsClientConfig *config)
 Clean up the memory allocated to the client configuration instance. More...
 
void(* setResponseTimeOutSec )(mpsClientConfig *config, unsigned long value)
 Set the timeout value, in seconds, for the client to receive response from the server. More...
 
unsigned long(* getResponseTimeOutSec )(const mpsClientConfig *config)
 Get the timeout value, in seconds, for the client to receive response from the server. More...
 
void(* setResponseSizeLimit )(mpsClientConfig *config, unsigned int value)
 Set the response size limit value, in bytes, for the client. More...
 
unsigned int(* getResponseSizeLimit )(const mpsClientConfig *config)
 Get the responze size limit value, in bytes, for the client. More...
 
mpsStatus(* createContext )(mpsClientContext **context, const mpsClientConfig *config)
 Initialize the MATLAB Production Server client execution context. More...
 
void(* destroyContext )(mpsClientContext *context)
 Clean up the memory allocated for the client execution context. More...
 
void(* getLastErrorInfo )(mpsClientContext const *context, mpsErrorInfo *errorInfo)
 Access the error thrown while invoking a MATLAB function from the client A MATLAB function invocation failure can happen due to one of the following reasons: More...
 
void(* destroyLastErrorInfo )(mpsErrorInfo *errorInfo)
 Cleans up dynamic memory allocated while initializing mpsErrorInfo instance. More...
 
mpsStatus(* feval )(mpsClientContext *context, const char *url, int nlhs, mpsArray *plhs[], int nrhs, const mpsArray *prhs[])
 Invoke MATLAB function hosted by a server instance and available at a Url. More...
 
void(* setClientCertFile )(mpsClientConfig *config, const char *certFile)
 MPS_CLIENT_1_1 version provides support for request execution using HTTPS protocol for secure client-server communication. More...
 
const char *(* getClientCertFile )(const mpsClientConfig *config)
 Get client certificate file. More...
 
void(* setPrivateKeyFile )(mpsClientConfig *config, const char *pkFile)
 Set private key file in PEM format. More...
 
const char *(* getPrivateKeyFile )(const mpsClientConfig *config)
 Get the private key file. More...
 
void(* setPrivateKeyPasswd )(mpsClientConfig *config, const char *passwd)
 Set password for private key file. More...
 
const char *(* getPrivateKeyPasswd )(const mpsClientConfig *config)
 Get password for private key file. More...
 
void(* setCAFile )(mpsClientConfig *config, const char *caFile)
 Set file Certificate Authority file in PEM format. More...
 
const char *(* getCAFile )(const mpsClientConfig *config)
 Get Certificate Authority file. More...
 
void(* setRevocationListFile )(mpsClientConfig *config, const char *crlFile)
 Set the revocation list file. More...
 
const char *(* getRevocationListFile )(const mpsClientConfig *config)
 Get the revocation list file. More...
 
void(* setVerifyHost )(mpsClientConfig *config, mpsLogical verifyHost)
 Setting this flag to true will verify the hostname in thr url against the common name in the certificate. More...
 
mpsLogical(* getVerifyHost )(const mpsClientConfig *config)
 Get the host verification flag value. More...
 
void(* setVerifyPeer )(mpsClientConfig *config, mpsLogical verifyPeer)
 Setting this flag to false will not peform the authentication of server certificate. More...
 
mpsLogical(* getVerifyPeer )(const mpsClientConfig *config)
 Get the peer verification flag value. More...
 

Detailed Description

MATLAB Production Server client API container.

mpsClientRuntime provides functions needed to create the MATLAB Production Server client execution context, configure it, and use the execution context to execute MATLAB functions hosted by an MATLAB Production Server instance.

Definition at line 305 of file client.h.

Field Documentation

mpsStatus(* mpsClientRuntime::createConfig)(mpsClientConfig **config)

Initialize pointer to MATLAB Production Server client configuration instance with default values.

The configuration parameters are used to configure the connection between client and MATLAB Production Server instance. Currently, the only parameter that can be initialized is the response timeout in seconds. This is the time the client will wait for the MATLAB Production Server instance to send the response. The default value is 120 seconds.

Parameters
configAn uninitialized pointer to MATLAB Production Server client configuration instance.
Returns
Status representing whether client configuration initialization was successful.

Definition at line 317 of file client.h.

mpsStatus(* mpsClientRuntime::createContext)(mpsClientContext **context, const mpsClientConfig *config)

Initialize the MATLAB Production Server client execution context.

Execution context is initialized with the configuration parameters passed using MATLAB Production Server client configuration instance. The execution context encapsulates the HTTP framework required to execute MATLAB functions from the client. It also manages the connections between the client and the server instance. The execution context makes copy of the configuration being passed. As a result, the configuration pointer does not need to be kept around in the client application once the execution context has been created. You should use one execution context for every thread and it should not be shared across multiple threads.

Parameters
contextUninitialized memory location of pointer to the client context
configPointer to the client-server connection configuration

Definition at line 348 of file client.h.

void(* mpsClientRuntime::destroyConfig)(mpsClientConfig *config)

Clean up the memory allocated to the client configuration instance.

Parameters
configPointer to the client configuration that needs to be cleaned up

Definition at line 322 of file client.h.

void(* mpsClientRuntime::destroyContext)(mpsClientContext *context)

Clean up the memory allocated for the client execution context.

This function cleans up all the resources used while invoking MATLAB functions from the client e.g the container for holding the last error. It also closes all the open connections between the client and the server instance created by the client execution context. Once destroyed, the execution context cannot be used to invoke MATLAB functions.

Parameters
contextPointer to the client context

Definition at line 357 of file client.h.

void(* mpsClientRuntime::destroyLastErrorInfo)(mpsErrorInfo *errorInfo)

Cleans up dynamic memory allocated while initializing mpsErrorInfo instance.

Definition at line 375 of file client.h.

mpsStatus(* mpsClientRuntime::feval)(mpsClientContext *context, const char *url, int nlhs, mpsArray *plhs[], int nrhs, const mpsArray *prhs[])

Invoke MATLAB function hosted by a server instance and available at a Url.

MATLAB Production Server clients invoke MATLAB functions hosted by a server instance using a Url with the following format: http://<hostname>:<port_number>/<archive_name>/<MATLAB_function_name>.

The following Url exposes the MATLAB function mymagic deployed in magic.ctf at port 9910 localhost.

http://localhost:9910/magic/mymagic

The inputs and outputs are of type mpsArray.

If the return status of this function is not success, the root cause of the failure is accessed by invoking getLastErrorInfo().

Parameters
contextClient context that holds a handle to the underlying HTTP framework instance
urlUrl to the MATLAB function
nlhsNumber of outputs (number of left hand side parameters)
plhsPointer to the output
nrhsNumber of input arguments (number of right hand side parameters)
prhsPointer to the inputs
Returns
Status of execution.

Definition at line 399 of file client.h.

const char*(* mpsClientRuntime::getCAFile)(const mpsClientConfig *config)

Get Certificate Authority file.

Definition at line 428 of file client.h.

const char*(* mpsClientRuntime::getClientCertFile)(const mpsClientConfig *config)

Get client certificate file.

Definition at line 410 of file client.h.

void(* mpsClientRuntime::getLastErrorInfo)(mpsClientContext const *context, mpsErrorInfo *errorInfo)

Access the error thrown while invoking a MATLAB function from the client A MATLAB function invocation failure can happen due to one of the following reasons:

  1. MATLAB function threw an error
  2. Client received a response code other than 200
  3. Failure due to connection issues between the client and MATLAB Production Server instance The purpose of this function is to provide detailed information about the root cause of the failure. This function should be invoked only when the return status of MATLAB function invocation is a non-success status. Invoking this method when the MATLAB function invocation is successful will result in a undefined behaviour.
    Parameters
    contextMATLAB Production Server client context used to invoke the MATLAB function
    errorInfoStruct containing detailed information regarding failed MATLAB function invocation

Definition at line 371 of file client.h.

const char*(* mpsClientRuntime::getPrivateKeyFile)(const mpsClientConfig *config)

Get the private key file.

Definition at line 416 of file client.h.

const char*(* mpsClientRuntime::getPrivateKeyPasswd)(const mpsClientConfig *config)

Get password for private key file.

Definition at line 422 of file client.h.

unsigned int(* mpsClientRuntime::getResponseSizeLimit)(const mpsClientConfig *config)

Get the responze size limit value, in bytes, for the client.

Definition at line 334 of file client.h.

unsigned long(* mpsClientRuntime::getResponseTimeOutSec)(const mpsClientConfig *config)

Get the timeout value, in seconds, for the client to receive response from the server.

Definition at line 328 of file client.h.

const char*(* mpsClientRuntime::getRevocationListFile)(const mpsClientConfig *config)

Get the revocation list file.

Definition at line 434 of file client.h.

mpsLogical(* mpsClientRuntime::getVerifyHost)(const mpsClientConfig *config)

Get the host verification flag value.

Definition at line 440 of file client.h.

mpsLogical(* mpsClientRuntime::getVerifyPeer)(const mpsClientConfig *config)

Get the peer verification flag value.

Definition at line 448 of file client.h.

void(* mpsClientRuntime::setCAFile)(mpsClientConfig *config, const char *caFile)

Set file Certificate Authority file in PEM format.

Definition at line 425 of file client.h.

void(* mpsClientRuntime::setClientCertFile)(mpsClientConfig *config, const char *certFile)

MPS_CLIENT_1_1 version provides support for request execution using HTTPS protocol for secure client-server communication.

Set client certificate file in PEM format.

Definition at line 407 of file client.h.

void(* mpsClientRuntime::setPrivateKeyFile)(mpsClientConfig *config, const char *pkFile)

Set private key file in PEM format.

Definition at line 413 of file client.h.

void(* mpsClientRuntime::setPrivateKeyPasswd)(mpsClientConfig *config, const char *passwd)

Set password for private key file.

Definition at line 419 of file client.h.

void(* mpsClientRuntime::setResponseSizeLimit)(mpsClientConfig *config, unsigned int value)

Set the response size limit value, in bytes, for the client.

Definition at line 331 of file client.h.

void(* mpsClientRuntime::setResponseTimeOutSec)(mpsClientConfig *config, unsigned long value)

Set the timeout value, in seconds, for the client to receive response from the server.

Definition at line 325 of file client.h.

void(* mpsClientRuntime::setRevocationListFile)(mpsClientConfig *config, const char *crlFile)

Set the revocation list file.

Definition at line 431 of file client.h.

void(* mpsClientRuntime::setVerifyHost)(mpsClientConfig *config, mpsLogical verifyHost)

Setting this flag to true will verify the hostname in thr url against the common name in the certificate.

Definition at line 437 of file client.h.

void(* mpsClientRuntime::setVerifyPeer)(mpsClientConfig *config, mpsLogical verifyPeer)

Setting this flag to false will not peform the authentication of server certificate.

Doing so will make the connection insecure and can be prone to man-in-the-middle attack

Definition at line 445 of file client.h.


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