LibSip_SIPTypesAndValues.ttcn 61.1 KB
Newer Older
 *  @author   STF 346, STF366, STF368, STF369, STF450
rennoch's avatar
rennoch committed
 *  @desc     This module defines message, header, structured and simple SIP
 *            types as well constants used by LipSip constructs. <br>
 *            Note that any changes made to the definitions in this module
 *            may be overwritten by future releases of this library
rennoch's avatar
rennoch committed
 *            End users are encouraged to contact the distributers of this
 *            module regarding their modifications or additions
 *            This module is part of LibSipV2.
 *  @remark   Adding of new message and header types is ok;
rennoch's avatar
rennoch committed
 *            Adding of new optional header fields in @see MessageHeader type
 *            is ok but should be done at same time as dummy template updates;
 *            Existing message or header types shall not be changed or removed -
 *            change requests shall be made to http://t-ort.etsi.org
rennoch's avatar
rennoch committed
module LibSip_SIPTypesAndValues
rennoch's avatar
rennoch committed
  import from LibSip_MessageBodyTypes all;
rennoch's avatar
rennoch committed
group Constants
{
group SimpleConstants
    {
      // SIP name protocol plus version
      const charstring c_sipNameVersion := "SIP/2.0";
      
      // SIP name protocol
      const charstring c_sipName := "SIP";
      
      // SIP version
      const charstring c_sipVersion := "2.0";
      
      // SIP scheme
      const charstring c_sipScheme := "sip";
      
rennoch's avatar
rennoch committed
      // TEL scheme
      const charstring c_telScheme := "tel";
rennoch's avatar
rennoch committed
      // URN schema
      const charstring c_urnScheme := "urn";

      // TAG_ID
      const charstring c_tagId := "tag";
      
      // BRANCH_ID
      const charstring c_branchId := "branch";
      
      // BRANCH_COOKIE
      const charstring c_branchCookie := "z9hG4bK";
      
      // EXPIRES_ID
      const charstring c_expiresId := "expires";
      
      // MADDR_ID
      const charstring c_maddrId := "maddr";
      
      // METHOD_ID
      const charstring c_methodId := "method";
      
      // RECEIVED_ID
      const charstring c_receivedId := "received";
      
      // TTL_ID
      const charstring c_ttlId := "ttl";
      
      // USER_ID
      const charstring c_userId := "user";
      
      // SDP name application
      const charstring c_sdpAplication := "application/sdp";
      
rennoch's avatar
rennoch committed
      // XML name application
      const charstring c_xmlAplication := "application/xml";
      // XML name application
      const charstring c_xmlreginfoAplication := "application/reginfo+xml";
rennoch's avatar
rennoch committed

      // MIME name application
      const charstring c_mimeMultipart := "multipart/mixed";

      // IMS 3GPP name application
      const charstring c_ims3gppAplication := "application/3gpp-ims+xml";

      // IMS 3GPP name CW application
      const charstring c_ims3gppCwApplication := "application/vnd.3gpp.cw+xml";

      // IMS ETSI name MCID application
      const charstring c_imsEtsiMcidApplication := "application/vnd.etsi.mcid+xml";
rennoch's avatar
rennoch committed

      // IMS ETSI name CUG application
      const charstring c_imsEtsiCugApplication := "application/vnd.etsi.cug+xml";
rennoch's avatar
rennoch committed

      // IMS ETSI name Simservs application(TIP/TIR, ACR, CDIV, OIP/OIR, CUG)
      const charstring c_imsEtsiSimservsApplication := "application/vnd.etsi.simservs+xml";
rennoch's avatar
rennoch committed
      // OCTET-STREAM name application
      const charstring c_octetAplication := "application/octet-stream";

      // PLAIN-TEXT name application
rennoch's avatar
rennoch committed
      const charstring c_plainText := "text/plain";

      //text content of 1300 bytes for messages with message body
      const charstring c_longMessageContent_1300Bytes :=//"Hello!";
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"&
rennoch's avatar
rennoch committed

 
      // Default SIP port number : 5060
      const integer c_defaultSipPort := 5060;
      
      // Default SIP protocol : UDP
      const charstring c_defaultSipProt := "UDP";
      
      // Fixed IP multicast address
      const charstring c_mcastSipIpaddr := "224.0.1.75";
      
      // Short delta-second used in expires parameter to acknowledge a registration
      const charstring c_shortRegistration := "3600";
rennoch's avatar
rennoch committed
      // ([RFC3891]Sec 6.1)
      const charstring c_earlyFlag := "early-only";
rennoch's avatar
rennoch committed
      // option tag replaces ([RFC3261])
      const charstring c_replaces := "replaces";
rennoch's avatar
rennoch committed
      // option tag 100rel (reliable provisional response [RFC3262])
      const charstring c_tag100rel := "100rel";
rennoch's avatar
rennoch committed
      // option tag from-change ([RFC4916])
      const charstring c_tagFromChange := "from-change";
rennoch's avatar
rennoch committed
      // option tag precondition (ch.11 [RFC3312])
      const charstring c_tagPrecond := "precondition";
rennoch's avatar
rennoch committed
      // due to problem with TAU compiler because hardcoded return statement constant is created
      const HostPort c_hostport_dummy := {host:="", portField:=c_defaultSipPort};
rennoch's avatar
rennoch committed
      // CLIP/CLIR information
      const PrivacyValue c_privacy_none := "none";
      const PrivacyValue c_privacy_id := "id";
      const PrivacyValue c_privacy_header := "header";
      const PrivacyValue c_privacy_user := "user";
      const PrivacyValue c_privacy_critical := "critical";
      const PrivacyValue c_privacy_session := "session";
rennoch's avatar
rennoch committed

      // @ (at) sign
      const charstring c_AT := "@";
      //MRO
      const charstring c_SP := oct2char('20'O);
      const charstring c_SLASH := oct2char('2F'O);
      const charstring c_LT := oct2char('3C'O);
      const charstring c_GT := oct2char('3E'O);

      // * (wildchard) sign
      const charstring c_WILDCARD := "*";

      const integer c_CRlen := 2; // length of new line (0d0a)

      const GenericParam c_Integrity_protected_yes := {"integrity-protected","yes"}
      const GenericParam c_Integrity_protected_no := {"integrity-protected","no"}
      const GenericParam c_Integrity_protected_ip_assoc_pending := {"integrity-protected","ip-assoc-pending"}


} //end group SimpleConstants

group AuthorizationConstants {
rennoch's avatar
rennoch committed

    const charstring c_ik := "";
    const charstring c_ck := "";
    const charstring c_algorithm := "MD5";
    const charstring c_nonce := "";
    const charstring c_nonce_value := "0edff6c521cc3f407f2d9e01cf6ed82b";

} //end group AuthorizationConstants

group PChargingVectorConstants {
rennoch's avatar
rennoch committed

    const charstring c_icid := "icid-value";
    const charstring c_icid_value := "123abc";
    const charstring c_icid_generated_at := "icid-generated-at";
    const charstring c_orig_ioi := "orig-ioi";
    const charstring c_term_ioi := "term-ioi";

} //end group PChargingVectorConstants

group HeaderFieldConstants {

rennoch's avatar
rennoch committed
    const CallId    c_empty_CallId :=
    {
      fieldName := CALL_ID_E,
      callid := ""
    };

    const ContentType   c_empty_ContentType :=
    {
      fieldName := CONTENT_TYPE_E,
      mediaType := ""
    };

    const CSeq  c_empty_cSeq := {
        fieldName := CSEQ_E,
        seqNumber:=0,
        method:="EMPTY" };

    const From  c_empty_From := {
      fieldName := FROM_E,
      addressField := {
        nameAddr := {
          displayName := omit,
          addrSpec := {
            scheme  := c_sipScheme,
            components := {
              sip := {
                userInfo := omit ,
                hostPort := {host:="127.0.0.1", portField:=c_defaultSipPort}
              }
            },
            urlParameters := omit,
            headers := omit
          }
        }
      },
      fromParams := omit
    };

    const MaxForwards c_maxForwards70 := {fieldName:=MAX_FORWARDS_E, forwards:=70}

    const SipUrl c_empty_RequestUri :=
    {
      scheme  := c_sipScheme,
      components := {
        sip := {
          userInfo := omit ,
          hostPort := {host:="127.0.0.1", portField:=c_defaultSipPort}
        }
      },
      urlParameters := omit,
      headers := omit
    };

    const SipUrl c_unavailableUri :=
    {
      scheme  := c_sipScheme,
      components := {
        sip := {
          userInfo := {userOrTelephoneSubscriber:="unavailable", password:=omit},
          hostPort := {host:="anonymous.invalid", portField:=c_defaultSipPort}
        }
      },
      urlParameters := omit,
      headers := omit
    };

    const To    c_empty_To :=
    { // value of To header
      fieldName := TO_E,
      addressField := {
        nameAddr := {
          displayName := omit,
          addrSpec := {
            scheme  := c_sipScheme,
            components := {
              sip := {
                userInfo := omit ,
                hostPort := {host:="127.0.0.1", portField:=c_defaultSipPort}
              }
            },
            urlParameters := omit,
            headers := omit
          }
        }
      },
      toParams := omit
    };

    const Via c_empty_Via := {
      fieldName := VIA_E,
      viaBody :={
        {sentProtocol := {
            protocolName := c_sipName,
            protocolVersion := c_sipVersion,
            transport := c_defaultSipProt
          },
          sentBy := {host:="127.0.0.1", portField:=c_defaultSipPort},
          viaParams:= omit
        }
      }};

rennoch's avatar
rennoch committed
      // number of user profile from 1-10 for SIP profile
      const integer c_userProfile_SIP1_home := 1;
      const integer c_userProfile_SIP2_home := 2;

} //end group UserProfileConstants

group StatusLines
rennoch's avatar
rennoch committed
    {
        const StatusLine c_statusLine100    :=  {c_sipNameVersion, 100, "Trying"};
        const StatusLine c_statusLine180    :=  {c_sipNameVersion, 180, "Ringing"};
        const StatusLine c_statusLine181    :=  {c_sipNameVersion, 181, "Call Is Being Forwarded"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine182    :=  {c_sipNameVersion, 182, "Queued"};
        const StatusLine c_statusLine183    :=  {c_sipNameVersion, 183, "Session Progress"};

        const StatusLine c_statusLine200    :=  {c_sipNameVersion, 200, "OK"};
        const StatusLine c_statusLine202    :=  {c_sipNameVersion, 202, "Accepted"};

        const StatusLine c_statusLine300    :=  {c_sipNameVersion, 300, "Multiple Choices"};
        const StatusLine c_statusLine301    :=  {c_sipNameVersion, 301, "Moved Permanently"};
        const StatusLine c_statusLine302    :=  {c_sipNameVersion, 302, "Moved Temporarily"};
        const StatusLine c_statusLine305    :=  {c_sipNameVersion, 305, "Use Proxy"};
        const StatusLine c_statusLine380    :=  {c_sipNameVersion, 380, "Alternative Service"};

        const StatusLine c_statusLine400    :=  {c_sipNameVersion, 400, "Bad Request"};
        const StatusLine c_statusLine401    :=  {c_sipNameVersion, 401, "Unauthorized"};
        const StatusLine c_statusLine402    :=  {c_sipNameVersion, 402, "Payment Required"};
        const StatusLine c_statusLine403    :=  {c_sipNameVersion, 403, "Forbidden"};
        const StatusLine c_statusLine404    :=  {c_sipNameVersion, 404, "Not Found"};
        const StatusLine c_statusLine405    :=  {c_sipNameVersion, 405, "Method Not Allowed"};
        const StatusLine c_statusLine406    :=  {c_sipNameVersion, 406, "Not Acceptable"};
        const StatusLine c_statusLine407    :=  {c_sipNameVersion, 407, "Proxy Authentication Required"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine408    :=  {c_sipNameVersion, 408, "Request Timeout"};
        const StatusLine c_statusLine410    :=  {c_sipNameVersion, 410, "Gone"};
        const StatusLine c_statusLine413    :=  {c_sipNameVersion, 413, "Request Entity Too Large"};
        const StatusLine c_statusLine414    :=  {c_sipNameVersion, 414, "Request-URI Too Long"};
        const StatusLine c_statusLine415    :=  {c_sipNameVersion, 415, "Unsupported Media Type"};
        const StatusLine c_statusLine416    :=  {c_sipNameVersion, 416, "Unsupported URI Scheme"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine420    :=  {c_sipNameVersion, 420, "Bad Extension"};
        const StatusLine c_statusLine421    :=  {c_sipNameVersion, 421, "Extension Required"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine422    :=  {c_sipNameVersion, 422, "Session Interval Too Small"};
        const StatusLine c_statusLine423    :=  {c_sipNameVersion, 423, "Interval Too Brief"};
        const StatusLine c_statusLine433    :=  {c_sipNameVersion, 433, "Anonymity Disallowed"};
        const StatusLine c_statusLine480    :=  {c_sipNameVersion, 480, "Temporarily Unavailable"};
        const StatusLine c_statusLine481    :=  {c_sipNameVersion, 481, "Call/Transaction Does Not Exist"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine482    :=  {c_sipNameVersion, 482, "Loop Detected"};
        const StatusLine c_statusLine483    :=  {c_sipNameVersion, 483, "Too Many Hops"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine484    :=  {c_sipNameVersion, 484, "Address Incomplete"};
        const StatusLine c_statusLine485    :=  {c_sipNameVersion, 485, "Ambiguous"};
        const StatusLine c_statusLine486    :=  {c_sipNameVersion, 486, "Busy Here"};
        const StatusLine c_statusLine487    :=  {c_sipNameVersion, 487, "Request Terminated"};
        const StatusLine c_statusLine488    :=  {c_sipNameVersion, 488, "Not Acceptable Here"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine493    :=  {c_sipNameVersion, 493, "Undecipherable"};
        const StatusLine c_statusLine500    :=  {c_sipNameVersion, 500, "Server Internal Error"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine501    :=  {c_sipNameVersion, 501, "Not implemented"};
        const StatusLine c_statusLine502    :=  {c_sipNameVersion, 502, "Bad Gateway"};
        const StatusLine c_statusLine503    :=  {c_sipNameVersion, 503, "Service Unavailable"};
        const StatusLine c_statusLine504    :=  {c_sipNameVersion, 504, "Server Time-out"};
        const StatusLine c_statusLine505    :=  {c_sipNameVersion, 505, "Version Not Supported"};
        const StatusLine c_statusLine513    :=  {c_sipNameVersion, 513, "Message Too Large"};
        const StatusLine c_statusLine580    :=  {c_sipNameVersion, 580, "Precondition Failure"};
rennoch's avatar
rennoch committed
        const StatusLine c_statusLine600    :=  {c_sipNameVersion, 600, "Busy Everywhere"};
        const StatusLine c_statusLine603    :=  {c_sipNameVersion, 603, "Decline"};
        const StatusLine c_statusLine604    :=  {c_sipNameVersion, 604, "Does Not Exist Anywhere"};
        const StatusLine c_statusLine606    :=  {c_sipNameVersion, 606, "Not Acceptable"};
rennoch's avatar
rennoch committed

} //end StatusLines
rennoch's avatar
rennoch committed
        const charstring c_Ringing := "Ringing";
        const charstring c_uPlane := "uPlane";
        const charstring c_sync1 := "sync1";
        const charstring c_sync2 := "sync2";
        const charstring c_sync3 := "sync3";
        const charstring c_sync4 := "sync4";
        const charstring c_uPlaneStop := "uPlaneStop";
        const charstring c_annoucA := "announcementA";
        const charstring c_annoucB := "announcementB";
        const charstring c_annouc := "announcement";
        const charstring c_voicem := "voiceMessage";
} //end group Constants

group Types {
group SubTypes{// Subtypes
    
    group TokenTypes // TokensTypes
    {
      // [20]
      type enumerated FieldName
      {
        ACCEPT_E,
        ACCEPT_ENCODING_E,
        ACCEPT_LANGUAGE_E,
        ALERT_INFO_E,
        ALLOW_E,
        AUTHENTICATION_INFO_E,
        AUTHORIZATION_E,
        CALL_ID_E,
        CALL_INFO_E,
        CONTACT_E,
        CONTENT_DISPOSITION_E,
        CONTENT_ENCODING_E,
        CONTENT_LANGUAGE_E,
        CONTENT_LENGTH_E,
        CONTENT_TYPE_E,
        CSEQ_E,
        DATE_E,
        ERROR_INFO_E,
        EXPIRES_E,
        FROM_E,
        IN_REPLY_TO_E,
        MAX_FORWARDS_E,
        MIME_VERSION_E,
        MIN_EXPIRES_E,
        ORGANIZATION_E,
        PRIORITY_E,
        PROXY_AUTHENTICATE_E,
        PROXY_AUTHORIZATION_E,
        PROXY_REQUIRE_E,
        RECORD_ROUTE_E,
        REPLY_TO_E,
        REQUIRE_E,
        RETRY_AFTER_E,
        ROUTE_E,
        SERVER_E,
        SUBJECT_E,
        SUPPORTED_E,
        TIMESTAMP_E,
        TO_E,
        UNSUPPORTED_E,
        USER_AGENT_E,
        VIA_E,
        WARNING_E,
        WWW_AUTHENTICATE_E,
        
rennoch's avatar
rennoch committed
        // [3262/7.1]
        RACK_E,
        RSEQ_E,

        // [3265/7.2]
        ALLOW_EVENTS_E,
        EVENT_E,
        SUBSCRIPTION_STATE_E,

        // [3313]
        P_MEDIA_AUTHORIZATION_E,

        // [3323]
        PRIVACY_E,

        // [3325]
        P_ASSERTED_ID_E,
        P_PREFERRED_ID_E,
rennoch's avatar
rennoch committed

        // [3326]
        REASON_E,

        // [3515] - REFER method
        REFER_TO_E,

        // [4488] - REFER method
        REFER_SUB_E,

        // [3891]
        REPLACES_E,

        // [3892] - REFER method
        REFERRED_BY_E,

        // [4244]
        HISTORY_INFO_E,

        // [3313]
        P_MEDIA_AUTH_E,

        // [3327]
        PATH_E,

        // [3329]
        SECURITY_CLIENT_E,
        SECURITY_SERVER_E,
        SECURITY_VERIFY_E,

        // [3455]
        P_ACCESS_NETWORK_INFO_E,
        P_ASSOCIATED_URI_E,
        P_CALLED_PARTY_E,
        P_CHARGING_FUNCTION_ADDRESSES_E,
        P_CHARGING_VECTOR_E,
        P_VISITED_NETWORK_E,

        // [3608]
        SERVICE_ROUTE_E,

        // [3841]
        ACCEPT_CONTACT_E,
        REQUEST_DISPOSITION_E,

        // [4028]
        MIN_SE_E,
        SESSION_EXPIRES_E,

        P_ASSERTED_SERVICE_E,

        //[5009]
        P_EARLY_MEDIA_E,

        //http://tools.ietf.org/html/draft-johnston-sipping-cc-uui-07
        //Transporting User to User Call Control Information in SIP for ISDN Interworking
        USER_TO_USER_E,
        
        //[6442] /* @sic R5-133151 update of header fields sic@ */
        GEOLOCATION_E,
        GEOLOCATION_ROUTING_E, 
rennoch's avatar
rennoch committed
        
        SESSION_ID_E,
rennoch's avatar
rennoch committed
        SIP_ETAG_E,
        SIP_IF_MATCH_E
      }
      
      // [7.1]
      type enumerated Method {
          ACK_E,
          BYE_E,
          CANCEL_E,
          INVITE_E,
          OPTIONS_E,
          REGISTER_E,
          PRACK_E, // Note: this element is not defined in [5]
          SUBSCRIBE_E, NOTIFY_E, // [3265]
          PUBLISH_E, // [3903/12]
          REFER_E, // [3515]
          UPDATE_E, // [3311]
          MESSAGE_E, // [3428]
          INFO_E,   // [2976]
          UNKNOWN_METHOD_E
          }

      // [20.1, 20.3, 20.4, 20.7, 20.9, 20.10, 20.11, 20.18, 20.20, 20.27, 20.28, 20.30, 20.31,
      // 20.33, 20.34, 20.39, 20.42, 20.44]
      type record GenericParam
      {
        charstring                 id,
        charstring                paramValue optional
      }
      
      // [?]
      type set of GenericParam SemicolonParam_List;
      
      // [?]
      type set of GenericParam AmpersandParam_List;
      
      // [?]
      type set of GenericParam CommaParam_List;
      
      // [20.10, 20.20, 20.30, 20.31, 20.34, 20.39, 20.42, 20.43]
      type record HostPort
      {
        charstring             host optional,                // hostname, IPv4 or IPv6
        integer                portField optional        // represented as an integer
      }
      
      // [20.10, 20.20, 20.30, 20.31, 20.34, 20.39]
rennoch's avatar
rennoch committed
/**
rennoch's avatar
rennoch committed
 *
rennoch's avatar
rennoch committed
 * @desc identifier for user or telephone subscriber
 * @member userOrTelephoneSubscriber provides the username or a phone name identifying the subscriber
 * @member password related password information
rennoch's avatar
rennoch committed
 *
rennoch's avatar
rennoch committed
 */
     type record UserInfo
rennoch's avatar
rennoch committed
        charstring         userOrTelephoneSubscriber,
        charstring         password optional
      }
      
      // [19.1.1 ;used in: 20.10, 20.20, 20.30, 20.31, 20.34, 20.39]
rennoch's avatar
rennoch committed


/**
rennoch's avatar
rennoch committed
 *
 * @desc Uniform Resource Identifier (URI)
 * @member scheme distinguishes call types, e.g. voice, fax etc. or related address scheme, e.g. tel, sip
 * @member userInfo Contains user information (also in non-SIP URLs) with optional parameter as passwords
 * @member hostPort Hostname or IP address information and port identifier of the target
 * @member urlParameters Contains either SIP or TEL URL parameters, separated by semicolons, e.g. transport=tcp or user=phone
rennoch's avatar
rennoch committed
 * @member headers Additional information added after the parameters, e.g. priority=urgent
 */
rennoch's avatar
rennoch committed

      type record SipUriComponents {   // sip-uri acc. to RFC 3261 cl. 19.1
        UserInfo        userInfo optional,
        HostPort        hostPort
      }

      type record TelUriComponents {   // tel-uri acc. to RFC 3966
        charstring      subscriber
      }
    
      type record UrnUriComponents {   // urn-uri acc. to RFC 2141
        charstring      namespaceId,   // e.g. "service" as acc. to RFC 5031
        charstring      namespaceSpecificString    // e.g. "sos"
      }
    
      type union UriComponents {
        SipUriComponents   sip,    // scheme: "sip" or sips"
        TelUriComponents   tel,    // scheme: "tel"
        UrnUriComponents   urn,    // scheme: "urn"
        charstring         other   // scheme: none of the above schemes
      }
        
rennoch's avatar
rennoch committed
        charstring      scheme,          // e.g "sip" or "tel"
        UriComponents   components,      // corresponding to the scheme
        SemicolonParam_List urlParameters optional,
        AmpersandParam_List headers optional
rennoch's avatar
rennoch committed

      // [20.1, RFC2616 14.1]
      type record AcceptBody
      {
rennoch's avatar
rennoch committed
        charstring      mediaRange,
        SemicolonParam_List acceptParam optional
      }
      
      // [20.1, RFC2616 14.1]
      type set of AcceptBody AcceptBody_List;
      
      // [20.4]
      type record AlertInfoBody
      {
rennoch's avatar
rennoch committed
        charstring          url,    // any URI
        SemicolonParam_List genericParams optional
      }
      
      // [20.4]
      type set of AlertInfoBody AlertInfoBody_List;
      
      // [20.8]
      type charstring CallidString;    // token ["@" token]
      
      // [20.8]
      type set of CallidString CallidString_List;
      
      // [20.9]
      type record CallInfoBody
      {
rennoch's avatar
rennoch committed
        charstring          url,    // any URI
        SemicolonParam_List     infoParams optional
      }
      
      // [20.9]
      type set of CallInfoBody CallInfoBody_List;
      
      // [20.27, 20.44, .......10.32, 10.48; RFC2616 14.33, 14.47; RFC2617 1.2]
      type union Challenge
      {
        CommaParam_List digestCln,
rennoch's avatar
rennoch committed
        OtherAuth   otherChallenge
      }
      
      // [20.10, 20.20, 20.30, 20.31, 20.34, 20.39]
      type record NameAddr
      {
rennoch's avatar
rennoch committed
        charstring  displayName optional,
        SipUrl      addrSpec
      }
      
      // [20.10, 20.20, 20.31, 20.39]
      type union Addr_Union
      {
rennoch's avatar
rennoch committed
        NameAddr    nameAddr,
        SipUrl      addrSpecUnion // STS: "Union" added to filed name to avoid dangerous name equivalence with 2nd NameAddr field
      }
      
      // [20.10]
      type record ContactAddress
      {
rennoch's avatar
rennoch committed
        Addr_Union      addressField,
        SemicolonParam_List contactParams optional
      }
      
      // [20.10]
      type set of ContactAddress ContactAddress_List; // 1 or more elements
      
      // [20.10]
      type union ContactBody
      {
rennoch's avatar
rennoch committed
        charstring      wildcard,
        ContactAddress_List contactAddresses
      }
      
      // [20.2, 20.12; RFC2616 14.3, 14.11]
      type charstring ContentCoding;
      
      // [20.2, 20.12; RFC2616 14.3, 14.11]
      type set of ContentCoding ContentCoding_List;
      
      // [20.7, 20.28; RFC2616 14.35 RFC2617 1.2]
      type union Credentials
      {
rennoch's avatar
rennoch committed
        CommaParam_List digestResponse,
        OtherAuth       otherResponse
      // allow multiple Authorization headers due to RFC3261 ch. 20.7 and 20.28
rennoch's avatar
rennoch committed
      type record of Credentials CredentialsList;
      // [20.19, 20.23, 20.33]
rennoch's avatar
rennoch committed
      type charstring   DeltaSec;   // an external operation can handle this field
      
      // [20.18]
      type record ErrorInfoBody
      {
rennoch's avatar
rennoch committed
        charstring          uri,        // any URI
        SemicolonParam_List     genericParams optional
      }
      
      // [20.18]
      type set of ErrorInfoBody ErrorInfoBody_List;
      
      // [20.3 RFC2616 14.4]
      type record LanguageBody
      {
rennoch's avatar
rennoch committed
        charstring      languageRange,
        SemicolonParam_List acceptParam optional
      }
      
      // [20.3 RFC2616 14.4]
      type set of LanguageBody LanguageBody_List;
      
      // [20.13; RFC2616 14.12]
      type charstring LanguageTag;
      
      // [20.13; RFC2616 14.12]
      type set of LanguageTag LanguageTag_List;
      
      // [20.5]
      type set of charstring Method_List;
      
      
      // [20.29, 20.32, 20.37, 20.40]
      type charstring OptionTag;
      
      // [20.29, 20.32, 20.37, 20.40]
      type set of OptionTag OptionTag_List;
      
      
      // [20.7, 20.27, 20.28, 20.44  ; RFC2616 14.33, 14.47; RFC2617 1.2]
      type record OtherAuth
      {
rennoch's avatar
rennoch committed
        charstring      authScheme,
        CommaParam_List authParams
rennoch's avatar
rennoch committed
        integer     payloadlength,
        charstring      payloadvalue
      }
      
      // [20.30,20.34]
      type record RouteBody
      {
rennoch's avatar
rennoch committed
        NameAddr            nameAddr,
        SemicolonParam_List rrParam optional
      }
      
      // [20.30,20.34]
      type record of RouteBody RouteBody_List;
      
      // [20.42]
      type record SentProtocol
      {
rennoch's avatar
rennoch committed
        charstring      protocolName,
        charstring      protocolVersion,
        charstring      transport
      }
      
      // [20.35, 20.41; RFC2616 14.43]
      type charstring ServerVal;
      
      // [20.35, 20.41; RFC2616 14.43]
      type set of ServerVal ServerVal_List;
      
      // [20.38]
      type record TimeValue
      {
rennoch's avatar
rennoch committed
        integer         majorDigit,     // represented as an integer
        integer         minorDigit optional // represented as an integer
      }
      
      // [20.42]
      type record ViaBody
      {
rennoch's avatar
rennoch committed
        SentProtocol    sentProtocol,
        HostPort        sentBy,
        SemicolonParam_List viaParams optional
      }
      
      // [20.42]
      type record of ViaBody ViaBody_List;
      
      // [20.43]
      type union WarnAgent
      {
rennoch's avatar
rennoch committed
        HostPort        hostPort,
        charstring      pseudonym
      }
      
      // [20.43]
      type record WarningValue
      {
rennoch's avatar
rennoch committed
        integer     warnCode,   // represented as an integer
        WarnAgent       warnAgent,
        charstring      warnText
      }
      
      // [20.43]
      type set of WarningValue WarningValue_List;

rennoch's avatar
rennoch committed
      type Addr_Union PAssertedIDValue;
rennoch's avatar
rennoch committed
      type record of PAssertedIDValue PAssertedIDValue_List;
rennoch's avatar
rennoch committed
      type charstring PAssertedServiceValue;
rennoch's avatar
rennoch committed
      type Addr_Union PPreferredIDValue;
rennoch's avatar
rennoch committed
      type record of PPreferredIDValue PPreferredIDValue_List;
rennoch's avatar
rennoch committed
      type charstring PrivacyValue;
rennoch's avatar
rennoch committed
      type record of PrivacyValue PrivacyValue_List;

      
    } // end group TokensType
    
    
    group HeaderFieldTypes  // Header Fields
    {
rennoch's avatar
rennoch committed
    group CommonHeaderFieldTypes
    {
      // [20.1, RFC2616 14.1]
      type record Accept
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (ACCEPT_E),
        AcceptBody_List         acceptArgs optional
      }
      
      // [20.2, RFC2616 14.3]
      type record AcceptEncoding
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (ACCEPT_ENCODING_E),
        ContentCoding_List  contentCoding optional
      }
      
      // [20.3, RFC2616 14.4]
      type record AcceptLanguage
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (ACCEPT_LANGUAGE_E),
        LanguageBody_List   languageBody optional
      }
      
      // [20.4]
      type record AlertInfo
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (ALERT_INFO_E),
        AlertInfoBody_List  alertInfoBody optional
rennoch's avatar
rennoch committed
        FieldName       fieldName (ALLOW_E),
        Method_List     methods optional
      }
      
      // [20.6]
      type record AuthenticationInfo
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (AUTHENTICATION_INFO_E),
        CommaParam_List ainfo
      }
      
      // [20.7 RFC2617 3.2.2]
      type record Authorization
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (AUTHORIZATION_E),
        CredentialsList body // changed from Credentials to allow multiple Authorization headers
rennoch's avatar
rennoch committed
        FieldName       fieldName (CALL_ID_E),
        CallidString        callid
      }
      
      // [20.9]
      type record CallInfo
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CALL_INFO_E),
        CallInfoBody_List   callInfoBody optional
      }
      
      // [20.10]
      type record Contact
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTACT_E),
        ContactBody     contactBody
      }
      
      // [20.11]
      type record ContentDisposition
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTENT_DISPOSITION_E),
        charstring      dispositionType,
        SemicolonParam_List dispositionParams optional
      }
      
      // [20.12 RFC2616 14.11]
      type record ContentEncoding
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTENT_ENCODING_E),
        ContentCoding_List  contentCoding
      }
      
      // [20.13 RFC2616 14.12]
      type record ContentLanguage
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTENT_LANGUAGE_E),
        LanguageTag_List    languageTag
      }
      
      // [20.14]
      type record ContentLength
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTENT_LENGTH_E),
        integer     len // this field is represented as an integer
      }
      
      // [20.15]
      type record ContentType
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (CONTENT_TYPE_E),
        charstring      mediaType
rennoch's avatar
rennoch committed
        FieldName       fieldName (CSEQ_E),
        integer     seqNumber,  // this field is represented as an integer
        charstring      method
rennoch's avatar
rennoch committed
        FieldName       fieldName (DATE_E),
        charstring      sipDate
      }
      
      // [20.18]
      type record ErrorInfo
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (ERROR_INFO_E),
        ErrorInfoBody_List  errorInfo optional
      }
      
      // [20.19]
      type record Expires
      {
rennoch's avatar
rennoch committed
        FieldName       fieldName (EXPIRES_E),
        DeltaSec        deltaSec
rennoch's avatar
rennoch committed
        FieldName       fieldName (FROM_E),
        Addr_Union      addressField,
        SemicolonParam_List fromParams optional
      }
      
      // [20.21]
      type record InReplyTo
      {