epoc32/include/in_iface.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 /**
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file IN_IFACE.H
       
    24 */
       
    25 
       
    26 #if !defined(__IN_IFACE_H__)
       
    27 #define __IN_IFACE_H__
       
    28 
       
    29 #if !defined(__IN_SOCK_H__)
       
    30 #include <in_sock.h>
       
    31 #endif
       
    32 
       
    33 #if !defined(__NIFVAR_H__)
       
    34 #include <nifvar.h>
       
    35 #endif
       
    36 
       
    37 // Feature Flags
       
    38 
       
    39 /**
       
    40 Is a loopback interface
       
    41 @internalAll
       
    42 */
       
    43 const TUint KIfIsLoopback			= 0x00000001;
       
    44 
       
    45 /**
       
    46 Is single point to point
       
    47 @internalAll
       
    48 */
       
    49 const TUint KIfIsPointToPoint		= 0x00000002;
       
    50 
       
    51 /**
       
    52 Supports broadcasting
       
    53 @internalAll
       
    54 */
       
    55 const TUint KIfCanBroadcast			= 0x00000004;
       
    56 
       
    57 /**
       
    58 Supports multicasting
       
    59 @internalAll
       
    60 */	
       
    61 const TUint KIfCanMulticast			= 0x00000008;
       
    62 
       
    63 /**
       
    64 Can have its MTU	set
       
    65 @internalAll
       
    66 */	
       
    67 const TUint KIfCanSetMTU			= 0x00000010;
       
    68 	
       
    69 /**
       
    70 Has a hardware address (ie needs ARP)
       
    71 @internalAll
       
    72 */
       
    73 const TUint KIfHasHardwareAddr		= 0x00000020;	
       
    74 
       
    75 /**
       
    76 Can have its hardware address changed
       
    77 @internalAll
       
    78 */
       
    79 const TUint KIfCanSetHardwareAddr	= 0x00000040;	
       
    80 
       
    81 /**
       
    82 Dialup interface
       
    83 @internalAll
       
    84 */
       
    85 const TUint KIfIsDialup				= 0x00000080;	
       
    86 
       
    87 // Control options level received by network interfaces
       
    88 /** 
       
    89  * Option level for network interface driver options.
       
    90  * @internalTechnology 
       
    91  */
       
    92 const TUint KSOLInterface			= 0x203;
       
    93 
       
    94 // Option names
       
    95 /** 
       
    96  * The current network interface driver operation parameters are written to the 
       
    97  * passed TSoIfInfo structure. 
       
    98  * 
       
    99  * An interface that supports only this is assumed IPv4 only.
       
   100  * 
       
   101  * anOption should be a TPckgBuf<TSoIfInfo>. 
       
   102  * 
       
   103  * @internalTechnology
       
   104  */
       
   105 const TUint KSoIfInfo				= 0x101;		// Get Interface Information
       
   106 
       
   107 /** 
       
   108  * Gets the interface's local hardware address, if the link layer is using addresses.
       
   109  * 
       
   110  * anOption should be a TPckgBuf<TSoIfInfo>.
       
   111  * 
       
   112  * The option is not supported until v7.0. 
       
   113  * 
       
   114  * @internalTechnology
       
   115  */
       
   116 const TUint KSoIfHardwareAddr		= 0x102;		// Get Hardware Address
       
   117 
       
   118 /** 
       
   119  * Gets the current network interface driver configuration options.
       
   120  * 
       
   121  * There may be three kind of interfaces: IPv4 only, IPv6 only and hybrid IPv4/IPv6. 
       
   122  * The last one is passing traffic for both protocols and thus accepts either 
       
   123  * family in a single KSoIfConfig call. Hybrid interfaces must be queried twice, 
       
   124  * once for IPv4 and once for IPv6, to get both the IPv4 and the IPv6 settings.
       
   125  * 
       
   126  * For IPv4, anOption should be a TPckgBuf<TSoInetIfConfig>, for IPv6 TPckgBuf<TSoInet6IfConfig>.
       
   127  * 
       
   128  * The iFamily field in either TSoInetIfConfig or TSoInet6IfConfig must be set 
       
   129  * to either KAfInet for IPv4 or KAfInet6 for IPv6) before the call. If the family 
       
   130  * is not supported by the interface, it returns KErrNotSupported. 
       
   131  * 
       
   132  * @internalTechnology
       
   133  */
       
   134 const TUint KSoIfConfig				= 0x103;		// Get Network parameters
       
   135 
       
   136 /** 
       
   137  * For the IPv4 only stack, compares the passed address with the current local 
       
   138  * address, and returns KErrBadName if not equal.
       
   139  * 
       
   140  * anOption should be a TPckgBuf< TInetAddr >.
       
   141  * 
       
   142  * This is not used for the IPv4/v6 stack. 
       
   143  * 
       
   144  * @internalTechnology
       
   145  */
       
   146 const TUint KSoIfCompareAddr		= 0x104;		// Compare address with one passed in
       
   147 
       
   148 /** Retrieve IAP and NID information 
       
   149  * 
       
   150  * @internalTechnology
       
   151  */
       
   152 const TUint KSoIfGetConnectionInfo	= 0xf001;		// Retrieve IAP and NID information
       
   153 
       
   154 /**
       
   155 @internalComponent
       
   156 */
       
   157 const TUint KMaxInterfaceName=32;
       
   158 
       
   159 /** 
       
   160  * Holds the name of a network interface. 
       
   161  * 
       
   162  * This is used in TSoIfInfo. 
       
   163  * 
       
   164  * @internalTechnology
       
   165  */
       
   166 typedef TBuf<KMaxInterfaceName> TInterfaceName;
       
   167 
       
   168 class TInetIfConfig
       
   169 // Information which allows IP to enter route table entries
       
   170 /** 
       
   171  * Describes the IP routing options for a network interface. 
       
   172  * 
       
   173  * It is used in TSoInetIfConfig. 
       
   174  * 
       
   175  * @internalComponent
       
   176  */
       
   177 	{
       
   178 public:
       
   179 	/** Interface IP address. */
       
   180 	TInetAddr iAddress;
       
   181 	/** IP netmask. */
       
   182 	TInetAddr iNetMask;
       
   183 	/** IP broadcast address. */
       
   184 	TInetAddr iBrdAddr;
       
   185 	/** IP default gateway or peer address (if known). */
       
   186 	TInetAddr iDefGate;
       
   187 	/** IP primary name server (if any). */
       
   188 	TInetAddr iNameSer1;
       
   189 	/** IP secondary name server (if any). */
       
   190 	TInetAddr iNameSer2;
       
   191 	};
       
   192 
       
   193 class TSoIfInfo
       
   194 // Socket option structure for KSoIfInfo
       
   195 /** 
       
   196  * Current network interface operation parameters.
       
   197  * 
       
   198  * It is returned by RSocket::GetOpt(), when that function is called with anOptionLevel 
       
   199  * set to KSOLInterface and anOptionName set to KSoIfInfo. 
       
   200  *
       
   201  * @internalTechnology
       
   202  */
       
   203 	{
       
   204 public:
       
   205 	/** Feature flags. Possible values are defined in in_iface.h. */
       
   206 	TUint iFeatures;		// Feature flags
       
   207 	/** Maximum transmission unit. */
       
   208 	TInt iMtu;				// Max frame size
       
   209 	/** An approximation of the interface speed in Kbps. */
       
   210 	TInt iSpeedMetric;		// Indication of performance, approx to Kbps
       
   211 	/** Interface protocol name, ipcp::\<port\>. */
       
   212 	TInterfaceName iName;
       
   213 	};
       
   214 
       
   215 class TSoIfHardwareAddr
       
   216 // Socket option structure for KSoIfHardwareAddr 
       
   217 /** 
       
   218  * An interface's local hardware address.
       
   219  * 
       
   220  * This is obtained using KSoIfHardwareAddr. 
       
   221  *
       
   222  * @internalComponent
       
   223  */
       
   224 	{
       
   225 public:
       
   226 	/** Local hardware address. */
       
   227 	TSockAddr iHardwareAddr;
       
   228 	};
       
   229 
       
   230 class TSoIfConfigBase
       
   231 /** 
       
   232  * Base class for TSoInetIfConfig, which simply identifies the protocol family 
       
   233  * using the interface. 
       
   234  *
       
   235  * @internalComponent
       
   236  */
       
   237 	{
       
   238 public:
       
   239 	/** The protocol family, e.g. KAfInet. */
       
   240 	TUint iFamily;
       
   241 	};
       
   242 
       
   243 class TSoInetIfConfig : public TSoIfConfigBase
       
   244 /** 
       
   245  * Describes the current interface routing configuration. 
       
   246  * 
       
   247  * It is returned by RSocket::GetOpt(), when this function is called with anOptionLevel 
       
   248  * set to KSOLInterface and anOptionName set to KSoIfConfig. 
       
   249  *
       
   250  * @internalTechnology
       
   251  */
       
   252 	{
       
   253 public:
       
   254 	/** Current interface routing configuration parameters. */
       
   255 	TInetIfConfig iConfig;
       
   256 	};
       
   257 
       
   258 enum TIfProgressNotification
       
   259 /**
       
   260  * @internalAll
       
   261  *
       
   262  * @deprecated v7.0s - maintained for compatibility with v6.1
       
   263  *
       
   264  * New software should use the progress ranges defined in nifvar.h
       
   265  *
       
   266  */
       
   267 	{
       
   268 	EIfProgressLinkUp = KMinInterfaceProgress,
       
   269 	EIfProgressLinkDown,
       
   270 	EIfProgressAuthenticationComplete
       
   271 	};
       
   272 
       
   273 /**
       
   274 @internalAll
       
   275 */
       
   276 const TInt KErrIfAuthenticationFailure = -3050;
       
   277 
       
   278 /**
       
   279 @internalComponent
       
   280 */
       
   281 const TInt KErrIfAuthNotSecure         = -3051;
       
   282 
       
   283 /**
       
   284 @internalComponent
       
   285 */
       
   286 const TInt KErrIfAccountDisabled       = -3052;
       
   287 
       
   288 /**
       
   289 @internalComponent
       
   290 */
       
   291 const TInt KErrIfRestrictedLogonHours  = -3053;
       
   292 
       
   293 /**
       
   294 @internalComponent
       
   295 */
       
   296 const TInt KErrIfPasswdExpired         = -3054;
       
   297 
       
   298 /**
       
   299 @internalComponent
       
   300 */
       
   301 const TInt KErrIfNoDialInPermission    = -3055;
       
   302 
       
   303 /**
       
   304 @internalComponent
       
   305 */
       
   306 const TInt KErrIfChangingPassword      = -3056;
       
   307 
       
   308 /**
       
   309 @internalComponent
       
   310 */
       
   311 const TInt KErrIfCallbackNotAcceptable = -3057;
       
   312 
       
   313 /**
       
   314 @internalComponent
       
   315 */
       
   316 const TInt KErrIfDNSNotFound		   = -3058;
       
   317 
       
   318 /**
       
   319 @internalComponent
       
   320 */
       
   321 const TInt KErrIfLRDBadLine			   = -3059;   
       
   322 
       
   323 #endif // __IN_IFACE_H__