tcpiputils/dhcp/include/DHCPAuthentication.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // DHCPv6/v4 Authentication RFC 3118
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file DHCPAuthentication.h
       
    20 */
       
    21 
       
    22 #ifndef DHCPAUTHENTICATION_H
       
    23 #define DHCPAUTHENTICATION_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include "DhcpIP6Msg.h"
       
    27 //#include "DHCPIP4Msg.h"
       
    28 
       
    29 /*
       
    30 	A client MUST be configurable to discard unauthenticated messages,
       
    31    and SHOULD be configured by default to discard unauthenticated
       
    32    messages if the client has been configured with an authentication key
       
    33    or other authentication information.
       
    34 */
       
    35 namespace DHCPv4
       
    36 {
       
    37 /* 0                   1                   2                   3
       
    38    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       
    39    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    40    |     Code      |    Length     |  Protocol     |   Algorithm   |
       
    41    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    42    |     RDM       | Replay Detection (64 bits)                    |
       
    43    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    44    |  Replay cont.                                                 |
       
    45    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    46    |  Replay cont. |                                               |
       
    47    +-+-+-+-+-+-+-+-+                                               |
       
    48    |                                                               |
       
    49    |      Authentication Information(depends on the Protocol       |
       
    50    |                                                               |
       
    51    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    52 */
       
    53 const TInt  KReqMaxRetry      = 3;  //     Max Request retry attempts
       
    54 }//DHCPv4 namespace
       
    55 
       
    56 namespace DHCPv6
       
    57 {
       
    58 /*   0                   1                   2                   3
       
    59      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       
    60     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    61     |          OPTION_AUTH          |          option-len           |
       
    62     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    63     |   protocol    |   algorithm   |      RDM      |               |
       
    64     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               |
       
    65     |                                                               |
       
    66     |          replay detection (64 bits)           +-+-+-+-+-+-+-+-+
       
    67     |                                               |   auth-info   |
       
    68     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               |
       
    69     .                   authentication information                  .
       
    70     .                       (variable length)                       .
       
    71     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    72 
       
    73       option-code                  OPTION_AUTH (11)
       
    74 
       
    75       option-len                   11 + length of authentication
       
    76                                    information field
       
    77 
       
    78       protocol                     The authentication protocol used in
       
    79                                    this authentication option
       
    80 
       
    81       algorithm                    The algorithm used in the
       
    82                                    authentication protocol
       
    83 
       
    84       RDM                          The replay detection method used in
       
    85                                    this authentication option
       
    86 
       
    87       Replay detection             The replay detection information for
       
    88                                    the RDM
       
    89 
       
    90       authentication information   The authentication information,
       
    91                                    as specified by the protocol and
       
    92                                    algorithm used in this authentication
       
    93                                    option
       
    94 */
       
    95 const TInt KOptionAuthProtocolLength = 1; //(1 bytes)
       
    96 const TInt KOptionAuthAlgorithmLength = 1; //(1 bytes)
       
    97 const TInt KOptionAuthRDMLength = 1; //(1 bytes)
       
    98 const TInt KOptionAuthRDMdataLength = 8; //(8 bytes)
       
    99 
       
   100 class TInterfaceConfigInfo;
       
   101 class CDHCPOptionAuthentication : public CDHCPOptionAny
       
   102 /**
       
   103   * DHCP Authentication option
       
   104   *
       
   105   * @internalTechnology
       
   106   */
       
   107 	{
       
   108 
       
   109 public:
       
   110    CDHCPOptionAuthentication() :
       
   111       CDHCPOptionAny( &iProtocol ),
       
   112       iProtocol( &iAlgorithm, KOptionAuthProtocolLength ),
       
   113       iAlgorithm( &iRDM, KOptionAuthAlgorithmLength ),
       
   114       iRDM( &iRDMdata, KOptionAuthRDMLength ),
       
   115       iRDMdata( NULL, KOptionAuthRDMdataLength )
       
   116       {
       
   117       }
       
   118 
       
   119    static COptionNode* NewL();
       
   120 
       
   121    void CheckL( const TInterfaceConfigInfo& aInterfaceConfigInfo );
       
   122    void InitL( const TInterfaceConfigInfo& aInterfaceConfigInfo );
       
   123 
       
   124 public:
       
   125    CConstItem  iProtocol;
       
   126    CConstItem  iAlgorithm;
       
   127    CConstItem  iRDM;
       
   128    CConstItem  iRDMdata;
       
   129    //trailing authentication data is in CDHCPOptionAny::iOptionData
       
   130 	};
       
   131 
       
   132 }//DHCPv6 namespace
       
   133 
       
   134 #endif
       
   135