1    /*
     2     * Copyright (c) 2012, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     * */
    32    /*
    33     *  ======== DhcpServer.xdc ========
    34     *
    35     *  DhcpServer module definition and initial values
    36     */
    37    
    38    /*!
    39     *  ======== DhcpServer ========
    40     *  NDK module for creating and configuring a DHCP server. 
    41     *  
    42     *  The DhcpServer module can be used to configure and create a DHCP server in
    43     *  an NDK application.
    44     *  
    45     *  In order to configure a DHCP server, users must create a DhcpServer module
    46     *  parameters structure, which contains all of the instance properties of a
    47     *  DhcpServer instance.  Once the parameter structure is created, it may
    48     *  be used to change the properties of the DHCP server that's being created.
    49     *  
    50     *  Users are able to create multiple DHCP servers by creating multiple
    51     *  DhcpServer instances, and configuring each one.  However, if multiple
    52     *  DhcpServer instances are created, one must be careful to ensure that
    53     *  they all have been configured to have unique and free port numbers.
    54     */  
    55    
    56    @Template("./DhcpServer.xdt")
    57    
    58    metaonly module DhcpServer {
    59    
    60        /*! Function signature for CISARGS struct service reporting function */
    61        typedef Void (*dhcpServerServiceFxn)(Int, Int, Int, Void *);
    62    
    63        /*! Type used to specify bits in flags config parameter */
    64        typedef Bits16 DhcpServerFlag;
    65    
    66        /*!
    67         *  Causes DHCP Server to report its own IP address as the local DNS server
    68         *  to clients
    69         *
    70         *  If this flag is not set, the DHCP server reports the DNS servers as
    71         *  contained in the SYSINFO portion of the configuration.
    72         */
    73        const DhcpServerFlag DHCPS_FLG_LOCALDNS    = 0x0001;
    74    
    75        /*!
    76         *  Causes DHCP Server to report the local domain name assigned to the
    77         *  virtual network to clients.
    78         *
    79         *  If this flag is not set, the DHCP Server reports the public domain
    80         *  name to its clients.
    81         */
    82        const DhcpServerFlag DHCPS_FLG_LOCALDOMAIN = 0x0002;
    83    
    84        /*
    85         *  NOTE: DHCPS can only be run on an interface so no CIS mode options
    86         */
    87    
    88        /*!
    89         *  ======== create ========
    90         *  Creates an DhcpServer instance.
    91         */
    92        create();
    93    
    94    instance:
    95        /*! The first IP address of the DHCP server address pool */
    96        config String ipAddrPoolBase = "192.168.1.2";
    97    
    98        /*! The number of IP addresses in the DHCP server address pool */
    99        config Int ipAddrPoolCount = 253;
   100    
   101        /*!
   102         *  The physical device index on which the DHCP server shall be
   103         *  executed.  Must be greater than zero.
   104         */
   105        config Int ifIdx = 1;
   106    
   107        /*! DhcpServer service reporting function. */
   108        config dhcpServerServiceFxn pCbSrv = '&ti_ndk_config_Global_serviceReport';
   109    
   110        /*!
   111         *  Causes DHCP Server to report its own IP address as the local DNS server
   112         *  to clients
   113         */
   114        config Bool localDNS = false;
   115    
   116        /*!
   117         *  Causes DHCP Server to report the local domain name assigned to the
   118         *  virtual network to clients.
   119         */
   120        config Bool localDomain = false;
   121    }