Changeset 797b704 in mainline for uspace/lib/net


Ignore:
Timestamp:
2011-01-12T14:40:09Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
014dd57b
Parents:
73ac2e9
Message:

streamline internetworking layer

  • IPC method renaming

NET_IL_DEVICE → NET_IP_DEVICE
NET_IL_PACKET_SPACE → NET_IP_PACKET_SPACE
NET_IL_SEND → NET_IP_SEND

The original methods were actually not generic methods of the IL layer (used by the lower layers), but specific methods of the IP module
and used by the higher layers. The original naming was rather confusing.

  • implelement common IL module skeleton
  • small improvements in the comments of the NETIF and NIL skeletons
  • IL modules now use a separate receiver function for the NET_IL_* calls
Location:
uspace/lib/net
Files:
1 added
4 edited
3 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/Makefile

    r73ac2e9 r797b704  
    4444        nil/nil_remote.c \
    4545        nil/nil_skel.c \
    46         il/il_interface.c \
     46        il/il_remote.c \
     47        il/il_skel.c \
    4748        il/ip_remote.c \
    4849        il/ip_client.c \
  • uspace/lib/net/il/il_remote.c

    r73ac2e9 r797b704  
    3333/** @file
    3434 * Internetwork layer module interface for the underlying network interface
    35  * layer. This interface is always called by the remote modules.
     35 * layer.
    3636 */
    3737
    38 #include <il_interface.h>
     38#include <il_remote.h>
    3939#include <generic.h>
    4040#include <packet_client.h>
  • uspace/lib/net/il/ip_remote.c

    r73ac2e9 r797b704  
    3636 *
    3737 * @see ip_interface.h
    38  * @see il_interface.h
     38 * @see il_remote.h
    3939 *
    4040 */
     
    121121    services_t service)
    122122{
    123         return generic_device_req_remote(ip_phone, NET_IL_DEVICE, device_id, 0,
     123        return generic_device_req_remote(ip_phone, NET_IP_DEVICE, device_id, 0,
    124124            service);
    125125}
     
    188188    packet_dimension_t *packet_dimension)
    189189{
    190         return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE,
     190        return generic_packet_size_req_remote(ip_phone, NET_IP_PACKET_SPACE,
    191191            device_id, packet_dimension);
    192192}
     
    228228    services_t sender, services_t error)
    229229{
    230         return generic_send_msg_remote(ip_phone, NET_IL_SEND, device_id,
     230        return generic_send_msg_remote(ip_phone, NET_IP_SEND, device_id,
    231231            packet_get_id(packet), sender, error);
    232232}
  • uspace/lib/net/include/il_remote.h

    r73ac2e9 r797b704  
    3636 */
    3737
    38 #ifndef LIBNET_IL_INTERFACE_H_
    39 #define LIBNET_IL_INTERFACE_H_
     38#ifndef LIBNET_IL_REMOTE_H_
     39#define LIBNET_IL_REMOTE_H_
    4040
    4141#include <ipc/services.h>
  • uspace/lib/net/include/il_skel.h

    r73ac2e9 r797b704  
    2727 */
    2828
    29 /** @addtogroup libnet 
     29/** @addtogroup libnet
    3030 * @{
    3131 */
    3232
    33 #ifndef LIBNET_IL_LOCAL_H_
    34 #define LIBNET_IL_LOCAL_H_
     33#ifndef LIBNET_IL_SKEL_H_
     34#define LIBNET_IL_SKEL_H_
    3535
     36/** @file
     37 * Internetwork layer module skeleton.
     38 * The skeleton has to be part of each internetwork layer module.
     39 */
     40
     41#include <async.h>
     42#include <fibril_synch.h>
    3643#include <ipc/ipc.h>
    37 #include <async.h>
     44#include <ipc/services.h>
    3845
    39 /** Processes the Internet layer module message.
     46#include <adt/measured_strings.h>
     47#include <net/device.h>
     48#include <net/packet.h>
     49
     50/** Module initialization.
    4051 *
    41  * @param[in]           callid The message identifier.
    42  * @param[in]           call The message parameters.
    43  * @param[out]          answer The message answer parameters.
    44  * @param[out]          answer_count The last parameter for the actual answer in
    45  *                      the answer parameter.
    46  * @return              EOK on success.
    47  * @return              Other error codes as defined for the arp_message()
    48  *                      function.
     52 * This has to be implemented in user code.
     53 *
     54 * @param[in] net_phone Networking module phone.
     55 *
     56 * @return EOK on success.
     57 * @return Other error codes as defined for each specific module
     58 *         initialize function.
     59 *
     60 */
     61extern int il_initialize(int net_phone);
     62
     63/** Process the Internet layer module message.
     64 *
     65 * This has to be implemented in user code.
     66 *
     67 * @param[in]  callid Message identifier.
     68 * @param[in]  call   Message parameters.
     69 * @param[out] answer Answer.
     70 * @param[out] count  Number of arguments of the answer.
     71 *
     72 * @return EOK on success.
     73 * @return Other error codes as defined for the arp_message()
     74 *         function.
     75 *
    4976 */
    5077extern int il_module_message(ipc_callid_t callid, ipc_call_t *call,
    5178    ipc_call_t *answer, size_t *answer_count);
    5279
    53 /** Starts the Internet layer module.
    54  *
    55  * Initializes the client connection servicing function, initializes the module,
    56  * registers the module service and starts the async manager, processing IPC
    57  * messages in an infinite loop.
    58  *
    59  * @param[in] client_connection The client connection processing function. The
    60  *                      module skeleton propagates its own one.
    61  * @return              EOK on successful module termination.
    62  * @return              Other error codes as defined for the arp_initialize()
    63  *                      function.
    64  * @return              Other error codes as defined for the REGISTER_ME() macro
    65  *                      function.
    66  */
    67 extern int il_module_start(async_client_conn_t client_connection);
     80extern int il_module_start(int);
    6881
    6982#endif
  • uspace/lib/net/include/nil_skel.h

    r73ac2e9 r797b704  
    5050/** Module initialization.
    5151 *
    52  * Is called by the module_start() function.
     52 * This has to be implemented in user code.
    5353 *
    5454 * @param[in] net_phone Networking module phone.
     
    5959 *
    6060 */
    61 extern int nil_initialize(int);
     61extern int nil_initialize(int net_phone);
    6262
    6363/** Notify the network interface layer about the device state change.
     64 *
     65 * This has to be implemented in user code.
    6466 *
    6567 * @param[in] nil_phone Network interface layer phone.
     
    7981 * upper layers.
    8082 *
     83 * This has to be implemented in user code.
     84 *
    8185 * @param[in] nil_phone Network interface layer phone.
    8286 * @param[in] device_id Source device identifier.
     
    9296
    9397/** Message processing function.
     98 *
     99 * This has to be implemented in user code.
    94100 *
    95101 * @param[in]  name   Module name.
  • uspace/lib/net/nil/nil_skel.c

    r73ac2e9 r797b704  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2011 Martin Decky
    33 * All rights reserved.
    44 *
     
    3232
    3333/** @file
    34  * Network network interface layer module implementation.
     34 * Network interface layer module skeleton implementation.
    3535 * @see nil_skel.h
    3636 */
Note: See TracChangeset for help on using the changeset viewer.