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     *  ======== Nat.xdc ========
    34     *  Nat module definition and inital values
    35     */
    36    
    37    /*!
    38     *  ======== Nat ======== 
    39     *  NDK Network Address Translation (NAT) settings and configuration.
    40     *  
    41     */  
    42    
    43    @Template("./Nat.xdt")
    44    
    45    metaonly module Nat {
    46    
    47        /*! Function signature for CISARGS struct service reporting function */
    48        typedef Void (*natServiceFxn)(Int, Int, Int, Void *);
    49    
    50        /*! Type used to specify bits in mode */
    51        typedef Bits16 CisFlags;
    52    
    53        /*! Specifies if the IfIdx field is valid. */
    54        const CisFlags CIS_FLG_IFIDXVALID        = 0x0001;
    55    
    56        /*!
    57         *  Requests that IfIdx be resolved to an IP address before service
    58         *  execution is initiated.
    59         */
    60        const CisFlags CIS_FLG_RESOLVEIP         = 0x0002;
    61    
    62        /*! Specifies that the service should be invoked by IP address */
    63        const CisFlags CIS_FLG_CALLBYIP          = 0x0004;
    64    
    65        /*!
    66         *  A service that is dependent on a valid IP address (as determined by the
    67         *  RESOLVEIP flag) is shut down if the IP address becomes invalid.
    68         *
    69         *  When this flag is set, the service will be restarted when a new address
    70         *  becomes available. Otherwise; the service will not be restarted.
    71         */
    72        const CisFlags CIS_FLG_RESTARTIPTERM     = 0x0008;
    73    
    74        /*!
    75         *  ======== create ========
    76         *  Creates an Nat instance.
    77         */
    78        create();
    79    
    80    instance:
    81    
    82        /*! Specifies the NAT group virtual network IP address. */
    83        config String virtualIpAddr = null;
    84    
    85        /*! Specifies the subnet mask of the NAT group virtual network. */
    86        config String virtualMask = "255.255.254.0";
    87    
    88        /*! Specifies the IP MTU limit (1500 for ethernet, 1492 for PPPoE, ...) */
    89        config Int mtu = 1500;
    90    
    91        /*!
    92         *  Set of flags which represent the desired behavior of the telnet Server.
    93         *  
    94         *  The following flag values may be set either individually, or by or-ing
    95         *  flags together:
    96         * @p(blist)
    97         *    - CIS_FLG_IFIDXVALID - specifies if the IfIdx field is valid.
    98         *  
    99         *    - CIS_FLG_RESOLVEIP - Requests that IfIdx be resolved to an IP
   100         *      address before service execution is initiated.
   101         *  
   102         *    - CIS_FLG_CALLBYIP - Specifies that the service should be invoked by
   103         *      IP address
   104         *  
   105         *    - CIS_FLG_RESTARTIPTERM - A service that is dependent on a valid IP
   106         *      address.
   107         * @p
   108         */
   109        config Int mode = 0;
   110    
   111        /*!
   112         *  The physical device index on which the NAT server shall be
   113         *  executed.  Must be greater than zero.
   114         */
   115        config Int ifIdx = 1;
   116    
   117        /*! Nat service reporting function. */
   118        config natServiceFxn pCbSrv = "&ti_ndk_config_Global_serviceReport";
   119    
   120        /*! @_nodoc
   121         *
   122         * internal use only.  Intermediate variables mapped to Grace checkboxes,
   123         * used to update 'mode' flags variable.
   124         */
   125        config Bool IfIdXValid = false;
   126    
   127        /*! @_nodoc
   128         *
   129         * internal use only.  Intermediate variables mapped to Grace checkboxes,
   130         * used to update 'mode' flags variable.
   131         */
   132        config Bool ResolveIP = false;
   133    
   134        /*! @_nodoc
   135         *
   136         * internal use only.  Intermediate variables mapped to Grace checkboxes,
   137         * used to update 'mode' flags variable.
   138         */
   139        config Bool CallByIP = false;
   140    
   141        /*! @_nodoc
   142         *
   143         * internal use only.  Intermediate variables mapped to Grace checkboxes,
   144         * used to update 'mode' flags variable.
   145         */
   146        config Bool RestartIPTerm = false;
   147    }