MATLAB Production Server C Client  R2024a
component: mds_c_client, module directory: deployment_server/client/c/mps, copyright: MathWorks
Data Fields
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...
 
mpsStatus(* createContext )(mpsClientContext **context, const mpsClientConfig *config)
 Initialize the MATLAB Production Server client execution context. More...
 
void(* destroyConfig )(mpsClientConfig *config)
 Clean up the memory allocated to the client configuration instance. More...
 
void(* destroyContext )(mpsClientContext *context)
 Clean up the memory allocated for the client execution context. 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...
 
const char *(* getCAFile )(const mpsClientConfig *config)
 Get Certificate Authority file. More...
 
const char *(* getClientCertFile )(const mpsClientConfig *config)
 Get client certificate file. 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...
 
const char *(* getPrivateKeyFile )(const mpsClientConfig *config)
 Get the private key file. More...
 
const char *(* getPrivateKeyPasswd )(const mpsClientConfig *config)
 Get password for private key file. More...
 
unsigned int(* getResponseSizeLimit )(const mpsClientConfig *config)
 Get the responze size limit value, in bytes, for the client. More...
 
unsigned long(* getResponseTimeOutSec )(const mpsClientConfig *config)
 Get the timeout value, in seconds, for the client to receive response from the server. More...
 
const char *(* getRevocationListFile )(const mpsClientConfig *config)
 Get the revocation list file. More...
 
mpsLogical(* getVerifyHost )(const mpsClientConfig *config)
 Get the host verification flag value. More...
 
mpsLogical(* getVerifyPeer )(const mpsClientConfig *config)
 Get the peer verification flag value. More...
 
void(* setCAFile )(mpsClientConfig *config, const char *caFile)
 Set file Certificate Authority file in PEM format. 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...
 
void(* setPrivateKeyFile )(mpsClientConfig *config, const char *pkFile)
 Set private key file in PEM format. More...
 
void(* setPrivateKeyPasswd )(mpsClientConfig *config, const char *passwd)
 Set password for private key file. More...
 
void(* setResponseSizeLimit )(mpsClientConfig *config, unsigned int value)
 Set the response size limit value, in bytes, for the client. More...
 
void(* setResponseTimeOutSec )(mpsClientConfig *config, unsigned long value)
 Set the timeout value, in seconds, for the client to receive response from the server. More...
 
void(* setRevocationListFile )(mpsClientConfig *config, const char *crlFile)
 Set 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...
 
void(* setVerifyPeer )(mpsClientConfig *config, mpsLogical verifyPeer)
 Setting this flag to false will not peform the authentication of server certificate. 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 306 of file client.h.

Field Documentation

◆ createConfig

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 318 of file client.h.

◆ createContext

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 349 of file client.h.

◆ destroyConfig

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 323 of file client.h.

◆ destroyContext

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 358 of file client.h.

◆ destroyLastErrorInfo

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

Cleans up dynamic memory allocated while initializing mpsErrorInfo instance.

Definition at line 376 of file client.h.

◆ feval

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 400 of file client.h.

◆ getCAFile

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

Get Certificate Authority file.

Definition at line 429 of file client.h.

◆ getClientCertFile

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

Get client certificate file.

Definition at line 411 of file client.h.

◆ getLastErrorInfo

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 372 of file client.h.

◆ getPrivateKeyFile

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

Get the private key file.

Definition at line 417 of file client.h.

◆ getPrivateKeyPasswd

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

Get password for private key file.

Definition at line 423 of file client.h.

◆ getResponseSizeLimit

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

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

Definition at line 335 of file client.h.

◆ getResponseTimeOutSec

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 329 of file client.h.

◆ getRevocationListFile

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

Get the revocation list file.

Definition at line 435 of file client.h.

◆ getVerifyHost

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

Get the host verification flag value.

Definition at line 441 of file client.h.

◆ getVerifyPeer

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

Get the peer verification flag value.

Definition at line 449 of file client.h.

◆ setCAFile

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

Set file Certificate Authority file in PEM format.

Definition at line 426 of file client.h.

◆ setClientCertFile

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 408 of file client.h.

◆ setPrivateKeyFile

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

Set private key file in PEM format.

Definition at line 414 of file client.h.

◆ setPrivateKeyPasswd

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

Set password for private key file.

Definition at line 420 of file client.h.

◆ setResponseSizeLimit

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

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

Definition at line 332 of file client.h.

◆ setResponseTimeOutSec

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 326 of file client.h.

◆ setRevocationListFile

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

Set the revocation list file.

Definition at line 432 of file client.h.

◆ setVerifyHost

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 438 of file client.h.

◆ setVerifyPeer

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 446 of file client.h.


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