⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospproviderapi.c

📁 mgcp协议源代码。支持多种编码:g711
💻 C
📖 第 1 页 / 共 3 页
字号:
                 */                errorcode = OSPPProviderSetHTTPTimeout(                *ospvProvider,                 ospvHTTPTimeout);            if (errorcode == OSPC_ERR_NO_ERROR)                /*                 * set local validation                 */                if (ospvLocalValidation)                    errorcode = errorcode; /* not implemented */            /*              * set audit info              */            if(errorcode == OSPC_ERR_NO_ERROR)            {                provider->Audit = OSPPAuditNew(ospvAuditURL);                if(provider->Audit != OSPC_OSNULL)                {                    OSPPAuditSetSecurity(provider->Audit, provider->Security);                    OSPPAuditSetComm(provider->Audit, provider->Comm);                    OSPPCommSetAuditURL(provider->Comm, ospvAuditURL);                }                /* setup transactionid tree */                OSPPTransIdInit(provider);            }        }    }    return errorcode;}/*  * OSPPProviderSetAuthorityCertificates() * * Set the list of authority certificates trusted by the provider. * * The OSPPProviderSetAuthorityCertificates function indicates the  * certificate authority public keys that should be trusted for  * ospvProvider. Those public keys are conveyed in the form of X.509  * formatted certificates. The parameter ospvNumberOfAuthorityCertificates * indicates how many of such certificates are conveyed in the  * ospvAuthorityCertificates array. Communication exchanges already in  * progress are not interrupted by this function, but subsequent exchanges  * will use the new values. * * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */intOSPPProviderSetAuthorityCertificates(    OSPTPROVHANDLE  ospvProvider,                       /* In - Provider handle       */    unsigned        ospvNumberOfAuthorityCertificates,   /* In - Number of auth certs  */    const void      *ospvAuthorityCertificates[])       /* In - Ptr to auth cert bufs */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)        errorcode = OSPPSecSetAuthorityCertificates( provider->Security,                                                      ospvNumberOfAuthorityCertificates,                                                      (unsigned char **)ospvAuthorityCertificates);    return errorcode;}/*  * OSPPProviderSetHTTPMaxConnections() * * Set the maximum number of simultaneous HTTP connections  * with the provider. * * The OSPPProviderSetHTTPMaxConnections function indicates the  * maximum number of simultaneous HTTP connections that should be  * established with ospvProvider. The number is passed in the  * ospvHTTPMaxConnections parameter. Changes to this value  do not  * effect active communication exchanges but otherwise take place  * immediately. In particular, HTTP connections being kept alive  * strictly because of persistence are terminated immediately if  * the number of open connections must be reduced. * * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */intOSPPProviderSetHTTPMaxConnections(    OSPTPROVHANDLE ospvProvider,           /* In - Provider handle       */    unsigned       ospvHTTPMaxConnections) /* In - New HTTP Max Connects */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)        errorcode = OSPPCommSetMaxConnections(provider->Comm,                                              ospvHTTPMaxConnections);    return errorcode;}/*  * OSPPProviderSetHTTPPersistence() * * Set the keep-alive time, in seconds, for the connection * with the provider. * * The OSPPProviderSetHTTPPersistence function configures the persistence * of HTTP connections established with ospvProvider. That lifetime,  * expressed in seconds, is indicated by the ospvHTTPPersistence parameter. * The SDK library keeps a HTTP connection alive for this number of seconds  * after each communication exchange, anticipating that a subsequent exchange * may reuse the existing connection. Changes to this parameter take place  * immediately. *  * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */intOSPPProviderSetHTTPPersistence(    OSPTPROVHANDLE ospvProvider,        /* In - Provider handle      */    unsigned       ospvHTTPPersistence) /* In - New HTTP Persistence */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)        errorcode = OSPPCommSetPersistence(provider->Comm,ospvHTTPPersistence);    return errorcode;}/*  * OSPPProviderSetHTTPRetryDelay() * * Set delay between retries for connection attempts with provider. * * The OSPPProviderSetHTTPRetryDelay function configures the delay  * between retries for connections attempts with ospvProvider. That  * delay, expressed in seconds, is indicated by the ospvHTTPRetryDelay * parameter. After exhausting all service points for the provider, the * library will delay for this amount of time before resuming  * connection attempts. Changes to this parameter take place immediately. * * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */int OSPPProviderSetHTTPRetryDelay(    OSPTPROVHANDLE ospvProvider,       /* In - Provider handle      */    unsigned       ospvHTTPRetryDelay) /* In - New HTTP retry delay */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)         errorcode = OSPPCommSetRetryDelay(provider->Comm,ospvHTTPRetryDelay);    return errorcode;}/*  * OSPPProviderSetHTTPRetryLimit() * * Set maximum number of retries for connection attempts to provider. * * The OSPPProviderSetHTTPRetryLimit function configures the maximum  * number of retries for connections attempts with ospvProvider. If no  * connection is established after this many retry attempts to all service * points, then the library will cease connection attempts and return  * appropriate error codes. This number does not count the initial  * connection attempt, so that an ospvHTTPRetryLimit of 1 will result  * in a total of two connection attempts to every service point. *  * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */int OSPPProviderSetHTTPRetryLimit(    OSPTPROVHANDLE ospvProvider,       /* In - Provider handle      */    unsigned       ospvHTTPRetryLimit) /* In - New HTTP retry limit */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)        errorcode = OSPPCommSetRetryLimit(provider->Comm,ospvHTTPRetryLimit);    return errorcode;}/*  * OSPPProviderSetHTTPTimeout() * * Configure maximum time in ms to wait for HTTP reply from provider. * * The OSPPProviderSetHTTPTimeout function configures the maximum  * amount of time to wait for a reply from ospvProvider. That timeout, * expressed in milliseconds, is indicated by the ospvHTTPTimeout  * parameter. If no response arrives within this time, the current  * connection is aborted and the library attempts to connect with another * service point. Changes to this parameter do not affect connection  * attempts already in progress, but take affect for all subsequent attempts. * * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */int OSPPProviderSetHTTPTimeout(    OSPTPROVHANDLE ospvProvider,    /* In - Provider handle  */    unsigned       ospvHTTPTimeout) /* In - New HTTP Timeout */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)         errorcode = OSPPCommSetTimeout(provider->Comm, ospvHTTPTimeout);    return errorcode;}/*  * OSPPProviderSetLocalKeys() * * Set public and private keys provider uses to sign requests  * and indications. * * The OSPPProviderSetLocalKeys function configures the public and  * private key pair used by ospvProvider to sign its requests and  * indications. The parameter ospvLocalPrivateKey identifies the RSA  * private key and the parameter ospvLocalCertificate points to a X.509 * formatted certificate containing the corresponding RSA public key. * Communication exchanges already in progress are not interrupted by  * this function, but subsequent exchanges will use the new values. *  * Returns: OSPC_ERR_NO_ERROR if successful, OSP_ERR_xxx otherwise. */intOSPPProviderSetLocalKeys(    OSPTPROVHANDLE          ospvProvider,          /* In - Provider handle       */    const OSPTPRIVATEKEY    *ospvLocalPrivateKey,  /* In - New Local Private Key */    const void              *ospvLocalCertificate) /* In - New Local Certificate */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    unsigned long custId = 0;    unsigned long devId = 0;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)     {        errorcode = OSPPSecSetPrivateKey(provider->Security,                                        (OSPTPRIVATEKEY *)ospvLocalPrivateKey);        if (errorcode == OSPC_ERR_NO_ERROR)         {            errorcode = OSPPSecSetLocalCertificate(provider->Security,                                                   (unsigned char *)ospvLocalCertificate,                                                   &custId,                                                   &devId);            if((errorcode==OSPC_ERR_NO_ERROR)&&(custId!=0)&&(devId!=0))            {                /* set Customer Id */                OSPPProviderSetTNCustId(provider, custId);                /* set Device Id */                OSPPProviderSetTNDeviceId(provider, devId);            }        }    }    return errorcode;}/* * OSPPProviderSetLocalValidation() * * Set local validation on or off. * * The OSPPProviderSetLocalValidation funcitonindicates to opsvProvider * whether authorisation tokens should be validated locally (i.e. by  * verifying their digital signature) or via a protocol exchange. The  * parameter ospvLocalValidation is non-zero for local validation or zero  * for remote validation. * * returns OSPC_ERR_NO_ERROR if successful, error code otherwise. */intOSPPProviderSetLocalValidation(    OSPTPROVHANDLE      ospvProvider,         /* In - Provider handle             */    unsigned            ospvLocalValidation)  /* In - Local validation indicator  */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)     {        errorcode = OSPPSecSetLocalValidation(  provider->Security,                                               ospvLocalValidation);    }    return errorcode;}/*  * OSPPProviderSetServicePoints() * * Set service point configuration for future communications exchanges.  * * The OSPPProviderSetServicePoints function indicates the service points  * the SDK library should use for future communication exchanges with * ospvProvider. Communication exchanges already in progress are not * interrupted. * * The format for the ospvServicePoints parameter is the same as in the * OSPPProviderNew function call. In particular, it is a list of service * points, each in the form of a standard URL. A service point URL may consist * of up to four components: * * An optional indication of the protocol to be used for communicating * with the service point. This release of the SDK supports both HTTP and  * with the service point. This release of the SDK supports both HTTP and  * HTTP secured with SSL; they are indicated by "http://" and "https://"  * respectively. If the protocol is not explicitly indicated, the SDK  * defaults to HTTP secured with SSL. * * The Internet domain name for the service point. Raw IP addresses  * may also be used, provided they are enclosed in square brackets such as  * "[172.16.1.1]". * * An optional TCP port number for communicating with the service  * point. If the port number is omitted, the SDK defaults to port 80  * (for HTTP) or port 443 (for HTTP secured with SSL). * * The uniform resource identifier for requests to the service point.   * This component is not optional and must be included. * * The service points are ordered in the list by decreasing preference. The SDK  * library, therefore, attempts to contact the first service point  * first.  Only if that attempt fails will it fall back to the second  *      service point. * *      Examples of valid service points include: * *          "https://service.transnexus.com/scripts/voice/osp.cmd" *              "service.uk.transnexus.co.uk/scripts/fax/osp.cmd" *              "http://[172.16.1.2]:443/scripts/video/osp.cmd" * *      Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. * */intOSPPProviderSetServicePoints(    OSPTPROVHANDLE  ospvProvider,              /* In - Provider handle    */    unsigned        ospvNumberOfServicePoints, /* In - New svc pt cnt     */    const char      *ospvServicePoints[])      /* In - New svc pt strings */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)         errorcode =OSPPCommSetServicePoints(provider->Comm,                                             ospvNumberOfServicePoints,                                            ospvServicePoints);    return errorcode;}/*  * OSPPProviderSetSSLLifetime() * * Set the maximum lifetime of SSL session keys with provider. * * The OSPPProviderSetSSLLifetime function configures the maximum  * lifetime of SSL session keys established with ospvProvider. That  * lifetime, expressed in seconds, is indicated by the ospvSSLLifetime * parameter. The SDK library attempts to reuse previously established  * SSL session keys in order to minimize delay when communicating  * with a settlement server. This parameter places a maximum lifetime on  * these keys. Changes to this parameter take place immediately. Note,  * however, that communication  exchanges already in progress are never  * interrupted when a session key lifetime expires. * * Returns: OSPC_ERR_NO_ERROR if successful, OSPC_ERR_xxx otherwise. */intOSPPProviderSetSSLLifetime(    OSPTPROVHANDLE ospvProvider,    /* In - Provider handle  */    unsigned       ospvSSLLifetime) /* In - New SSL Lifetime */{    OSPTPROVIDER *provider = OSPC_OSNULL;    int          errorcode = OSPC_ERR_NO_ERROR;    provider = OSPPProviderGetContext(ospvProvider, &errorcode);    if (errorcode == OSPC_ERR_NO_ERROR)         OSPPSecSetSSLLifetime(provider->Security, ospvSSLLifetime);    return errorcode;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -