Sends a vendor ID indication to the remote terminal.
DWORD h324VendorIDIndication ( MSPHD msphd, H324_VENDORID_INDICATION *pVendorInd)
Argument |
Description |
msphd |
MSPP handle associated with the MUX endpoint. |
pVendorInd |
Pointer to the H_324_VENDORID_INDICATION structure that describes the VendorID indication to transmit: typedef struct tag_H324_VENDORID_INDICATION For information about the fields in this structure, see H324_VENDORID_INDICATION. |
Return value |
Description |
SUCCESS |
|
CTAERR_NOT_FOUND |
msphd was not found. Neither h324Start nor h324Delete were called. |
H324ERR_INTERNAL_ERROR |
Internal error in the 3G-324M Middleware. |
H324ERR_MUTEX_LOCK_FAILED |
Internal error trying to lock mutex. |
H324ERR_NOT_INITIALIZED |
h324Initialize was not called first. |
None.
#include <h324def.h>
unsigned char vendor_id[] = { 1, 28, 111, 97, 111, 84, 43, 86, 49 };
char prod_num[] = "N5000";
char vers_num[] = "1.23.5";
enum vendorIdType { t_ObjectId, t_h221NonStandard };
int sendVendorIDIndication(unsigned char * vendor_p, unsigned vendor_len,
unsigned char * prodNum_p, unsigned prodNum_len,
unsigned char * verNum_p, unsigned verNum_len,
vendorIdType type, MSPHD msphd)
{
unsigned result, payloadSz = vendor_len + prodNum_len + verNum_len;
H324_VENDORID_INDICATION * pVIBuf;
if (!( pVIBuf = (H324_VENDORID_INDICATION *) malloc(
sizeof(H324_VENDORID_INDICATION)+ payloadSz)))
return -1;
memset(pVIBuf, 0, sizeof(H324_VENDORID_INDICATION) + payloadSz);
// VendorID is either an ObjectID or H.221 NonStandard identifer.
pVIBuf->isNonStandard = (type == t_h221NonStandard);
// VendorID field lengths are required.
pVIBuf->vendorIDLen = vendor_len;
pVIBuf->productNumberLen = prodNum_len; // MBZ unless productNumber populated
pVIBuf->versionNumberLen = verNum_len; // MBZ unless versionNumber populated
// Copy required vendor ID into VendorID indication buffer.
memcpy(&pVIBuf->bytes[0], vendor_p, vendor_len);
// Copy optional productNumber and versionNumber fields, if present.
if (prodNum_len)
memcpy(&pVIBuf->bytes[vendor_len], prodNum_p, prodNum_len);
if (verNum_len)
memcpy(&pVIBuf->bytes[vendor_len + prodNum_len], verNum_p, verNum_len);
// Send the VendorID indication.
result = h324VendorIDIndication(msphd, pVIBuf);
free(pVIBuf);
if (result != SUCCESS)
return -2;
return 0; // VendorID successfully sent.
}