IBM Webcam 4J User Manual

Page of 98
C++ Function
C Function
Description
ndmapi_sendcmd()
ndmapi_sendcmd_c()
Sends commands to Sterling Connect:Direct.
You must provide the command text. The
resp_moreflag is a pointer to the flag
indicating that more responses are pending
for the executed command. Invoke
ndmapi_recvresp_c() for C programs or
ndmapi_recvresp() for C++ programs to
retrieve the extra responses. Only the select
process and select statistics commands
require the use of ndmapi_recvresp_c() for
use with C and ndmapi_recvresp() for use
with C++.
ndmapi_recvresp()
ndmapi_recvresp_c()
Receives responses to commands sent to
Sterling Connect:Direct. The contents of the
response buffer are returned.
ndmapi_disconnect() ndmapi_disconnect_c() Terminates the API connection.
Three types of Sterling Connect:Direct command responses are returned by these
functions.
v
Informational responses return information about the submitted command.
v
Data responses, stored in the resp_buffer, contain data records.
v
Error responses return ERROR_H, a pointer to a linked list of all errors found.
The ID field values are fixed for use when debugging. The msgid, feedback, and
rc fields are specified by Sterling Connect:Direct and are referred to in message
text. The subst field points to a string that contains substitution variable
information to be inserted appropriately in the message text. The error control
structure keeps track of the current and total number of errors. You can move
through the errors by using the next pointer in error entry blocks.
The following code defines the ERROR_H structure:
#define NDM_ERR_ENT_T struct NDM_ERR_ENT_S
#define NDM_ERR_ENT_H NDM_ERR_ENT_T *
#define NDM_ERR_CTL_T struct NDM_ERR_CTL_S
#define ERROR_H
NDM_ERR_CTL_T *
struct NDM_ERR_ENT_S
{
int32
id;
char
msgid[MSGIDLEN];
int32
feedback;
int32
rc;
char
*subst;
NDM_ERR_ENT_H
next;
};
struct NDM_ERR_CTL_S
{
int32
id;
int32
cur_entry;
int32
num_entries;
NDM_ERR_ENT_H
next;
};
Creating a Connection to Sterling Connect:Direct Using
ndmapi_connect() or ndmapi_connect_c()
Use ndmapi_connect() or ndmapi_connect_c() to create a connection to Sterling
Connect:Direct so that an application can send commands and receive responses
62
Sterling Connect:Direct for UNIX: User Guide