1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35
36
37 /*!
38 * ======== Ip ========
39 * NDK Internet Protocol (IP) settings and configuration.
40 *
41 * The Ip module is used to configure settings for IP, as well as other stack
42 * properties which are closely related to IP. The Ip module encompasses
43 * stack settings and configuration for the following catergories:
44 *
45 * @p(blist)
46 * - IP settings - Internet Protocol
47 * - DHCP Client settings - Dynamic Host Configuration Protocol
48 * - ICMP settings - Internet Control Message Protocol
49 * - Route settings
50 * - IP Socket settings
51 * - Data Pipe settings
52 * @p
53 *
54 * To configure the settings of the Ip module, the module must be used in a
55 * RTSC configuration script, as follows:
56 *
57 * @p(code)
58 * var Ip = xdc.useModule('ti.ndk.config.Ip);
59 * @p
60 *
61 * To change settings, simply set the values of the Ip module's members, which
62 * correspond to what needs to be configured. For example, the following
63 * code set a static IP address, increase the time to live value for ICMP
64 * packets to 100 hops, and decrease the maximum number of connections on
65 * a given IP socket down to 4:
66 *
67 * @p(code)
68 * Ip.address = "192.168.1.2";
69 *
70 * Ip.icmpTimeToLive = 100;
71 *
72 * Ip.socketMaxConnections = 4;
73 * @p
74 *
75 * To configure the target to run as a DHCP client, configure the IP address
76 * to be the empty string:
77 *
78 * @p(code)
79 * Ip.address = "";
80 * @p
81 *
82 * To configure the target to run without any IPv4 address (i.e. not as a DHCP
83 * client nor using a static IP), configure the IP address as "none":
84 *
85 * @p(code)
86 * Ip.address = "none";
87 * @p
88 *
89 */
90
91 @Template("./Ip.xdt")
92
93 metaonly module Ip {
94
95 96 97 98
99 const Int defaultStartIndex = 1;
100 const Bool defaultPortForwarding = false;
101 const Bool defaultPortFiltering = false;
102 const Int defaultMaxReasmTime = 10;
103 const Int defaultMaxReasmSize = 3020;
104 const Bool defaultIcmpDoRedir = true;
105 const Int defaultIcmpTTL = 64;
106 const Int defaultIcmpTTLecho = 255;
107 const Bool defaultIcmpBcastReply = false;
108 const Bool defaultIcmpMcastReply = false;
109 const Bool defaultDirBcast = true;
110 const Int defaultRteDownTime = 20;
111 const Int defaultRteKpAliveTime = 1200;
112 const Int defaultRteCloneTimeout = 120;
113 const Int defaultRteMtu = 64;
114 const Bool defaultRteCtrlDbg = false;
115 const Int defaultRteAdverPer = 0;
116 const Int defaultRteAdverLife = 120;
117 const Int defaultRteAdverLvl = 0;
118 const Int defaultSockTTL = 64;
119 const Int defaultSockTos = 0;
120 const Int defaultSockMaxConn = 8;
121 const Int defaultSockConnTimeout = 80;
122 const Int defaultSockIoTimeout = 0;
123 const Int defaultSockBufTxSz = 2048;
124 const Int defaultSockBufRxSz = 1;
125 const Int defaultPipIoTimeout = 0;
126 const Int defaultPipMaxBufSz = 1024;
127 const Int defaultPipBufTxSz = 256;
128 const Int defaultPipBufRxSz = 1;
129
130 131 132 133 134 135 136 137 138 139
140 config Bool DHCPOPT_TIME_OFFSET = false;
141 config Bool DHCPOPT_TIME_SERVER = false;
142 config Bool DHCPOPT_NAME_SERVERS = false;
143 config Bool DHCPOPT_LOG_SERVER = false;
144 config Bool DHCPOPT_COOKIE_SERVER = false;
145 config Bool DHCPOPT_LPR_SERVER = false;
146 config Bool DHCPOPT_IMPRESS_SERVER = false;
147 config Bool DHCPOPT_RESOURCE_LOCATION_SERVER = false;
148 config Bool DHCPOPT_BOOT_FILE_SIZE = false;
149 config Bool DHCPOPT_MERIT_DUMP_FILE = false;
150 config Bool DHCPOPT_SWAP_SERVER = false;
151 config Bool DHCPOPT_ROOT_PATH = false;
152 config Bool DHCPOPT_EXTENTIONS_PATH = false;
153 config Bool DHCPOPT_IP_FORWARDING = false;
154 config Bool DHCPOPT_NONLOCAL_SOURCE_ROUTING = false;
155 config Bool DHCPOPT_POLICTY_FILTER = false;
156 config Bool DHCPOPT_MAXIMUM_DATAGRAM_REASSEMBLY_SIZE = false;
157 config Bool DHCPOPT_DEFAULT_IP_TTL = false;
158 config Bool DHCPOPT_PATH_MTU_AGING_TIMEOUT = false;
159 config Bool DHCPOPT_PATH_MTU_PLATEAU_TIMEOUT = false;
160 config Bool DHCPOPT_INTERFACE_MTU = false;
161 config Bool DHCPOPT_ALL_SUBNETS_LOCAL = false;
162 config Bool DHCPOPT_BROADCAST_ADDRESS = false;
163 config Bool DHCPOPT_PERFORM_MASK_DISCOVERY = false;
164 config Bool DHCPOPT_MASK_SUPPLIER = false;
165 config Bool DHCPOPT_PERFORM_ROUTER_DISCOVERY = false;
166 config Bool DHCPOPT_ROUTER_SOLICITATION_ADDRESS = false;
167 config Bool DHCPOPT_STATIC_ROUTE = false;
168 config Bool DHCPOPT_TRAILER_ENCAPSULATION = false;
169 config Bool DHCPOPT_ARP_CACHE_TIMEOUT = false;
170 config Bool DHCPOPT_ETHERNET_ENCAPSULATION = false;
171 config Bool DHCPOPT_TCP_DEFUALT_TTL = false;
172 config Bool DHCPOPT_TCP_KEEPALIVE_INTERVAL = false;
173 config Bool DHCPOPT_TCP_KEEPALIVE_GARBAGE = false;
174 config Bool DHCPOPT_NIS_DOMAIN = false;
175 config Bool DHCPOPT_NIS_SERVERS = false;
176 config Bool DHCPOPT_NIS_TIME_PROTOCOL_SERVERS = false;
177 config Bool DHCPOPT_VENDOR_SPECIFIC_INFORMATION = false;
178 config Bool DHCPOPT_NETBIOS_DATAGRAM_DISTRIBUTION_SERVER = false;
179 config Bool DHCPOPT_XWINDOWS_FONT_SERVER = false;
180 config Bool DHCPOPT_XWINDOWS_DISPLAY_MANAGER = false;
181 config Bool DHCPOPT_REQUESTED_IP_ADDRESS = false;
182 config Bool DHCPOPT_IP_ADDRESS_LEASE_TIME = false;
183 config Bool DHCPOPT_OPTION_OVERLOAD = false;
184 config Bool DHCPOPT_DHCP_MESSAGE_TYPE = false;
185 config Bool DHCPOPT_SERVER_IDENTIFIER = false;
186 config Bool DHCPOPT_PARAMETER_REQUEST_LIST = false;
187 config Bool DHCPOPT_MESSAGE = false;
188 config Bool DHCPOPT_MAXIMUM_DHCP_MESSAGE_SIZE = false;
189 config Bool DHCPOPT_RENEWAL_T1_TIME_VALUE = false;
190 config Bool DHCPOPT_RENEWAL_T2_TIME_VALUE = false;
191 config Bool DHCPOPT_VENDOR_CLASS_IDENTIFIER = false;
192 config Bool DHCPOPT_CLIENT_IDENTIFIER = false;
193 config Bool DHCPOPT_NISPLUS_DOMAIN = false;
194 config Bool DHCPOPT_NISPLUS_SERVERS = false;
195 config Bool DHCPOPT_TFTP_SERVER_NAME = false;
196 config Bool DHCPOPT_BOOTFILE_NAME = false;
197 config Bool DHCPOPT_MOBILE_IP_HOME_AGENT = false;
198 config Bool DHCPOPT_SMTP_SERVER = false;
199 config Bool DHCPOPT_POP3_SERVER = false;
200 config Bool DHCPOPT_NNTP_SERVER = false;
201 config Bool DHCPOPT_DEFAULT_WWW_SERVER = false;
202 config Bool DHCPOPT_DEFAULT_FINGER_SERVER = false;
203 config Bool DHCPOPT_DEFAULT_IRC_SERVER = false;
204 config Bool DHCPOPT_STREETTALK_SERVER = false;
205 config Bool DHCPOPT_STREETALK_DISCOVERY_ASSISTANCE_SERVER = false;
206
207 /*! Type used to specify bits in dhcpClientMode */
208 typedef Bits16 CisFlags;
209
210 /*! Specifies if the IfIdx field is valid. */
211 const CisFlags CIS_FLG_IFIDXVALID = 0x0001;
212
213 /*!
214 * Requests that IfIdx be resolved to an IP address before service
215 * execution is initiated.
216 */
217 const CisFlags CIS_FLG_RESOLVEIP = 0x0002;
218
219 /*! Specifies that the service should be invoked by IP address */
220 const CisFlags CIS_FLG_CALLBYIP = 0x0004;
221
222 /*!
223 * A service that is dependent on a valid IP address (as determined by the
224 * RESOLVEIP flag) is shut down if the IP address becomes invalid.
225 *
226 * When this flag is set, the service will be restarted when a new address
227 * becomes available. Otherwise; the service will not be restarted.
228 */
229 const CisFlags CIS_FLG_RESTARTIPTERM = 0x0008;
230
231 /*! Use to specify the client host name. */
232 config String hostName = "tisoc";
233
234 /*!
235 * Enter a valid address for static IP configuration.
236 *
237 * The default address is null, and signifies that this Ip instance (on
238 * this interface) will run as a DHCP Client, and will obtain the IP
239 * address automatically from a DHCP Server on the network.
240 *
241 * The user may also set 'address' to a valid IP address, in which
242 * case the program will not run as a DHCP Client, and instead will use
243 * the static IP address provided to connect to the internet. When a
244 * static IP address is specified for 'address', the following
245 * instance parameters must be set:
246 * <IP mask, gateway IP address, domain name>
247 *
248 * To configure neither of these options, set the value to "none".
249 */
250 config String address = null;
251
252 /*!
253 * The physical device index for which the application's IP address should
254 * be associated with
255 */
256 config Int ifIdx = 1;
257
258 /*!
259 * Set of flags which represent the desired behavior of DHCP Client.
260 *
261 * The following flag values may be set either individually, or by or-ing
262 * flags together:
263 *
264 * - CIS_FLG_IFIDXVALID - specifies if the IfIdx field is valid.
265 *
266 * - CIS_FLG_RESOLVEIP - Requests that IfIdx be resolved to an IP
267 * address before service execution is initiated.
268 *
269 * - CIS_FLG_CALLBYIP - Specifies that the service should be invoked by
270 * IP address
271 *
272 * - CIS_FLG_RESTARTIPTERM - A service that is dependent on a valid IP
273 * address.
274 *
275 */
276 config CisFlags dhcpClientMode = 1;
277
278 /*! Handle to the service report function used by DHCP. */
279 config void *dhcpClientPcbServer = "&ti_ndk_config_Global_serviceReport";
280
281 /*!
282 * The IP mask must be specified when using a static IP address.
283 *
284 * Used for manual/static IP configuration. If configuring a static IP,
285 * this must be set to a valid mask value.
286 */
287 config String mask = "255.255.254.0";
288
289 /*!
290 * The IP address of the gateway must be specified when using a static IP
291 * address.
292 *
293 * Used for manual/static IP configuration. If configuring a static IP,
294 * this must be set to the IP address of the gateway.
295 */
296 config String gatewayIpAddr = "0.0.0.0";
297
298 /*!
299 * Use to specify the domain name of the network; this must be specified
300 * when using a static IP address.
301 *
302 * Used for manual/static IP configuration. If configuring a static IP,
303 * this should be a full domain. For example, use "home1.net", not just
304 * "home1".
305 */
306 config String domainName = "demo.net";
307
308 /*!
309 * Initial value placed in the IP Id field for IP packets generated by the
310 * system.
311 */
312 config Int indexStart = defaultStartIndex;
313
314 /*! Enable or disable IP forwarding. */
315 config Bool enableForwarding = defaultPortForwarding;
316
317 /*! Enable or disable IP filtering. */
318 config Bool enableFiltering = defaultPortFiltering;
319
320 /*! Set the maximum reassembly time for IP packets (seconds). */
321 config Int maxReassemblyTime = defaultMaxReasmTime;
322
323 /*! Set the maximum reassembly size for IP packets. */
324 config Int maxReassemblySize = defaultMaxReasmSize;
325
326 /*!
327 * Enable route table update on ICMP redirect.
328 *
329 * When true, causes ICMP to automatically create a route to perform
330 * redirects on an IP host to the gateway supplied in the redirect
331 * message. If false, ICMP will also generate a route control message,
332 * and user may take any action they feel is necessary.
333 */
334 config Bool icmpDoRedirect = defaultIcmpDoRedir;
335
336 /*! Set the time to live value for ICMP packets. */
337 config Int icmpTimeToLive = defaultIcmpTTL;
338
339 /*! Set the time to live value for ICMP echo packets. */
340 config Int icmpTimeToLiveEcho = defaultIcmpTTLecho;
341
342 /*!
343 * Enable or disable replies to broadcast.
344 *
345 * When enabled, the stack *does not* reply to ICMP echo request packets
346 * sent to broadcast/directed broadcast addresses.
347 */
348 config Bool icmpDontReplyToBcast = defaultIcmpBcastReply;
349
350 /*!
351 * Enable or disable replies to multicast.
352 *
353 * When enabled, the stack *does not* reply to ICMP echo request packets
354 * sent to multicast addresses.
355 */
356 config Bool icmpDontReplyToMcast = defaultIcmpMcastReply;
357
358 /*!
359 * Enable directed broadcast.
360 *
361 * When enabled, the stack will look for directed broadcast IP packets.
362 */
363 config Bool enableDirectedBroadcast = defaultDirBcast;
364
365 /*! Time in Seconds a Route is "Down" Due to Failed ARP. */
366 config Int routeDownTime = defaultRteDownTime;
367
368 /*! Time in Seconds a Validated Route is Held. */
369 config Int routeKeepAliveTime = defaultRteKpAliveTime;
370
371 /*! Default Timeout in Seconds of a Cloned Route. */
372 config Int routeCloneTimeout = defaultRteCloneTimeout;
373
374 /*! Default MTU for Local Routes. */
375 config Int routeDefaultMtu = defaultRteMtu;
376
377 /*! Enables Route Control messages. */
378 config Bool routeCtrlEnableDebug = defaultRteCtrlDbg;
379
380 /*! Time in seconds to periodically send a router advertisement. */
381 config Int routeAdvertisePeriod = defaultRteAdverPer;
382
383 /*!
384 * If sending router advertisements, this value will be used for the ICMP
385 * message lifetime.
386 */
387 config Int routeAdvertiseLifetime = defaultRteAdverLife;
388
389 /*!
390 * If sending router advertisements, this value will be used for the ICMP
391 * message route preference level.
392 */
393 config Int routeAdvertisePrefLvl = defaultRteAdverLvl;
394
395 /*! Default TTL for packets sent via IP socket. */
396 config Int socketTimeToLive = defaultSockTTL;
397
398 /*! Default TOS (Type of Service) for packets sent via a socket. */
399 config Int socketTos = defaultSockTos;
400
401 /*! Maximum number of connections on a listening socket. */
402 config Int socketMaxConnections = defaultSockMaxConn;
403
404 /*! Maximum Time in Seconds to Wait on a Connect. */
405 config Int socketConnectTimeout = defaultSockConnTimeout;
406
407 /*! Maximum Time in Seconds to Wait on Socket Read/Write. */
408 config Int socketIoTimeout = defaultSockIoTimeout;
409
410 /*! Min Size in Bytes for Socket "Able to Write." */
411 config Int socketBufMinTxSize = defaultSockBufTxSz;
412
413 /*! Min Size in Bytes for Socket "Able to Read." */
414 config Int socketBufMinRxSize = defaultSockBufRxSz;
415
416 /*! Maximum Time in Seconds to Wait on Pipe Read/Write. */
417 config Int pipeIoTimeout = defaultPipIoTimeout;
418
419 /*! Size in Bytes of Each End of a Pipe Buffer. */
420 config Int pipeMaxBufSize = defaultPipMaxBufSz;
421
422 /*! Min Size in Bytes for Pipe Able to Write. */
423 config Int pipeBufMinTxSize = defaultPipBufTxSz;
424
425 /*! Min Size in Bytes for Pipe Able to Write. */
426 config Int pipeBufMinRxSize = defaultPipBufRxSz;
427
428 /*! @_nodoc
429 *
430 * internal use only. Intermediate variables mapped to Grace checkboxes,
431 * used to update 'mode' dhcpClientMode variable.
432 */
433 config Bool IfIdXValid = true;
434
435 /*! @_nodoc
436 *
437 * internal use only. Intermediate variables mapped to Grace checkboxes,
438 * used to update 'mode' dhcpClientMode variable.
439 */
440 config Bool ResolveIP = false;
441
442 /*! @_nodoc
443 *
444 * internal use only. Intermediate variables mapped to Grace checkboxes,
445 * used to update 'mode' dhcpClientMode variable.
446 */
447 config Bool CallByIP = false;
448
449 /*! @_nodoc
450 *
451 * internal use only. Intermediate variables mapped to Grace checkboxes,
452 * used to update 'mode' dhcpClientMode variable.
453 */
454 config Bool RestartIPTerm = false;
455
456 /*! @_nodoc
457 *
458 * internal use only. Intermediate variables mapped to Grace checkboxes,
459 * used to update 'mode' dhcpClientMode variable.
460 */
461 config Bool autoIp = true;
462
463 /*! @_nodoc
464 *
465 * internal use only. Used to set network types - DHCP server, VLAN
466 */
467 config UInt NetType = 0;
468 }
469