Changeset f1938c6 in mainline for uspace/lib


Ignore:
Timestamp:
2011-01-17T15:41:30Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a2d8d59, ffaba00
Parents:
9f3864a
Message:

streamline ICMP implementation

  • generate ICMP identification based on fibril counter
  • use fibril-local ICMP sequence numbers
  • use hash table (instead of char map) for ICMP replies
  • simplify locking
  • simplify ICMP communication
Location:
uspace/lib
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/net/icmp_common.c

    r9f3864a rf1938c6  
    2727 */
    2828
    29 /** @addtogroup libc 
     29/** @addtogroup libc
    3030 *  @{
    3131 */
     
    3838#include <net/modules.h>
    3939#include <net/icmp_common.h>
    40 
    4140#include <ipc/services.h>
    4241#include <ipc/icmp.h>
    43 
    4442#include <sys/time.h>
    4543#include <async.h>
    4644
    47 /** Connects to the ICMP module.
     45/** Connect to the ICMP module.
    4846 *
    49  * @param service       The ICMP module service. Ignored parameter.
    50  * @param[in] timeout   The connection timeout in microseconds. No timeout if
    51  *                      set to zero.
    52  * @return              The ICMP module phone on success.
    53  * @return              ETIMEOUT if the connection timeouted.
     47 * @param[in] timeout Connection timeout in microseconds, zero
     48 *                    for no timeout.
     49 *
     50 * @return ICMP module phone on success.
     51 * @return ETIMEOUT if the connection timeouted.
     52 *
    5453 */
    55 int icmp_connect_module(services_t service, suseconds_t timeout)
     54int icmp_connect_module(suseconds_t timeout)
    5655{
    57         int phone;
    58 
    59         phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
    60         if (phone >= 0)
    61                 async_req_0_0(phone, NET_ICMP_INIT);
    62 
    63         return phone;
     56        return connect_to_service_timeout(SERVICE_ICMP, timeout);
    6457}
    6558
  • uspace/lib/c/include/ipc/icmp.h

    r9f3864a rf1938c6  
    3333/** @file
    3434 * ICMP module messages.
    35  * @see icmp_interface.h
     35 * @see icmp_remote.h
    3636 */
    3737
     
    4848/** ICMP module messages. */
    4949typedef enum {
    50         /** Sends echo request. @see icmp_echo() */
     50        /** Send echo request. @see icmp_echo() */
    5151        NET_ICMP_ECHO = NET_ICMP_FIRST,
    5252       
    5353        /**
    54          * Sends destination unreachable error message.
     54         * Send destination unreachable error message.
    5555         * @see icmp_destination_unreachable_msg()
    5656         */
     
    5858       
    5959        /**
    60          * Sends source quench error message.
     60         * Send source quench error message.
    6161         * @see icmp_source_quench_msg()
    6262         */
     
    6464       
    6565        /**
    66          * Sends time exceeded error message.
     66         * Send time exceeded error message.
    6767         * @see icmp_time_exceeded_msg()
    6868         */
     
    7070       
    7171        /**
    72          * Sends parameter problem error message.
     72         * Send parameter problem error message.
    7373         * @see icmp_parameter_problem_msg()
    7474         */
    75         NET_ICMP_PARAMETERPROB,
    76        
    77         /** Initializes new connection. */
    78         NET_ICMP_INIT
    79 } icmp_messages;
     75        NET_ICMP_PARAMETERPROB
     76} icmp_messages_t;
    8077
    8178/** @name ICMP specific message parameters definitions */
  • uspace/lib/c/include/net/icmp_common.h

    r9f3864a rf1938c6  
    4141#include <sys/time.h>
    4242
    43 /** Default timeout for incoming connections in microseconds. */
    44 #define ICMP_CONNECT_TIMEOUT    (1 * 1000 * 1000)
     43/** Default timeout for incoming connections in microseconds (1 sec). */
     44#define ICMP_CONNECT_TIMEOUT  1000000
    4545
    46 extern int icmp_connect_module(services_t, suseconds_t);
     46extern int icmp_connect_module(suseconds_t);
    4747
    4848#endif
  • uspace/lib/net/include/icmp_remote.h

    r9f3864a rf1938c6  
    2727 */
    2828
    29 /** @addtogroup libnet 
     29/** @addtogroup libnet
    3030 *  @{
    3131 */
    3232
    33 #ifndef LIBNET_ICMP_INTERFACE_H_
    34 #define LIBNET_ICMP_INTERFACE_H_
     33#ifndef LIBNET_ICMP_REMOTE_H_
     34#define LIBNET_ICMP_REMOTE_H_
    3535
    3636#include <net/socket_codes.h>
     
    5454extern int icmp_source_quench_msg(int, packet_t *);
    5555extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t *);
    56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t *);
     56extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t,
     57    packet_t *);
    5758
    5859/*@}*/
  • uspace/lib/net/include/tl_skel.h

    r9f3864a rf1938c6  
    6161extern int tl_initialize(int net_phone);
    6262
     63/** Per-connection module initialization.
     64 *
     65 * This has to be implemented in user code.
     66 *
     67 */
     68extern void tl_connection(void);
     69
    6370/** Process the transport layer module message.
    6471 *
     
    7481 *
    7582 */
    76 extern int tl_module_message(ipc_callid_t, ipc_call_t *,
     83extern int tl_message(ipc_callid_t, ipc_call_t *,
    7784    ipc_call_t *, size_t *);
    7885
  • uspace/lib/net/tl/icmp_remote.c

    r9f3864a rf1938c6  
    3333/** @file
    3434 * ICMP interface implementation for remote modules.
    35  * @see icmp_interface.h
     35 * @see icmp_remote.h
    3636 */
    3737
    38 #include <icmp_interface.h>
     38#include <icmp_remote.h>
    3939#include <net/modules.h>
    4040#include <packet_client.h>
  • uspace/lib/net/tl/tl_common.c

    r9f3864a rf1938c6  
    2727 */
    2828
    29 /** @addtogroup libnet 
     29/** @addtogroup libnet
    3030 * @{
    3131 */
     
    3939#include <packet_client.h>
    4040#include <packet_remote.h>
    41 #include <icmp_interface.h>
     41#include <icmp_remote.h>
    4242#include <ip_remote.h>
    4343#include <ip_interface.h>
  • uspace/lib/net/tl/tl_skel.c

    r9f3864a rf1938c6  
    5656        ipc_answer_0(iid, EOK);
    5757       
     58        /* Per-connection initialization */
     59        tl_connection();
     60       
    5861        while (true) {
    5962                ipc_call_t answer;
     
    6871               
    6972                /* Process the message */
    70                 int res = tl_module_message(callid, &call, &answer,
    71                     &count);
     73                int res = tl_message(callid, &call, &answer, &count);
    7274               
    7375                /*
Note: See TracChangeset for help on using the changeset viewer.