OSI/MHS Management Programming Manual
Examples
OSI/MHS Management Programming Manual—424824-001
C-33
Example in C
/* constant SSID buffer */
zmhs_val_ssid_def ZMHS_VAL_SSID;
/* Host variables for accessing SQL tables MSPWTABL and MTPWTABL */
int sqlcode;
exec sql begin declare section;
exec sql invoke =mspwtabl as mspwtabl_row_def;
exec sql invoke =mtpwtabl as mtpwtabl_row_def;
struct mspwtabl_row_def mspwtabl_row;
struct mtpwtabl_row_def mtpwtabl_row;
exec sql end declare section;
/***************************************************************************/
/* FUNCTION PROTOTYPES */
/***************************************************************************/
bool valid_spi_request (char *spi_req_buf);
void process_spi_request (char *req_buf);
void process_mta_request (int passw_command,
char *req_buf);
void process_ms_add_appl (char *req_buf);
void process_ms_alter_appl (char *req_buf);
void process_ms_delete_appl (char *req_buf);
void process_ms_bind_appl (char *req_buf);
void process_ms_register_appl (char *req_buf);
int validate_mta_request (int passw_command,
zmhs_ddl_local_mta_name_def *local_mta_name,
zmhs_ddl_remote_mta_name_def *remote_mta_name,
zmhs_ddl_passw_def *req_passw_in,
zmhs_ddl_passw_def *rsp_passw_out,
bool *req_valid);
int alter_mspwtabl_row_passw (zmhs_ddl_appl_name_def *appl_name,
zmhs_ddl_passw_def *new_passw_in,
zmhs_ddl_old_passw_def *old_passw_in,
bool *passw_updated);
int validate_bind_password (zmhs_ddl_appl_name_def *appl_name,
zmhs_ddl_passw_def *passw_in,
zmhs_ddl_ua_osi_address_def *ua_osi_address,
bool *passw_valid);
************/
main ()
{
FILE *fp_rcv;
int rcv_status;
int rcv_fdes;
int rcv_bytes_read;
int rsp_bytes;
char rcv_buf [ZMHS_VAL_BUFLEN];
/* initialize the SSID buffer */
strcpy ((char *)&ZMHS_VAL_SSID.u_z_filler.z_owner, ZSPI_VAL_TANDEM);
ZMHS_VAL_SSID.z_number = ZSPI_SSN_ZMHS;
ZMHS_VAL_SSID.z_version = ZMHS_VAL_VERSION;
rcv_fdes = open_receive (RCV_DEPTH);
/* Do forever */
/* Read SPI request from $RECEIVE */
/* Process SPI request */
while (1)
{
rcv_bytes_read = readupdate (rcv_fdes,
rcv_buf,
ZMHS_VAL_BUFLEN);