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

📄 rasparams.c

📁 基于h323协议的软phone
💻 C
📖 第 1 页 / 共 4 页
字号:

/*

NOTICE:
This document contains information that is proprietary to RADVISION LTD..
No part of this publication may be reproduced in any form whatsoever without
written prior approval by RADVISION LTD..

RADVISION LTD. reserves the right to revise this publication and make changes
without obligation to notify any person of such revisions or changes.

*/

#include "rvinternal.h"
#include "cmintr.h"
#include "cmutils.h"
#include "rasdef.h"
#include "rasin.h"
#include "rasout.h"
#include "rasutils.h"
#include "rasparams.h"

#ifdef __cplusplus
extern "C" {
#endif



/************************************************************************
 *
 *                              Private constants
 *
 ************************************************************************/

static fieldNames rasEndpointTypes[] =
{
    {/*cmEndpointTypeTerminal*/  __q931(terminal)},
    {/*cmEndpointTypeGateway*/   __q931(gateway)},
    {/*cmEndpointTypeMCU*/       __q931(mcu)},
    {/*cmEndpointTypeGK*/        __q931(gatekeeper)},
    {/*cmEndpointTypeSET*/       __q931(set)},
    {LAST_TOKEN}
};

static fieldNames rasCallTypes[] =
{
    {/*cmCallTypeP2P*/   __q931(pointToPoint)},
    {/*cmCallTypeOne2N*/ __q931(oneToN)},
    {/*cmCallTypeN2One*/ __q931(nToOne)},
    {/*cmCallTypeN2Nw*/  __q931(nToN)},
    {LAST_TOKEN}
};

static fieldNames rasCallModels[] =
{
    {/*cmCallModelTypeDirect*/   __q931(direct)},
    {/*cmCallModelTypeGKRouted*/ __q931(gatekeeperRouted)},
    {LAST_TOKEN}
};

static fieldNames rasDisengageReasons[] =
{
    {/*cmRASDisengageReasonForcedDrop*/      __q931(forcedDrop)},
    {/*cmRASDisengageReasonNormalDrop*/      __q931(normalDrop)},
    {/*cmRASDisengageReasonUndefinedReason*/ __q931(undefinedReason)},
    {LAST_TOKEN}
};

static fieldNames rasRejectReasons[] =
{
    {/*cmRASReasonResourceUnavailable*/             __q931(resourceUnavailable)},
    {/*cmRASReasonInsufficientResources*/           __q931(insufficientResources)},
    {/*cmRASReasonInvalidRevision*/                 __q931(invalidRevision)},
    {/*cmRASReasonInvalidCallSignalAddress*/        __q931(invalidCallSignalAddress)},
    {/*cmRASReasonInvalidRASAddress*/               __q931(invalidRASAddress)},
    {/*cmRASReasonInvalidTerminalType*/             __q931(invalidTerminalType)},
    {/*cmRASReasonInvalidPermission*/               __q931(invalidPermission)},
    {/*cmRASReasonInvalidConferenceID*/             __q931(invalidConferenceID)},
    {/*cmRASReasonInvalidEndpointID*/               __q931(invalidEndpointIdentifier)},
    {/*cmRASReasonCallerNotRegistered*/             __q931(callerNotRegistered)},
    {/*cmRASReasonCalledPartyNotRegistered*/        __q931(calledPartyNotRegistered)},
    {/*cmRASReasonDiscoveryRequired*/               __q931(discoveryRequired)},
    {/*cmRASReasonDuplicateAlias*/                  __q931(duplicateAlias)},
    {/*cmRASReasonTransportNotSupported*/           __q931(transportNotSupported)},
    {/*cmRASReasonCallInProgress*/                  __q931(callInProgress)},
    {/*cmRASReasonRouteCallToGatekeeper*/           __q931(routeCallToGatekeeper)},
    {/*cmRASReasonRequestToDropOther*/              __q931(requestToDropOther)},
    {/*cmRASReasonNotRegistered*/                   __q931(notRegistered)},
    {/*cmRASReasonUndefined*/                       __q931(undefinedReason)},
    {/*cmRASReasonTerminalExcluded*/                __q931(terminalExcluded)},
    {/*cmRASReasonNotBound*/                        __q931(notBound)},
    {/*cmRASReasonNotCurrentlyRegistered*/          __q931(notCurrentlyRegistered)},
    {/*cmRASReasonRequestDenied*/                   __q931(requestDenied)},
    {/*cmRASReasonLocationNotFound*/                __q931(requestDenied)},
    {/*cmRASReasonSecurityDenial*/                  __q931(securityDenial)},
    {/*cmRASReasonTransportQOSNotSupported*/        __q931(transportQOSNotSupported)},
    {/*cmRASResourceUnavailable*/                   __q931(resourceUnavailable)},
    {/*cmRASReasonInvalidAlias*/                    __q931(invalidAlias)},
    {/*cmRASReasonPermissionDenied*/                __q931(permissionDenied)},
    {/*cmRASReasonQOSControlNotSupported*/          __q931(qosControlNotSupported)},
    {/*cmRASReasonIncompleteAddress*/               __q931(incompleteAddress)},
    {/*cmRASReasonFullRegistrationRequired*/        __q931(fullRegistrationRequired)},
    {/*cmRASReasonRouteCallToSCN*/                  __q931(routeCallToSCN)},
    {/*cmRASReasonAliasesInconsistent*/             __q931(aliasesInconsistent)},
    {/*cmRASReasonAdditiveRegistrationNotSupported*/__q931(additiveRegistrationNotSupported)},
    {/*cmRASReasonInvalidTerminalAliases*/          __q931(invalidTerminalAliases)},
    {/*cmRASReasonExceedsCallCapacity*/             __q931(exceedsCallCapacity)},
    {/*cmRASReasonCollectDestination*/              __q931(collectDestination)},
    {/*cmRASReasonCollectPIN*/                      __q931(collectPIN)},
    {/*cmRASReasonGenericData*/                     __q931(genericDataReason)},
    {/*cmRASReasonNeededFeatureNotSupported*/       __q931(neededFeatureNotSupported)},
    {/*cmRASReasonUnknownMessageResponse*/          0}, /* This one is invalid */
    {/*cmRASReasonHopCountExceeded*/                __q931(hopCountExceeded)},
    {LAST_TOKEN}
};

static fieldNames rasConferenceGoals[] =
{
    {/*cmCreate*/                                __q931(create)},
    {/*cmJoin*/                                  __q931(join)},
    {/*cmInvite*/                                __q931(invite)},
    {/*cmCapabilityNegotiation*/                 __q931(capability_negotiation)},
    {/*cmCallIndependentSupplementaryService*/   __q931(callIndependentSupplementaryService)},
    {LAST_TOKEN}
};

static fieldNames rasReasons[] =
{
    {/*cmReasonTypeNoBandwidth*/             __q931(noBandwidth)},
    {/*cmReasonTypeGatekeeperResource*/      __q931(gatekeeperResources)},
    {/*cmReasonTypeUnreachableDestination*/  __q931(unreachableDestination)},
    {/*cmReasonTypeDestinationRejection*/    __q931(destinationRejection)},
    {/*cmReasonTypeInvalidRevision*/         __q931(invalidRevision)},
    {/*cmReasonTypeNoPermision*/             __q931(noPermission)},
    {/*cmReasonTypeUnreachableGatekeeper*/   __q931(unreachableGatekeeper)},
    {/*cmReasonTypeGatewayResource*/         __q931(gatewayResources)},
    {/*cmReasonTypeBadFormatAddress*/        __q931(badFormatAddress)},
    {/*cmReasonTypeAdaptiveBusy*/            __q931(adaptiveBusy)},
    {/*cmReasonTypeInConf*/                  __q931(inConf)},
    {/*cmReasonTypeUndefinedReason*/         __q931(undefinedReason)},
    {/*cmReasonTypeRouteCallToGatekeeper*/   __q931(routeCallToGatekeeper)},
    {/*cmReasonTypeCallForwarded*/           __q931(callForwarded)},
    {/*cmReasonTypeRouteCallToMC*/           __q931(routeCallToMC)},
    {/*cmReasonTypeFacilityCallDeflection*/  __q931(facilityCallDeflection)},
    {/*cmReasonTypeSecurityDenied*/          __q931(securityDenied)},
    {/*cmReasonTypeCalledPartyNotRegistered*/__q931(calledPartyNotRegistered)},
    {/*cmReasonTypeCallerNotregistered*/     __q931(callerNotRegistered)},
    {/*cmReasonTypeConferenceListChoice*/    __q931(conferenceListChoice)},
    {/*cmReasonTypeStartH245*/               __q931(startH245)},
    {/*cmReasonTypeNewConnectionNeeded*/     __q931(newConnectionNeeded)},
    {/*cmReasonTypeNoH245*/                  __q931(noH245)},
    {LAST_TOKEN}
};

static fieldNames rasTransportQOSs[] =
{
    {/*cmTransportQOSEndpointControlled*/   __q931(endpointControlled)},
    {/*cmTransportQOSGatekeeperControlled*/ __q931(gatekeeperControlled)},
    {/*cmTransportQOSNoControl*/            __q931(noControl)},
    {LAST_TOKEN}
};

static fieldNames rasUnregReasons[] =
{
    {/*cmRASUnregReasonReregistrationRequired*/ __q931(reregistrationRequired)},
    {/*cmRASUnregReasonTtlExpired*/             __q931(ttlExpired)},
    {/*cmRASUnregReasonSecurityDenial*/         __q931(securityDenial)},
    {/*cmRASUnregReasonUndefinedReason*/        __q931(undefinedReason)},
    {/*cmRASUnregReasonMaintenance*/            __q931(maintenance)},
    {LAST_TOKEN}
};








/************************************************************************
 *
 *                              Private functions
 *
 ************************************************************************/


/************************************************************************
 * RAS_RETURN_PATH
 * purpose: Make sure a path can be returned by a parameter
 *          This macro is used only by rasGetParamPath().
 * input  : param   - Parameter enumeration value
 * output : none
 * return : The given path as a static variable value
 ************************************************************************/
#define RAS_RETURN_PATH(path) \
{                                                                       \
    static RvInt16 fieldPath[] = path;                                    \
    return fieldPath;                                                   \
}


/************************************************************************
 * rasGetParamPath
 * purpose: Get the parameter's path inside a RAS message
 * input  : txType  - Type of transaction we're talking about
 *          param   - Parameter enumeration value
 * output : none
 * return : Path to the parameter on success
 *          NULL on failure
 ************************************************************************/
static RvInt16* rasGetParamPath(IN cmRASTransaction txType, IN cmRASParam param)
{
    switch (param)
    {
        case cmRASParamGatekeeperID:            RAS_RETURN_PATH({_q931(gatekeeperIdentifier) LAST_TOKEN});
        case cmRASParamRASAddress:              RAS_RETURN_PATH({_q931(rasAddress) LAST_TOKEN});
        case cmRASParamCallSignalAddress:       RAS_RETURN_PATH({_q931(callSignalAddress) LAST_TOKEN});
        case cmRASParamDiscoveryComplete:       RAS_RETURN_PATH({_q931(discoveryComplete) LAST_TOKEN});
        case cmRASParamEndpointVendor:          RAS_RETURN_PATH({_q931(endpointVendor) LAST_TOKEN});
        case cmRASParamCallType:                RAS_RETURN_PATH({_q931(callType) LAST_TOKEN});
        case cmRASParamCallModel:               RAS_RETURN_PATH({_q931(callModel) LAST_TOKEN});
        case cmRASParamEndpointID:              RAS_RETURN_PATH({_q931(endpointIdentifier) LAST_TOKEN});
        case cmRASParamDestInfo:                RAS_RETURN_PATH({_q931(destinationInfo) LAST_TOKEN});
        case cmRASParamDestExtraCallInfo:       RAS_RETURN_PATH({_q931(destExtraCallInfo) LAST_TOKEN});
        case cmRASParamDestCallSignalAddress:   RAS_RETURN_PATH({_q931(destCallSignalAddress) LAST_TOKEN});
        case cmRASParamSrcCallSignalAddress:    RAS_RETURN_PATH({_q931(srcCallSignalAddress) LAST_TOKEN});
        case cmRASParamBandwidth:               RAS_RETURN_PATH({_q931(bandWidth) LAST_TOKEN});
        case cmRASParamActiveMC:                RAS_RETURN_PATH({_q931(activeMC) LAST_TOKEN});
        case cmRASParamIrrFrequency:            RAS_RETURN_PATH({_q931(irrFrequency) LAST_TOKEN});
        case cmRASParamReplyAddress:            RAS_RETURN_PATH({_q931(replyAddress) LAST_TOKEN});
        case cmRASParamDisengageReason:         RAS_RETURN_PATH({_q931(disengageReason) LAST_TOKEN});
        case cmRASParamRejectedAlias:           RAS_RETURN_PATH({_q931(rejectReason) _q931(duplicateAlias) LAST_TOKEN});
        case cmRASParamDestinationIpAddress:    return NULL;
        case cmRASParamNonStandard:             RAS_RETURN_PATH({_q931(nonStandardData) LAST_TOKEN});
        case cmRASParamNonStandardData:         RAS_RETURN_PATH({_q931(nonStandardData) LAST_TOKEN});
        case cmRASParamCRV:                     RAS_RETURN_PATH({_q931(callReferenceValue) LAST_TOKEN});
        case cmRASParamMulticastTransaction:    return NULL;
        case cmRASParamTransportQOS:            RAS_RETURN_PATH({_q931(transportQOS) LAST_TOKEN});
        case cmRASParamKeepAlive:               RAS_RETURN_PATH({_q931(keepAlive) LAST_TOKEN});
        case cmRASParamTimeToLive:              RAS_RETURN_PATH({_q931(timeToLive) LAST_TOKEN});
        case cmRASParamDelay:                   RAS_RETURN_PATH({_q931(delay) LAST_TOKEN});
        case cmRASParamAlmostOutOfResources:    RAS_RETURN_PATH({_q931(almostOutOfResources) LAST_TOKEN});
        case cmRASParamAlternateGatekeeper:     RAS_RETURN_PATH({_q931(alternateGatekeeper) LAST_TOKEN});
        case cmRASParamAltGKInfo:               RAS_RETURN_PATH({_q931(altGKInfo) _q931(alternateGatekeeper) LAST_TOKEN});
        case cmRASParamAltGKisPermanent:        RAS_RETURN_PATH({_q931(altGKInfo) _q931(altGKisPermanent) LAST_TOKEN});
        case cmRASParamEmpty:                   return NULL;
        case cmRASParamNeedResponse:            RAS_RETURN_PATH({_q931(needResponse) LAST_TOKEN});
        case cmRASParamMaintainConnection:      RAS_RETURN_PATH({_q931(maintainConnection) LAST_TOKEN});
        case cmRASParamMultipleCalls:           RAS_RETURN_PATH({_q931(multipleCalls) LAST_TOKEN});
        case cmRASParamWillRespondToIRR:        RAS_RETURN_PATH({_q931(willRespondToIRR) LAST_TOKEN});
        case cmRASParamSupportsAltGk:           RAS_RETURN_PATH({_q931(supportsAltGK) LAST_TOKEN});
        case cmRASParamAdditiveRegistration:    RAS_RETURN_PATH({_q931(additiveRegistration) LAST_TOKEN});
        case cmRASParamSupportsAdditiveRegistration:RAS_RETURN_PATH({_q931(supportsAdditiveRegistration) LAST_TOKEN});
        case cmRASParamSegmentedResponseSupported:  RAS_RETURN_PATH({_q931(segmentedResponseSupported) LAST_TOKEN});
        case cmRASParamNextSegmentRequested:    RAS_RETURN_PATH({_q931(nextSegmentRequested) LAST_TOKEN});
        case cmRASParamCapacityInfoRequested:   RAS_RETURN_PATH({_q931(capacityInfoRequested) LAST_TOKEN});
        case cmRASParamHopCount:                RAS_RETURN_PATH({_q931(hopCount) LAST_TOKEN});
        case cmRASParamInvalidTerminalAlias:    RAS_RETURN_PATH({_q931(rejectReason) _q931(invalidTerminalAliases) _q931(terminalAlias) LAST_TOKEN});
        case cmRASParamUnregReason:             RAS_RETURN_PATH({_q931(reason) LAST_TOKEN});
        case cmRASParamExtension:               RAS_RETURN_PATH({_q931(remoteExtensionAddress) LAST_TOKEN});

        case cmRASParamRejectReason:
            if (txType != cmRASUnsolicitedIRR)
            {
                RAS_RETURN_PATH({_q931(rejectReason) LAST_TOKEN});
            }
            else /* INAK */
            {
                RAS_RETURN_PATH({_q931(nakReason) LAST_TOKEN});
            }

        case cmRASParamCID:
            if (txType != cmRASServiceControl)
            {
                RAS_RETURN_PATH({_q931(conferenceID) LAST_TOKEN});
            }
            else /* SCI */
                RAS_RETURN_PATH({_q931(callSpecific) _q931(conferenceID) LAST_TOKEN});

        case cmRASParamCallID:
            if (txType != cmRASServiceControl)
            {
                RAS_RETURN_PATH({_q931(callIdentifier) _q931(guid) LAST_TOKEN});
            }
            else /* SCI */
                RAS_RETURN_PATH({_q931(callSpecific) _q931(callIdentifier) _q931(guid) LAST_TOKEN});

        case cmRASParamEndpointType:
        case cmRASParamTerminalType:
            if (txType == cmRASRegistration) /* RRQ */
            {
                RAS_RETURN_PATH({_q931(terminalType) LAST_TOKEN});
            }
            else /* GRQ, IRR */
                RAS_RETURN_PATH({_q931(endpointType) LAST_TOKEN});

        case cmRASParamEndpointAlias:
        case cmRASParamTerminalAlias:
            if (txType == cmRASRegistration) /* RRQ, RCF */
            {
                RAS_RETURN_PATH({_q931(terminalAlias) LAST_TOKEN});
            }
            else /* GRQ, URQ, IRR */
                RAS_RETURN_PATH({_q931(endpointAlias) LAST_TOKEN});

        case cmRASParamAnswerCall:
        case cmRASParamAnsweredCall:
            switch (txType)
            {
                case cmRASAdmission: /* ARQ */
                    RAS_RETURN_PATH({_q931(answerCall) LAST_TOKEN});
                case cmRASServiceControl: /* SCI */
                    RAS_RETURN_PATH({_q931(callSpecific) _q931(answeredCall) LAST_TOKEN});
                default: /* BRQ, DRQ */
                    RAS_RETURN_PATH({_q931(answeredCall) LAST_TOKEN});
            }

        case cmRASParamSrcInfo:
        case cmRASParamSourceInfo:
            if (txType == cmRASAdmission) /* ARQ */
            {
                RAS_RETURN_PATH({_q931(srcInfo) LAST_TOKEN});
            }
            else /* LRQ */
                RAS_RETURN_PATH({_q931(sourceInfo) LAST_TOKEN});

        default:                                break;
    }

    return NULL;
}


/************************************************************************
 * rasGetParamEnumerationValues
 * purpose: Get a pointer to the list of enumeration values in their
 *          fieldId values. Each index in an array represents the enum
 *          value in the API.

⌨️ 快捷键说明

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