Changeset 24ab58b3 in mainline for uspace/srv/net/net/net.h


Ignore:
Timestamp:
2010-04-06T11:41:48Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
14f1db0
Parents:
4dd8529
Message:

more compact network startup messages (usually one line instead of multiple lines)
pass module name as an argument to nil_message() and friends
deeper cstyle changes (replace forward prototypes with proper extern declarations and static functions, change doxygen comments, stick more closely to the 80-column rule, no argument names in header files, spacing, comments, etc.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/net/net.h

    r4dd8529 r24ab58b3  
    2828
    2929/** @addtogroup net
    30  *  @{
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Networking subsystem central module.
     34 * Networking subsystem central module.
     35 *
    3536 */
    3637
     
    4849
    4950/** @name Modules definitions
     51 * @{
    5052 */
    51 /*@{*/
    5253
    53 /** DP8390 network interface module full path filename.
     54#define DP8390_FILENAME  "/srv/dp8390"
     55#define DP8390_NAME      "dp8390"
     56
     57#define ETHERNET_FILENAME  "/srv/eth"
     58#define ETHERNET_NAME      "eth"
     59
     60#define IP_FILENAME  "/srv/ip"
     61#define IP_NAME      "ip"
     62
     63#define LO_FILENAME  "/srv/lo"
     64#define LO_NAME      "lo"
     65
     66#define NILDUMMY_FILENAME  "/srv/nildummy"
     67#define NILDUMMY_NAME      "nildummy"
     68
     69/** @}
    5470 */
    55 #define DP8390_FILENAME         "/srv/dp8390"
    56 
    57 /** DP8390 network interface module name.
    58  */
    59 #define DP8390_NAME                     "dp8390"
    60 
    61 /** Ethernet module full path filename.
    62  */
    63 #define ETHERNET_FILENAME       "/srv/eth"
    64 
    65 /** Ethernet module name.
    66  */
    67 #define ETHERNET_NAME           "ethernet"
    68 
    69 /** IP module full path filename.
    70  */
    71 #define IP_FILENAME                     "/srv/ip"
    72 
    73 /** IP module name.
    74  */
    75 #define IP_NAME                         "ip"
    76 
    77 /** Loopback network interface module full path filename.
    78  */
    79 #define LO_FILENAME                     "/srv/lo"
    80 
    81 /** Loopback network interface module name.
    82  */
    83 #define LO_NAME                         "lo"
    84 
    85 /** Ethernet module full path filename.
    86  */
    87 #define NILDUMMY_FILENAME       "/srv/nildummy"
    88 
    89 /** Ethernet module name.
    90  */
    91 #define NILDUMMY_NAME           "nildummy"
    92 
    93 /*@}*/
    9471
    9572/** @name Configuration setting names definitions
     73 * @{
    9674 */
    97 /*@{*/
    9875
    99 /** Internet protocol module name configuration label.
     76#define CONF_IL     "IL"     /**< Internet protocol module name configuration label. */
     77#define CONF_IO     "IO"     /**< Device input/output address configuration label. */
     78#define CONF_IRQ    "IRQ"    /**< Interrupt number configuration label. */
     79#define CONF_MTU    "MTU"    /**< Maximum transmission unit configuration label. */
     80#define CONF_NAME   "NAME"   /**< Network interface name configuration label. */
     81#define CONF_NETIF  "NETIF"  /**< Network interface module name configuration label. */
     82#define CONF_NIL    "NIL"    /**< Network interface layer module name configuration label. */
     83
     84/** @}
    10085 */
    101 #define CONF_IL                         "IL"
    10286
    103 /** Device input/output address configuration label.
    104  */
    105 #define CONF_IO                         "IO"
    106 
    107 /** Interrupt number configuration label.
    108  */
    109 #define CONF_IRQ                        "IRQ"
    110 
    111 /** Maximum transmission unit configuration label.
    112  */
    113 #define CONF_MTU                        "MTU"
    114 
    115 /** Network interface name configuration label.
    116  */
    117 #define CONF_NAME                       "NAME"
    118 
    119 /** Network interface module name configuration label.
    120  */
    121 #define CONF_NETIF                      "NETIF"
    122 
    123 /** Network interface layer module name configuration label.
    124  */
    125 #define CONF_NIL                        "NIL"
    126 
    127 /*@}*/
    128 
    129 /** Configuration directory.
    130  */
    131 #define CONF_DIR                        "/cfg/net"
    132 
    133 /** General configuration file.
    134  */
    135 #define CONF_GENERAL_FILE       "general"
    136 
    137 /** Type definition of the networking module global data.
    138  *  @see net_globals
    139  */
    140 typedef struct net_globals      net_globals_t;
    141 
    142 /** Type definition of the network interface specific data.
    143  *  @see netif
    144  */
    145 typedef struct netif    netif_t;
    146 
    147 /** Type definition of the network interface specific data pointer.
    148  *  @see netif
    149  */
    150 typedef netif_t *               netif_ref;
     87#define CONF_DIR           "/cfg/net"  /**< Configuration directory. */
     88#define CONF_GENERAL_FILE  "general"   /**< General configuration file. */
    15189
    15290/** Configuration settings.
    153  *  Maps setting names to the values.
    154  *  @see generic_char_map.h
     91 *
     92 * Maps setting names to the values.
     93 * @see generic_char_map.h
     94 *
    15595 */
    156 GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t)
     96GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t);
     97
     98/** Present network interface device.
     99 *
     100 */
     101typedef struct {
     102        measured_strings_t configuration;  /**< Configuration. */
     103       
     104        /** Serving network interface driver module index. */
     105        module_ref driver;
     106       
     107        device_id_t id;  /**< System-unique network interface identifier. */
     108        module_ref il;   /**< Serving internet layer module index. */
     109        char *name;      /**< System-unique network interface name. */
     110        module_ref nil;  /**< Serving link layer module index. */
     111} netif_t;
    157112
    158113/** Present network interfaces.
    159  *  Maps devices to the networking device specific data.
    160  *  @see device.h
     114 *
     115 * Maps devices to the networking device specific data.
     116 * @see device.h
     117 *
    161118 */
    162 DEVICE_MAP_DECLARE(netifs, netif_t)
     119DEVICE_MAP_DECLARE(netifs, netif_t);
    163120
    164 /** Networking module global variables.
     121/** Networking module global data.
     122 *
    165123 */
    166 struct net_globals{
    167         /** Global configuration.
    168          */
    169         measured_strings_t configuration;
    170         /** Available modules.
    171          */
    172         modules_t modules;
    173         /** Network interface structure indices by names.
    174          */
     124typedef struct {
     125        measured_strings_t configuration;  /**< Global configuration. */
     126        modules_t modules;                 /**< Available modules. */
     127       
     128        /** Network interface structure indices by names. */
    175129        char_map_t netif_names;
    176         /** Present network interfaces.
    177         */
     130       
     131        /** Present network interfaces. */
    178132        netifs_t netifs;
    179 };
     133} net_globals_t;
    180134
    181 /** Present network interface device.
    182  */
    183 struct netif{
    184         /** Configuration.
    185          */
    186         measured_strings_t configuration;
    187         /** Serving network interface driver module index.
    188          */
    189         module_ref driver;
    190         /** System-unique network interface identifier.
    191          */
    192         device_id_t id;
    193         /** Serving internet layer module index.
    194          */
    195         module_ref il;
    196         /** System-unique network interface name.
    197          */
    198         char * name;
    199         /** Serving link layer module index.
    200          */
    201         module_ref nil;
    202 };
    203 
    204 /** Adds the configured setting to the configuration map.
    205  *  @param[in] configuration The configuration map.
    206  *  @param[in] name The setting name.
    207  *  @param[in] value The setting value.
    208  *  @returns EOK on success.
    209  *  @returns ENOMEM if there is not enough memory left.
    210  */
    211 int add_configuration(measured_strings_ref configuration, const char * name, const char * value);
    212 
    213 /** Processes the module message.
    214  *  Distributes the message to the right bundled module.
    215  *  @param[in] callid The message identifier.
    216  *  @param[in] call The message parameters.
    217  *  @param[out] answer The message answer parameters.
    218  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    219  *  @returns EOK on success.
    220  *  @returns ENOTSUP if the message is not known.
    221  *  @returns Other error codes as defined for each bundled module message function.
    222  */
    223 int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    224 
    225 /** Initializes the networking module for the chosen subsystem build type.
    226  *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
    227  *  @returns EOK on success.
    228  *  @returns ENOMEM if there is not enough memory left.
    229  */
    230 int net_initialize_build(async_client_conn_t client_connection);
    231 
    232 /** Processes the networking message.
    233  *  @param[in] callid The message identifier.
    234  *  @param[in] call The message parameters.
    235  *  @param[out] answer The message answer parameters.
    236  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    237  *  @returns EOK on success.
    238  *  @returns ENOTSUP if the message is not known.
    239  *  @see net_interface.h
    240  *  @see IS_NET_NET_MESSAGE()
    241  */
    242 int net_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     135extern int add_configuration(measured_strings_ref, const char *, const char *);
     136extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
     137extern int net_initialize_build(async_client_conn_t);
     138extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
    243139
    244140#endif
Note: See TracChangeset for help on using the changeset viewer.