Changeset 61bfc370 in mainline for uspace/lib/net


Ignore:
Timestamp:
2011-01-07T18:57:55Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e08a733
Parents:
7c34b28f
Message:
  • make measured_string and other network-related data types binary-safe
  • fix several network-related routines binary-safe (replace clearly suspicious use of str_lcmp() with bcmp())
  • rename spawn() to net_spawn()
Location:
uspace/lib/net
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/adt/module_map.c

    r7c34b28f r61bfc370  
    6363 */
    6464int
    65 add_module(module_t **module, modules_t *modules, const char *name,
    66     const char *filename, services_t service, task_id_t task_id,
     65add_module(module_t **module, modules_t *modules, const uint8_t *name,
     66    const uint8_t *filename, services_t service, task_id_t task_id,
    6767    connect_module_t connect_module)
    6868{
     
    104104 * @return              NULL if there is no such module.
    105105 */
    106 module_t *get_running_module(modules_t *modules, char *name)
     106module_t *get_running_module(modules_t *modules, uint8_t *name)
    107107{
    108108        module_t *module;
     
    113113
    114114        if (!module->task_id) {
    115                 module->task_id = spawn(module->filename);
     115                module->task_id = net_spawn(module->filename);
    116116                if (!module->task_id)
    117117                        return NULL;
     
    123123}
    124124
    125 /** Starts the given module.
     125/** Start the given module.
    126126 *
    127  * @param[in] fname     The module full or relative path filename.
    128  * @return              The new module task identifier on success.
    129  * @return              Zero if there is no such module.
     127 * @param[in] fname The module full or relative path filename.
     128 *
     129 * @return The new module task identifier on success.
     130 * @return Zero if there is no such module.
     131 *
    130132 */
    131 task_id_t spawn(const char *fname)
     133task_id_t net_spawn(const uint8_t *fname)
    132134{
    133135        task_id_t id;
    134136        int rc;
    135137       
    136         rc = task_spawnl(&id, fname, fname, NULL);
     138        rc = task_spawnl(&id, (const char *) fname, (const char *) fname, NULL);
    137139        if (rc != EOK)
    138140                return 0;
  • uspace/lib/net/generic/generic.c

    r7c34b28f r61bfc370  
    112112        message_id = async_send_1(phone, (sysarg_t) message,
    113113            (sysarg_t) device_id, NULL);
    114         string = measured_strings_return(phone, address, (char **) data, 1);
     114        string = measured_strings_return(phone, address, data, 1);
    115115        async_wait_for(message_id, &result);
    116116
     
    234234generic_translate_req(int phone, int message, device_id_t device_id,
    235235    services_t service, measured_string_t *configuration, size_t count,
    236     measured_string_t **translation, char **data)
     236    measured_string_t **translation, uint8_t **data)
    237237{
    238238        aid_t message_id;
  • uspace/lib/net/generic/net_remote.c

    r7c34b28f r61bfc370  
    6363 * @see net_get_conf_req()
    6464 */
    65 void net_free_settings(measured_string_t *settings, char *data)
     65void net_free_settings(measured_string_t *settings, uint8_t *data)
    6666{
    6767        if (settings)
     
    9191int
    9292net_get_conf_req(int net_phone, measured_string_t **configuration,
    93     size_t count, char **data)
     93    size_t count, uint8_t **data)
    9494{
    9595        return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, 0, 0,
     
    118118int
    119119net_get_device_conf_req(int net_phone, device_id_t device_id,
    120     measured_string_t **configuration, size_t count, char **data)
     120    measured_string_t **configuration, size_t count, uint8_t **data)
    121121{
    122122        return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF,
  • uspace/lib/net/il/arp_remote.c

    r7c34b28f r61bfc370  
    165165int
    166166arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol,
    167     measured_string_t *address, measured_string_t **translation, char **data)
     167    measured_string_t *address, measured_string_t **translation, uint8_t **data)
    168168{
    169169        return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id,
  • uspace/lib/net/include/adt/module_map.h

    r7c34b28f r61bfc370  
    6565        int usage;
    6666        /** Module name. */
    67         const char *name;
     67        const uint8_t *name;
    6868        /** Module full path filename. */
    69         const char *filename;
     69        const uint8_t *filename;
    7070        /** Connecting function. */
    7171        connect_module_t *connect_module;
    7272};
    7373
    74 extern int add_module(module_t **, modules_t *, const char *, const char *,
    75     services_t, task_id_t, connect_module_t *);
    76 extern module_t *get_running_module(modules_t *, char *);
    77 extern task_id_t spawn(const char *);
     74extern int add_module(module_t **, modules_t *, const uint8_t *,
     75    const uint8_t *, services_t, task_id_t, connect_module_t *);
     76extern module_t *get_running_module(modules_t *, uint8_t *);
     77extern task_id_t net_spawn(const uint8_t *);
    7878
    7979#endif
  • uspace/lib/net/include/arp_interface.h

    r7c34b28f r61bfc370  
    5050    measured_string_t *);
    5151extern int arp_translate_req(int, device_id_t, services_t, measured_string_t *,
    52     measured_string_t **, char **);
     52    measured_string_t **, uint8_t **);
    5353extern int arp_clear_device_req(int, device_id_t);
    5454extern int arp_clear_address_req(int, device_id_t, services_t,
  • uspace/lib/net/include/generic.h

    r7c34b28f r61bfc370  
    5858    services_t, services_t);
    5959extern int generic_translate_req(int, int, device_id_t, services_t,
    60     measured_string_t *, size_t, measured_string_t **, char **);
     60    measured_string_t *, size_t, measured_string_t **, uint8_t **);
    6161
    6262#endif
  • uspace/lib/net/include/net_interface.h

    r7c34b28f r61bfc370  
    4545
    4646extern int net_get_device_conf_req(int, device_id_t, measured_string_t **,
    47     size_t, char **);
    48 extern int net_get_conf_req(int, measured_string_t **, size_t, char **);
    49 extern void net_free_settings(measured_string_t *, char *);
     47    size_t, uint8_t **);
     48extern int net_get_conf_req(int, measured_string_t **, size_t, uint8_t **);
     49extern void net_free_settings(measured_string_t *, uint8_t *);
    5050extern int net_connect_module(void);
    5151
  • uspace/lib/net/include/socket_core.h

    r7c34b28f r61bfc370  
    8686        void *specific_data;
    8787        /** Socket ports map key. */
    88         const char *key;
     88        const uint8_t *key;
    8989        /** Length of the Socket ports map key. */
    9090        size_t key_length;
     
    118118    void (*)(socket_core_t *));
    119119extern int socket_reply_packets(packet_t *, size_t *);
    120 extern socket_core_t *socket_port_find(socket_ports_t *, int, const char *,
     120extern socket_core_t *socket_port_find(socket_ports_t *, int, const uint8_t *,
    121121    size_t);
    122122extern void socket_port_release(socket_ports_t *, socket_core_t *);
    123123extern int socket_port_add(socket_ports_t *, int, socket_core_t *,
    124     const char *, size_t);
     124    const uint8_t *, size_t);
    125125
    126126#endif
  • uspace/lib/net/netif/netif_local.c

    r7c34b28f r61bfc370  
    221221        fibril_rwlock_read_unlock(&netif_globals.lock);
    222222       
    223         *data = (uint8_t *) (**address).value;
     223        *data = (**address).value;
    224224       
    225225        return rc;
  • uspace/lib/net/tl/socket_core.c

    r7c34b28f r61bfc370  
    161161static int
    162162socket_port_add_core(socket_port_t *socket_port, socket_core_t *socket,
    163     const char *key, size_t key_length)
     163    const uint8_t *key, size_t key_length)
    164164{
    165165        socket_core_t **socket_ref;
     
    216216                goto fail;
    217217       
    218         rc = socket_port_add_core(socket_port, socket, SOCKET_MAP_KEY_LISTENING,
    219             0);
     218        rc = socket_port_add_core(socket_port, socket,
     219            (const uint8_t *) SOCKET_MAP_KEY_LISTENING, 0);
    220220        if (rc != EOK)
    221221                goto fail;
     
    602602 */
    603603socket_core_t *
    604 socket_port_find(socket_ports_t *global_sockets, int port, const char *key,
     604socket_port_find(socket_ports_t *global_sockets, int port, const uint8_t *key,
    605605    size_t key_length)
    606606{
     
    680680int
    681681socket_port_add(socket_ports_t *global_sockets, int port,
    682     socket_core_t *socket, const char *key, size_t key_length)
     682    socket_core_t *socket, const uint8_t *key, size_t key_length)
    683683{
    684684        socket_port_t *socket_port;
Note: See TracChangeset for help on using the changeset viewer.