Commit b8081c12 authored by tepelmann's avatar tepelmann
Browse files

Initial checkin.

parent 7d9b61bb
Loading
Loading
Loading
Loading
+192 −0
Original line number Original line Diff line number Diff line
/**
 *  @author   STF 440
 *  @version   $Id$
 *  @desc     This module defines DHCPv6 messages.
 *              DHCPv6 structures have been defined on the basis of RFC 3315
 *              Also it provides some useful constant definitions.
 *  @url        http://www.ietf.org/rfc/rfc3315.txt
 *  
 */
 module LibIpv6_CommonRfcsDhcp_TypesAndValues {
  
  //LibCommon
  import from LibCommon_BasicTypesAndValues all;
  import from LibCommon_DataStrings all;
  //LibIpv6
  import from LibIpv6_Interface_TypesAndValues all;
  import from LibIpv6_CommonRfcs_TypesAndValues all;
  import from LibIpv6_Rfc6334Dhcp_TypesAndValues all;
  import from LibIpv6_Rfc3315Dhcp_TypesAndValues all;

  group dhcpConstants {
    
    //Multicast Addresses
    const Ipv6Address c_all_DHCP_Relay_Agents_and_Servers := 'FF020000000000000000000000010002'O;
    const Ipv6Address c_all_DHCP_Servers := 'FF030000000000000000000000010003'O;
    
    //UDPports
    const UInt16 c_dhcpv6ClientPort := 546;
    const UInt16 c_dhcpv6ServerPort := 547;
    const UInt16 c_dhcpv6RelayPort := 547;
    
    //lifetime
    const TimeStamp c_lifetime_infinity := c_uInt32Max;
    
  } // end dhcpConstants
  
  
  /**
   * @desc DHCP Client/Server Message
   * @reference http://tools.ietf.org/html/rfc3315#section-6
  */  
  type record DHCPv6Msg {
    MsgType         msgType,
    UInt8           hopCount,
    Ipv6Address     linkAddress,
    Ipv6Address     peerAddress,
    DHCPv6Options   options
  } // End of type DHCPv6Msg
  
  /**
   * @desc DHCP Relay Agent/Server Message
   * @reference http://tools.ietf.org/html/rfc3315#section-7
  */  
  type record DHCPv6RelayMsg {
    MsgType         msgType,
    UInt24          transactionId,
    DHCPv6Options   options
  } // End of type DHCPv6Msg
  
  /**
   * @desc DHCP Message Types
   * @reference http://tools.ietf.org/html/rfc3315#section-5.3
   */
  type enumerated MsgType {
    e_SOLICIT (1),
    e_ADVERTISE (2),
    e_REQUEST (3),
    e_CONFIRM (4),
    e_RENEW (5),
    e_REBIND (6),
    e_REPLY (7),
    e_RELEASE (8),
    e_DECLINE (9),
    e_RECONFIGURE (10),
    e_INFORMATION_REQUEST (11),
    e_RELAY_FORW (12),
    e_RELAY_REPL (13),
    e_UNKNOWN
  }
  
  /**
   * @desc Status Codes
   * @reference http://tools.ietf.org/html/rfc3315#section-24.4
   */
  type enumerated StatusCode {
    e_success (0),
    e_unspecFail (1),
    e_noAddrsAvail (2),
    e_noBinding (3),
    e_notOnLink (4),
    e_useMulticast (5),
    e_unknown
  }
  
  group dhcpOptions {
    
    /**
     * @desc DHCP Option in raw format - any option code, data as plain octetstring
     * @reference http://tools.ietf.org/html/rfc3315#section-22.1
     */
    type record DHCPv6OptionRaw {
      UInt8            optionCode,
      UInt16           optionLen,
      octetstring      optionData
    }
    
    /**
     * @desc Collection of options defined in several RFCs.
     */
    type union DHCPv6Option {
      ClientIdentifierOption    clientIdentifer,
      ServerIdentifierOption    serverIdentifier,
      IA_NAOption               ia_na,
      IA_TAOption               ia_ta,
      IA_AddressOption          ia_address,
      OptionRequestOption       optionRequest,
      PreferenceOption          preference,
      ElapsedTimeOption         elapsedTime,
      RelayMessageOption        relayMessage,
      AuthenticationOption      authentication,
      ServerUnicastOption       serverUnicast,
      StatusCodeOption          statusCode,
      RapidCommitOption         rapidCommit,
      UserClassOption           userClass,
      VendorClassOption         vendorClass,
      VendorSpecificInfoOption  vendorSpecificInformation,
      InterfaceIdOption         interfaceId,
      ReconfigureMsgOption      reconfigure,
      ReconfigureAcceptOption   reconfigureAccept,
      AFTRNameOption            aftrName,
      DHCPv6OptionRaw           raw
    }
    
    /**
     * @desc List of options collected from different RFCs.
     */
    type record of DHCPv6Option DHCPv6Options;
    
    /**
     * @desc Collection of option codes defined in several RFCs.
     */
    type enumerated OptionCode {
      e_OPTION_CLIENTID (1),
      e_OPTION_SERVERID (2),
      e_OPTION_IA_NA (3),
      e_OPTION_IA_TA (4),
      e_OPTION_IAADDR (5),
      e_OPTION_ORO (6),
      e_OPTION_PREFERENCE (7),
      e_OPTION_ELAPSED_TIME (8),
      e_OPTION_RELAY_MSG (9),
      e_OPTION_AUTH (11),
      e_OPTION_UNICAST (12),
      e_OPTION_STATUS_CODE (13),
      e_OPTION_RAPID_COMMIT (14),
      e_OPTION_USER_CLASS (15),
      e_OPTION_VENDOR_CLASS (16),
      e_OPTION_VENDOR_OPTS (17),
      e_OPTION_INTERFACE_ID (18),
      e_OPTION_RECONF_MSG (19),
      e_OPTION_RECONF_ACCEPT (20),
      e_OPTION_AFTR_NAME (64),
      e_OPTION_UNKNOWN
    }
    
  } //end group dhcpOptions
  
  group auxilary {
    
    /**
     * @desc A unsigned 32bit timestamp
     */
    type UInt32 TimeStamp;
    
    /**
     * @desc Fully qualified domain name
     * Example encoding for www.example.com:
     * 
     * +------+------+------+------+------+------+------+------+------+
     * | 0x03 |   w  |   w  |   w  | 0x07 |   e  |   x  |   a  |   m  |
     * +------+------+------+------+------+------+------+------+------+
     * |   p  |   l  |   e  | 0x03 |   c  |   o  |   m  | 0x00 |
     * +------+------+------+------+------+------+------+------+
     * 
     * @remark In DHCP the domain name MUST NOT be stored in compressed form.
     * @reference http://tools.ietf.org/html/rfc3315#section-8
     */
    type charstring DomainName;
    
  } //end group auxilary
  
} // end LibIpv6_CommonRfcsDhcp_TypesAndValues
+294 −0
Original line number Original line Diff line number Diff line
/**
 *  @author   STF 440
 *  @version   $Id$
 *  @desc     This module defines RFC3315 specific DHCPv6 definitions.
 *              DHCPv6 structures have been defined on the basis of RFC 3315
 *  @url        http://www.ietf.org/rfc/rfc3315.txt
 *  
 */
 module LibIpv6_Rfc3315Dhcp_TypesAndValues {
  
  //LibCommon
  import from LibCommon_BasicTypesAndValues all;
  import from LibCommon_DataStrings all;
  //LibIpv6
  import from LibIpv6_CommonRfcs_TypesAndValues all;
  import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;

  group dhcpOptions {
    
    /**
     * @desc Client Identifier
     * @reference http://tools.ietf.org/html/rfc3315#section-22.2
     */
    type record ClientIdentifierOption {
      OptionCode        optionCode(e_OPTION_CLIENTID),
      UInt16            optionLen,
      DUID              optionData
    }
    
    /**
     * @desc Server Identifier
     * @reference http://tools.ietf.org/html/rfc3315#section-22.3
     */
    type record ServerIdentifierOption {
      OptionCode        optionCode(e_OPTION_SERVERID),
      UInt16            optionLen,
      DUID              optionData
    }
    
    /**
     * @desc Identity Association for Non-temporary Addresses
     * @reference http://tools.ietf.org/html/rfc3315#section-22.4
     */
    type record IA_NAOption {
      OptionCode        optionCode(e_OPTION_IA_NA),
      UInt16            optionLen,
      UInt32            iaid,
      TimeStamp         t1,
      TimeStamp         t2,
      DHCPv6Options     iA_NA_options
    }
    
    /**
     * @desc Identity Association for Temporary Addresses
     * @reference http://tools.ietf.org/html/rfc3315#section-22.5
     */
    type record IA_TAOption {
      OptionCode        optionCode(e_OPTION_IA_TA),
      UInt16            optionLen,
      UInt32            iaid,
      DHCPv6Options     iA_TA_options
    }
    
    /**
     * @desc IA Address
     * @reference http://tools.ietf.org/html/rfc3315#section-22.6
     */
    type record IA_AddressOption {
      OptionCode        optionCode(e_OPTION_IAADDR),
      UInt16            optionLen,
      Ipv6Address       ipv6Address,
      TimeStamp         preferredLifetime,
      TimeStamp         validLifetime,
      DHCPv6Options     iaAddr_options
    }
    
    /**
     * @desc Option Request
     * @reference http://tools.ietf.org/html/rfc3315#section-22.7
     */
    type record OptionRequestOption {
      OptionCode        optionCode(e_OPTION_ORO),
      UInt16            optionLen,
      record of UInt16  requestedOptionCodes
    }
    
    /**
     * @desc Preference
     * @reference http://tools.ietf.org/html/rfc3315#section-22.8
     */
    type record PreferenceOption {
      OptionCode        optionCode(e_OPTION_PREFERENCE),
      UInt16            optionLen(1),
      UInt8             prefValue
    }
    
    /**
     * @desc Elapsed Time
     * @reference http://tools.ietf.org/html/rfc3315#section-22.9
     */
    type record ElapsedTimeOption {
      OptionCode        optionCode(e_OPTION_ELAPSED_TIME),
      UInt16            optionLen(2),
      UInt16            elapsedTime
    }
    
    /**
     * @desc Relay Message
     * @reference http://tools.ietf.org/html/rfc3315#section-22.10
     */
    type record RelayMessageOption {
      OptionCode        optionCode(e_OPTION_RELAY_MSG),
      UInt16            optionLen,
      DHCPv6Msg         dhcpRelayMessage
    }
    
    /**
     * @desc Authentication
     * @reference http://tools.ietf.org/html/rfc3315#section-22.11
     */
    type record AuthenticationOption {
      OptionCode        optionCode(e_OPTION_AUTH),
      UInt16            optionLen,
      UInt8             protocol,
      UInt8             algorithm,
      UInt8             rDM,
      Oct8              replayDetection,
      octetstring       authInfo
    }
    
    /**
     * @desc Server Unicast
     * @reference http://tools.ietf.org/html/rfc3315#section-22.12
     */
    type record ServerUnicastOption {
      OptionCode        optionCode(e_OPTION_UNICAST),
      UInt16            optionLen(16),
      Ipv6Address       serverAddress
    }
    
    /**
     * @desc Status Code
     * @reference http://tools.ietf.org/html/rfc3315#section-22.13
     */
    type record StatusCodeOption {
      OptionCode        optionCode(e_OPTION_STATUS_CODE),
      UInt16            optionLen,
      StatusCode        statusCode,
      charstring        statusMessage
    }
    
    /**
     * @desc Rapid Commit
     * @reference http://tools.ietf.org/html/rfc3315#section-22.14
     */
    type record RapidCommitOption {
      OptionCode        optionCode(e_OPTION_RAPID_COMMIT),
      UInt16            optionLen(0)
    }
    
    /**
     * @desc User Class
     * @reference http://tools.ietf.org/html/rfc3315#section-22.15
     */
    type record UserClassOption {
      OptionCode        optionCode(e_OPTION_USER_CLASS),
      UInt16            optionLen,
      record {
        UInt16          userClassLen,
        octetstring     opaqueData
      } userClassData
    }
    
    /**
     * @desc Vendor Class
     * @reference http://tools.ietf.org/html/rfc3315#section-22.16
     */
    type record VendorClassOption {
      OptionCode        optionCode(e_OPTION_VENDOR_CLASS),
      UInt16            optionLen,
      UInt32            enterpriseNumber,
      record {
        UInt16          vendorClassLen,
        octetstring     opaqueData
      } vendorClassData
    }
    
    /**
     * @desc Vendor-specific Information
     * @reference http://tools.ietf.org/html/rfc3315#section-22.17
     */
    type record VendorSpecificInfoOption {
      OptionCode        optionCode(e_OPTION_VENDOR_OPTS),
      UInt16            optionLen,
      UInt32            enterpriseNumber,
      DHCPv6OptionRaw   optionData
    }
    
    /**
     * @desc Interface-Id
     * @reference http://tools.ietf.org/html/rfc3315#section-22.18
     */
    type record InterfaceIdOption {
      OptionCode        optionCode(e_OPTION_INTERFACE_ID),
      UInt16            optionLen,
      octetstring       interfaceId
    }
    
    /**
     * @desc Reconfigure Message
     * @reference http://tools.ietf.org/html/rfc3315#section-22.19
     */
    type record ReconfigureMsgOption {
      OptionCode        optionCode(e_OPTION_RECONF_MSG),
      UInt16            optionLen(1),
      MsgType           msgType(e_RENEW, e_INFORMATION_REQUEST)
    }
    
    /**
     * @desc Reconfigure Accept
     * @reference http://tools.ietf.org/html/rfc3315#section-22.20
     */
    type record ReconfigureAcceptOption {
      OptionCode        optionCode(e_OPTION_RECONF_ACCEPT),
      UInt16            optionLen(0)
    }
    
  } //end group dhcpOptions
  
  group auxilary {
    
    /**
     * @desc Raw DHCP Unique Identifier
     */
    type record DUID_Raw {
      UInt8             typeCode,
      octetstring       identifier
    }
    
    /**
     * @desc DUID type code
     */
    type enumerated DUIDType {
      e_DUID_LLT (1),
      e_DUID_EN (2),
      e_DUID_LL (3),
      e_UNKNOWN
    }
    
    /**
     * @desc DUID
     * @reference http://tools.ietf.org/html/rfc3315#section-9.1
     */
    type union DUID {
      DUID_LTT  ltt,
      DUID_EN   en,
      DUID_LL   ll,
      DUID_Raw  raw
    }
    
    /**
     * @desc DUID Based on Link-layer Address Plus Time [DUID-LLT]
     * @reference http://tools.ietf.org/html/rfc3315#section-9.2
     */
    type record DUID_LTT {
      DUIDType          typeCode(e_DUID_LLT),
      UInt16            hardwareType,
      TimeStamp         time,
      octetstring       linkLayerAddress
    }
    
    /**
     * @desc DUID Assigned by Vendor Based on Enterprise Number [DUID-EN]
     * @reference http://tools.ietf.org/html/rfc3315#section-9.3
     */
    type record DUID_EN {
      DUIDType          typeCode(e_DUID_EN),
      UInt32            enterpriseNumber,
      octetstring       identifier
    }
    
    /**
     * @desc DUID Based on Link-layer Address [DUID-LL]
     * @reference http://tools.ietf.org/html/rfc3315#section-9.4
     */
    type record DUID_LL {
      DUIDType          typeCode(e_DUID_LL),
      UInt16            hardwareType,
      octetstring       linkLayerAddress
    }
    
  } //end group auxilary
  
} // end LibIpv6_Rfc3315Dhcp_TypesAndValues
+32 −0
Original line number Original line Diff line number Diff line
/**
 *  @author   STF 440
 *  @version   $Id$
 *  @desc     This module defines RFC6334 specific DHCPv6 definitions.
 *              DHCPv6 structures have been defined on the basis of RFC 6334
 *  @url        http://www.ietf.org/rfc/rfc6334.txt
 *  
 */
 module LibIpv6_Rfc6334Dhcp_TypesAndValues {
  
  //LibCommon
  import from LibCommon_BasicTypesAndValues all;
  import from LibCommon_DataStrings all;
  //LibIpv6
  import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;

  group dhcpOptions {
    
    /**
     * @desc AFTR-Name
     * @reference https://tools.ietf.org/html/rfc6334#section-3
     */
    type record AFTRNameOption {
      OptionCode        optionCode(e_OPTION_AFTR_NAME),
      UInt16            optionLen,
      DomainName        tunnelEndpointName,
      octetstring       padding optional
    }
    
  } //end group dhcpOptions
  
} // end LibIpv6_Rfc3315Dhcp_TypesAndValues