Changeset 50c06df in mainline for uspace/lib


Ignore:
Timestamp:
2011-01-21T13:07:18Z (15 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d540c8
Parents:
e2b1548 (diff), 5d00e40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged development

Location:
uspace/lib
Files:
10 edited
1 moved

Legend:

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

    re2b1548 r50c06df  
    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/adt/hash_table.h

    re2b1548 r50c06df  
    4141typedef unsigned long hash_count_t;
    4242typedef unsigned long hash_index_t;
    43 typedef struct hash_table hash_table_t;
    44 typedef struct hash_table_operations hash_table_operations_t;
     43
     44/** Set of operations for hash table. */
     45typedef struct {
     46        /** Hash function.
     47         *
     48         * @param key Array of keys needed to compute hash index.
     49         *            All keys must be passed.
     50         *
     51         * @return Index into hash table.
     52         *
     53         */
     54        hash_index_t (*hash)(unsigned long key[]);
     55       
     56        /** Hash table item comparison function.
     57         *
     58         * @param key Array of keys that will be compared with item. It is
     59         *            not necessary to pass all keys.
     60         *
     61         * @return True if the keys match, false otherwise.
     62         *
     63         */
     64        int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
     65       
     66        /** Hash table item removal callback.
     67         *
     68         * @param item Item that was removed from the hash table.
     69         *
     70         */
     71        void (*remove_callback)(link_t *item);
     72} hash_table_operations_t;
    4573
    4674/** Hash table structure. */
    47 struct hash_table {
     75typedef struct {
    4876        link_t *entry;
    4977        hash_count_t entries;
    5078        hash_count_t max_keys;
    5179        hash_table_operations_t *op;
    52 };
    53 
    54 /** Set of operations for hash table. */
    55 struct hash_table_operations {
    56         /** Hash function.
    57          *
    58          * @param key   Array of keys needed to compute hash index. All keys
    59          *              must be passed.
    60          *
    61          * @return      Index into hash table.
    62          */
    63         hash_index_t (* hash)(unsigned long key[]);
    64        
    65         /** Hash table item comparison function.
    66          *
    67          * @param key   Array of keys that will be compared with item. It is
    68          *              not necessary to pass all keys.
    69          *
    70          * @return      true if the keys match, false otherwise.
    71          */
    72         int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
    73 
    74         /** Hash table item removal callback.
    75          *
    76          * @param item  Item that was removed from the hash table.
    77          */
    78         void (*remove_callback)(link_t *item);
    79 };
     80} hash_table_t;
    8081
    8182#define hash_table_get_instance(item, type, member) \
  • uspace/lib/c/include/ipc/icmp.h

    re2b1548 r50c06df  
    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

    re2b1548 r50c06df  
    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_header.h

    re2b1548 r50c06df  
    4545
    4646/** ICMP header size in bytes. */
    47 #define ICMP_HEADER_SIZE        sizeof(icmp_header_t)
    48 
    49 /** Type definition of the echo specific data.
    50  * @see icmp_echo
    51  */
    52 typedef struct icmp_echo icmp_echo_t;
     47#define ICMP_HEADER_SIZE  sizeof(icmp_header_t)
    5348
    5449/** Echo specific data. */
    55 struct icmp_echo {
     50typedef struct icmp_echo {
    5651        /** Message idintifier. */
    5752        icmp_param_t identifier;
    5853        /** Message sequence number. */
    5954        icmp_param_t sequence_number;
    60 } __attribute__ ((packed));
    61 
    62 /** Type definition of the internet control message header.
    63  * @see icmp_header
    64  */
    65 typedef struct icmp_header icmp_header_t;
     55} __attribute__((packed)) icmp_echo_t;
    6656
    6757/** Internet control message header. */
    68 struct icmp_header {
     58typedef struct icmp_header {
    6959        /** The type of the message. */
    7060        uint8_t type;
     
    8373         */
    8474        uint16_t checksum;
    85 
     75       
    8676        /** Message specific data. */
    8777        union {
    8878                /** Echo specific data. */
    89                 icmp_echo_t  echo;
     79                icmp_echo_t echo;
    9080                /** Proposed gateway value. */
    9181                in_addr_t gateway;
     
    10797                } param;
    10898        } un;
    109 } __attribute__ ((packed));
     99} __attribute__((packed)) icmp_header_t;
    110100
    111101#endif
  • uspace/lib/net/include/icmp_remote.h

    re2b1548 r50c06df  
    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

    re2b1548 r50c06df  
    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

    re2b1548 r50c06df  
    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

    re2b1548 r50c06df  
    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

    re2b1548 r50c06df  
    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                /*
  • uspace/lib/usb/src/recognise.c

    re2b1548 r50c06df  
    203203                uint8_t cur_descr_len = current_descriptor[0];
    204204                uint8_t cur_descr_type = current_descriptor[1];
     205
     206                if (cur_descr_len == 0) {
     207                        return ENOENT;
     208                }
    205209               
    206210                position += cur_descr_len;
Note: See TracChangeset for help on using the changeset viewer.