Changeset 849ed54 in mainline for uspace/lib/socket/include


Ignore:
Timestamp:
2010-03-30T18:39:04Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7553689
Parents:
7d6fe4db
Message:

Networking work:
Split the networking stack into end-user library (libsocket) and two helper libraries (libnet and libnetif).
Don't use over-the-hand compiling and linking, but rather separation of conserns.
There might be still some issues and the non-modular networking architecture is currently broken, but this will be fixed soon.

Location:
uspace/lib/socket/include
Files:
32 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/socket/include/adt/char_map.h

    r7d6fe4db r849ed54  
    8989 *  @returns Other error codes as defined for the char_map_add_item() function.
    9090 */
    91 int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value);
     91extern int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value);
    9292
    9393/** Clears and destroys the map.
    9494 *  @param[in,out] map The character string to integer map.
    9595 */
    96 void char_map_destroy(char_map_ref map);
     96extern void char_map_destroy(char_map_ref map);
    9797
    9898/** Excludes the value assigned to the key from the map.
     
    104104 *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
    105105 */
    106 int char_map_exclude(char_map_ref map, const char * identifier, size_t length);
     106extern int char_map_exclude(char_map_ref map, const char * identifier, size_t length);
    107107
    108108/** Returns the value assigned to the key from the map.
     
    113113 *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
    114114 */
    115 int char_map_find(const char_map_ref map, const char * identifier, size_t length);
     115extern int char_map_find(const char_map_ref map, const char * identifier, size_t length);
    116116
    117117/** Initializes the map.
     
    121121 *  @returns ENOMEM if there is not enough memory left.
    122122 */
    123 int char_map_initialize(char_map_ref map);
     123extern int char_map_initialize(char_map_ref map);
    124124
    125125/** Adds or updates the value with the key to the map.
     
    135135 *  @returns Other error codes as defined for the char_map_add_item() function.
    136136 */
    137 int char_map_update(char_map_ref map, const char * identifier, size_t length, const int value);
     137extern int char_map_update(char_map_ref map, const char * identifier, size_t length, const int value);
    138138
    139139#endif
  • uspace/lib/socket/include/adt/dynamic_fifo.h

    r7d6fe4db r849ed54  
    7979 *  @returns ENOMEM if there is not enough memory left.
    8080 */
    81 int dyn_fifo_initialize(dyn_fifo_ref fifo, int size);
     81extern int dyn_fifo_initialize(dyn_fifo_ref fifo, int size);
    8282
    8383/** Appends a new item to the queue end.
     
    8989 *  @returns ENOMEM if there is not enough memory left.
    9090 */
    91 int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size);
     91extern int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size);
    9292
    9393/** Returns and excludes the first item in the queue.
     
    9797 *  @returns ENOENT if the queue is empty.
    9898 */
    99 int dyn_fifo_pop(dyn_fifo_ref fifo);
     99extern int dyn_fifo_pop(dyn_fifo_ref fifo);
    100100
    101101/** Returns and keeps the first item in the queue.
     
    105105 *  @returns ENOENT if the queue is empty.
    106106 */
    107 int dyn_fifo_value(dyn_fifo_ref fifo);
     107extern int dyn_fifo_value(dyn_fifo_ref fifo);
    108108
    109109/** Clears and destroys the queue.
     
    112112 *  @returns EINVAL if the queue is not valid.
    113113 */
    114 int dyn_fifo_destroy(dyn_fifo_ref fifo);
     114extern int dyn_fifo_destroy(dyn_fifo_ref fifo);
    115115
    116116#endif
  • uspace/lib/socket/include/adt/generic_char_map.h

    r7d6fe4db r849ed54  
    4141#include <unistd.h>
    4242
    43 #include "../err.h"
     43#include <net_err.h>
    4444
    45 #include "char_map.h"
    46 #include "generic_field.h"
     45#include <adt/char_map.h>
     46#include <adt/generic_field.h>
    4747
    4848/** Internal magic value for a&nbsp;map consistency check.
  • uspace/lib/socket/include/adt/measured_strings.h

    r7d6fe4db r849ed54  
    7171 *  @returns NULL if there is not enough memory left.
    7272 */
    73 measured_string_ref measured_string_create_bulk(const char * string, size_t length);
     73extern measured_string_ref measured_string_create_bulk(const char * string, size_t length);
    7474
    7575/** Copies the given measured string with separated header and data parts.
     
    7979 *  @returns NULL if there is not enough memory left.
    8080 */
    81 measured_string_ref measured_string_copy(measured_string_ref source);
     81extern measured_string_ref measured_string_copy(measured_string_ref source);
    8282
    8383/** Receives a&nbsp;measured strings array from a&nbsp;calling module.
     
    9595 *  @returns Other error codes as defined for the async_data_write_finalize() function.
    9696 */
    97 int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count);
     97extern int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count);
    9898
    9999/** Replies the given measured strings array to a&nbsp;calling module.
     
    108108 *  @returns Other error codes as defined for the async_data_read_finalize() function.
    109109 */
    110 int measured_strings_reply(const measured_string_ref strings, size_t count);
     110extern int measured_strings_reply(const measured_string_ref strings, size_t count);
    111111
    112112/** Receives a&nbsp;measured strings array from another module.
     
    124124 *  @returns Other error codes as defined for the async_data_read_start() function.
    125125 */
    126 int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count);
     126extern int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count);
    127127
    128128/** Sends the given measured strings array to another module.
     
    136136 *  @returns Other error codes as defined for the async_data_write_start() function.
    137137 */
    138 int measured_strings_send(int phone, const measured_string_ref strings, size_t count);
     138extern int measured_strings_send(int phone, const measured_string_ref strings, size_t count);
    139139
    140140#endif
  • uspace/lib/socket/include/icmp_api.h

    r7d6fe4db r849ed54  
    4040#include <sys/types.h>
    4141
    42 #include "device.h"
    43 
    44 #include "../structures/measured_strings.h"
    45 #include "../structures/packet/packet.h"
    46 
    47 #include "inet.h"
    48 #include "ip_codes.h"
    49 #include "socket_codes.h"
    50 
    51 #include "icmp_codes.h"
    52 #include "icmp_common.h"
     42#include <net_device.h>
     43#include <adt/measured_strings.h>
     44#include <packet/packet.h>
     45#include <inet.h>
     46#include <ip_codes.h>
     47#include <socket_codes.h>
     48#include <icmp_codes.h>
     49#include <icmp_common.h>
    5350
    5451/** Miliseconds type definition.
     
    7976 *  @returns EPARTY if there was an internal error.
    8077 */
    81 int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen);
     78extern int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen);
    8279
    8380/*@}*/
  • uspace/lib/socket/include/icmp_common.h

    r7d6fe4db r849ed54  
    5353 *  @returns ETIMEOUT if the connection timeouted.
    5454 */
    55 int icmp_connect_module(services_t service, suseconds_t timeout);
     55extern int icmp_connect_module(services_t service, suseconds_t timeout);
    5656
    5757#endif
  • uspace/lib/socket/include/icmp_messages.h

    r7d6fe4db r849ed54  
    4040
    4141#include <ipc/ipc.h>
    42 
    4342#include <sys/types.h>
    4443
    45 #include "../../include/icmp_codes.h"
    46 
    47 #include "../../messages.h"
     44#include <icmp_codes.h>
     45#include <net_messages.h>
    4846
    4947/** ICMP module messages.
  • uspace/lib/socket/include/in.h

    r7d6fe4db r849ed54  
    4040#include <sys/types.h>
    4141
    42 #include "ip_protocols.h"
    43 #include "inet.h"
     42#include <ip_protocols.h>
     43#include <inet.h>
    4444
    4545/** INET string address maximum length.
  • uspace/lib/socket/include/in6.h

    r7d6fe4db r849ed54  
    4040#include <sys/types.h>
    4141
    42 #include "ip_protocols.h"
    43 #include "inet.h"
     42#include <ip_protocols.h>
     43#include <inet.h>
    4444
    4545/** INET6 string address maximum length.
  • uspace/lib/socket/include/inet.h

    r7d6fe4db r849ed54  
    4040#include <sys/types.h>
    4141
    42 #include "byteorder.h"
     42#include <net_byteorder.h>
    4343
    4444/** Type definition of the socket address.
     
    6262 *  @returns ENOTSUP if the address family is not supported.
    6363 */
    64 int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length);
     64extern int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length);
    6565
    6666/** Parses the character string into the address.
     
    7474 *  @returns ENOTSUP if the address family is not supported.
    7575 */
    76 int inet_pton(uint16_t family, const char * address, uint8_t * data);
     76extern int inet_pton(uint16_t family, const char * address, uint8_t * data);
    7777
    7878/** Socket address.
  • uspace/lib/socket/include/net_device.h

    r7d6fe4db r849ed54  
    3838#define __NET_DEVICE_ID_TYPE_H__
    3939
    40 #include "../structures/int_map.h"
     40#include <adt/int_map.h>
    4141
    4242/** Device identifier to generic type map declaration.
  • uspace/lib/socket/include/net_messages.h

    r7d6fe4db r849ed54  
    4343#include <ipc/services.h>
    4444
    45 #include "include/device.h"
    46 
    47 #include "structures/measured_strings.h"
    48 #include "structures/packet/packet.h"
     45#include <net_device.h>
     46#include <adt/measured_strings.h>
     47#include <packet/packet.h>
    4948
    5049/** Returns a value indicating whether the value is in the interval.
  • uspace/lib/socket/include/net_modules.h

    r7d6fe4db r849ed54  
    7070 *  @param[in] answer_count The number of answer parameters.
    7171 */
    72 void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count);
     72extern void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count);
    7373
    7474/** Creates bidirectional connection with the needed module service and registers the message receiver.
     
    8181 *  @returns Other error codes as defined for the ipc_connect_to_me() function.
    8282 */
    83 int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver);
     83extern int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver);
    8484
    8585/** Creates bidirectional connection with the needed module service and registers the message receiver.
     
    9494 *  @returns Other error codes as defined for the ipc_connect_to_me() function.
    9595 */
    96 int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout);
     96extern int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout);
    9797
    9898/** Connects to the needed module.
     
    100100 *  @returns The phone of the needed service.
    101101 */
    102 int connect_to_service(services_t need);
     102extern int connect_to_service(services_t need);
    103103
    104104/** Connects to the needed module.
     
    108108 *  @returns ETIMEOUT if the connection timeouted.
    109109 */
    110 int connect_to_service_timeout(services_t need, suseconds_t timeout);
     110extern int connect_to_service_timeout(services_t need, suseconds_t timeout);
    111111
    112112/** Receives data from the other party.
     
    120120 *  @returns Other error codes as defined for the async_data_write_finalize() function.
    121121 */
    122 int data_receive(void ** data, size_t * length);
     122extern int data_receive(void ** data, size_t * length);
    123123
    124124/** Replies the data to the other party.
     
    130130 *  @returns Other error codes as defined for the async_data_read_finalize() function.
    131131 */
    132 int data_reply(void * data, size_t data_length);
     132extern int data_reply(void * data, size_t data_length);
    133133
    134134/** Refreshes answer structure and parameters count.
     
    137137 *  @param[in,out] answer_count The number of answer parameters.
    138138 */
    139 void refresh_answer(ipc_call_t * answer, int * answer_count);
     139extern void refresh_answer(ipc_call_t * answer, int * answer_count);
    140140
    141141#endif
  • uspace/lib/socket/include/packet/packet.h

    r7d6fe4db r849ed54  
    8989 *  @returns NULL if the mapping does not exist.
    9090 */
    91 packet_t pm_find(packet_id_t packet_id);
     91extern packet_t pm_find(packet_id_t packet_id);
    9292
    9393/** Adds the packet mapping.
     
    9898 *  @returns ENOMEM if there is not enough memory left.
    9999 */
    100 int pm_add(packet_t packet);
     100extern int pm_add(packet_t packet);
    101101
    102102/** Initializes the packet map.
     
    104104 *  @returns ENOMEM if there is not enough memory left.
    105105 */
    106 int pm_init(void);
     106extern int pm_init(void);
    107107
    108108/** Releases the packet map.
    109109 */
    110 void pm_destroy(void);
     110extern void pm_destroy(void);
    111111
    112112/** Add packet to the sorted queue.
     
    121121 *  @returns EINVAL if the packet is not valid.
    122122 */
    123 int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric);
     123extern int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric);
    124124
    125125/** Finds the packet with the given order.
     
    130130 *  @returns NULL if the packet is not found.
    131131 */
    132 packet_t pq_find(packet_t first, size_t order);
     132extern packet_t pq_find(packet_t first, size_t order);
    133133
    134134/** Inserts packet after the given one.
     
    138138 *  @returns EINVAL if etiher of the packets is invalid.
    139139 */
    140 int pq_insert_after(packet_t packet, packet_t new_packet);
     140extern int pq_insert_after(packet_t packet, packet_t new_packet);
    141141
    142142/** Detach the packet from the queue.
     
    146146 *  @returns NULL if the packet is not valid.
    147147 */
    148 packet_t pq_detach(packet_t packet);
     148extern packet_t pq_detach(packet_t packet);
    149149
    150150/** Sets the packet order and metric attributes.
     
    155155 *  @returns EINVAL if the packet is invalid..
    156156 */
    157 int pq_set_order(packet_t packet, size_t order, size_t metric);
     157extern int pq_set_order(packet_t packet, size_t order, size_t metric);
    158158
    159159/** Sets the packet order and metric attributes.
     
    164164 *  @returns EINVAL if the packet is invalid..
    165165 */
    166 int pq_get_order(packet_t packet, size_t * order, size_t * metric);
     166extern int pq_get_order(packet_t packet, size_t * order, size_t * metric);
    167167
    168168/** Releases the whole queue.
     
    171171 *  @param[in] packet_release The releasing function called for each of the packets after its detachment.
    172172 */
    173 void pq_destroy(packet_t first, void (*packet_release)(packet_t packet));
     173extern void pq_destroy(packet_t first, void (*packet_release)(packet_t packet));
    174174
    175175/** Returns the next packet in the queue.
     
    179179 *  @returns NULL if the packet is not valid.
    180180 */
    181 packet_t pq_next(packet_t packet);
     181extern packet_t pq_next(packet_t packet);
    182182
    183183/** Returns the previous packet in the queue.
     
    187187 *  @returns NULL if the packet is not valid.
    188188 */
    189 packet_t pq_previous(packet_t packet);
     189extern packet_t pq_previous(packet_t packet);
    190190
    191191/*@}*/
  • uspace/lib/socket/include/packet/packet_client.h

    r7d6fe4db r849ed54  
    8888 *  @returns NULL if there is not enough memory left.
    8989 */
    90 void * packet_prefix(packet_t packet, size_t length);
     90extern void * packet_prefix(packet_t packet, size_t length);
    9191
    9292/** Allocates the specified space right after the actual packet content and returns its pointer.
     
    9696 *  @returns NULL if there is not enough memory left.
    9797 */
    98 void * packet_suffix(packet_t packet, size_t length);
     98extern void * packet_suffix(packet_t packet, size_t length);
    9999
    100100/** Trims the actual packet content by the specified prefix and suffix lengths.
     
    106106 *  @returns ENOMEM if there is not enough memory left.
    107107 */
    108 int packet_trim(packet_t packet, size_t prefix, size_t suffix);
     108extern int packet_trim(packet_t packet, size_t prefix, size_t suffix);
    109109
    110110/** Copies the specified data to the beginning of the actual packet content.
     
    117117 *  @returns ENOMEM if there is not enough memory left.
    118118 */
    119 int packet_copy_data(packet_t packet, const void * data, size_t length);
     119extern int packet_copy_data(packet_t packet, const void * data, size_t length);
    120120
    121121/** Returns the packet identifier.
     
    124124 *  @returns Zero (0) if the packet is not valid.
    125125 */
    126 packet_id_t packet_get_id(const packet_t packet);
     126extern packet_id_t packet_get_id(const packet_t packet);
    127127
    128128/** Returns the packet content length.
     
    131131 *  @returns Zero (0) if the packet is not valid.
    132132 */
    133 size_t packet_get_data_length(const packet_t packet);
     133extern size_t packet_get_data_length(const packet_t packet);
    134134
    135135/** Returns the pointer to the beginning of the packet content.
     
    138138 *  @returns NULL if the packet is not valid.
    139139 */
    140 void * packet_get_data(const packet_t packet);
     140extern void * packet_get_data(const packet_t packet);
    141141
    142142/** Returns the stored packet addresses and their length.
     
    148148 *  @returns EINVAL if the packet is not valid.
    149149 */
    150 int packet_get_addr(const packet_t packet, uint8_t ** src, uint8_t ** dest);
     150extern int packet_get_addr(const packet_t packet, uint8_t ** src, uint8_t ** dest);
    151151
    152152/** Sets the packet addresses.
     
    159159 *  @returns ENOMEM if there is not enough memory left.
    160160 */
    161 int packet_set_addr(packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len);
     161extern int packet_set_addr(packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len);
    162162
    163163/** Translates the packet identifier to the packet reference.
     
    172172 *  @returns Other error codes as defined for the packet_return() function.
    173173 */
    174 int packet_translate(int phone, packet_ref packet, packet_id_t packet_id);
     174extern int packet_translate(int phone, packet_ref packet, packet_id_t packet_id);
    175175
    176176/** Obtains the packet of the given dimensions.
     
    184184 *  @returns NULL on error.
    185185 */
    186 packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);
     186extern packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);
    187187
    188188/** Obtains the packet of the given content size.
     
    193193 *  @returns NULL on error.
    194194 */
    195 packet_t packet_get_1(int phone, size_t content);
     195extern packet_t packet_get_1(int phone, size_t content);
    196196
    197197/** Releases the packet queue.
     
    202202 *  @param[in] packet_id The packet identifier.
    203203 */
    204 void pq_release(int phone, packet_id_t packet_id);
     204extern void pq_release(int phone, packet_id_t packet_id);
    205205
    206206/** Returns the packet copy.
     
    212212 *  @returns NULL on error.
    213213 */
    214 packet_t packet_get_copy(int phone, packet_t packet);
     214extern packet_t packet_get_copy(int phone, packet_t packet);
    215215
    216216/*@}*/
  • uspace/lib/socket/include/packet/packet_header.h

    r7d6fe4db r849ed54  
    3838#define __NET_PACKET_HEADER_H__
    3939
    40 #include "packet.h"
     40#include <packet/packet.h>
    4141
    4242/** Returns the actual packet data length.
  • uspace/lib/socket/include/packet/packet_messages.h

    r7d6fe4db r849ed54  
    4040#include <ipc/ipc.h>
    4141
    42 #include "../../messages.h"
     42#include <net_messages.h>
    4343
    4444/** Packet server module messages.
  • uspace/lib/socket/include/packet/packet_server.h

    r7d6fe4db r849ed54  
    5656 *  @returns Other error codes as defined for the packet_release_wrapper() function.
    5757 */
    58 int packet_server_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     58extern int packet_server_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    5959
    6060#endif
  • uspace/lib/socket/include/socket.h

    r7d6fe4db r849ed54  
    4040#define __NET_SOCKET_H__
    4141
    42 #include "byteorder.h"
    43 #include "in.h"
    44 #include "in6.h"
    45 #include "inet.h"
    46 
    47 #include "socket_codes.h"
    48 #include "socket_errno.h"
     42#include <net_byteorder.h>
     43#include <in.h>
     44#include <in6.h>
     45#include <inet.h>
     46#include <socket_codes.h>
     47#include <socket_errno.h>
    4948
    5049/** @name Socket application programming interface
     
    6564 *  @returns Other error codes as defined for the bind_service_timeout() function.
    6665 */
    67 int socket(int domain, int type, int protocol);
     66extern int socket(int domain, int type, int protocol);
    6867
    6968/** Binds the socket to a port address.
     
    7776 *  @returns Other error codes as defined for the NET_SOCKET_BIND message.
    7877 */
    79 int bind(int socket_id, const struct sockaddr * my_addr, socklen_t addrlen);
     78extern int bind(int socket_id, const struct sockaddr * my_addr, socklen_t addrlen);
    8079
    8180/** Sets the number of connections waiting to be accepted.
     
    8786 *  @returns Other error codes as defined for the NET_SOCKET_LISTEN message.
    8887 */
    89 int listen(int socket_id, int backlog);
     88extern int listen(int socket_id, int backlog);
    9089
    9190/** Accepts waiting socket.
     
    10099 *  @returns Other error codes as defined for the NET_SOCKET_ACCEPT message.
    101100 */
    102 int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen);
     101extern int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen);
    103102
    104103/** Connects socket to the remote server.
     
    112111 *  @returns Other error codes as defined for the NET_SOCKET_CONNECT message.
    113112 */
    114 int connect(int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen);
     113extern int connect(int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen);
    115114
    116115/** Closes the socket.
     
    121120 *  @returns Other error codes as defined for the NET_SOCKET_CLOSE message.
    122121 */
    123 int closesocket(int socket_id);
     122extern int closesocket(int socket_id);
    124123
    125124/** Sends data via the socket.
     
    134133 *  @returns Other error codes as defined for the NET_SOCKET_SEND message.
    135134 */
    136 int send(int socket_id, void * data, size_t datalength, int flags);
     135extern int send(int socket_id, void * data, size_t datalength, int flags);
    137136
    138137/** Sends data via the socket to the remote address.
     
    150149 *  @returns Other error codes as defined for the NET_SOCKET_SENDTO message.
    151150 */
    152 int sendto(int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen);
     151extern int sendto(int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen);
    153152
    154153/** Receives data via the socket.
     
    163162 *  @returns Other error codes as defined for the NET_SOCKET_RECV message.
    164163 */
    165 int recv(int socket_id, void * data, size_t datalength, int flags);
     164extern int recv(int socket_id, void * data, size_t datalength, int flags);
    166165
    167166/** Receives data via the socket.
     
    178177 *  @returns Other error codes as defined for the NET_SOCKET_RECVFROM message.
    179178 */
    180 int recvfrom(int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen);
     179extern int recvfrom(int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen);
    181180
    182181/** Gets socket option.
     
    192191 *  @returns Other error codes as defined for the NET_SOCKET_GETSOCKOPT message.
    193192 */
    194 int getsockopt(int socket_id, int level, int optname, void * value, size_t * optlen);
     193extern int getsockopt(int socket_id, int level, int optname, void * value, size_t * optlen);
    195194
    196195/** Sets socket option.
     
    206205 *  @returns Other error codes as defined for the NET_SOCKET_SETSOCKOPT message.
    207206 */
    208 int setsockopt(int socket_id, int level, int optname, const void * value, size_t optlen);
     207extern int setsockopt(int socket_id, int level, int optname, const void * value, size_t optlen);
    209208
    210209/*@}*/
  • uspace/lib/socket/include/socket_core.h

    r7d6fe4db r849ed54  
    4040#include <sys/types.h>
    4141
    42 #include "../include/in.h"
    43 #include "../include/device.h"
    44 
    45 #include "../structures/generic_char_map.h"
    46 #include "../structures/dynamic_fifo.h"
    47 #include "../structures/int_map.h"
    48 #include "../structures/packet/packet.h"
     42#include <in.h>
     43#include <net_device.h>
     44#include <adt/generic_char_map.h>
     45#include <adt/dynamic_fifo.h>
     46#include <adt/int_map.h>
     47#include <packet/packet.h>
    4948
    5049/** Initial size of the received packet queue.
     
    139138 *  @param[in] socket_release The client release callback function.
    140139 */
    141 void socket_cores_release(int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
     140extern void socket_cores_release(int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
    142141
    143142/** Binds the socket to the port.
     
    158157 *  @returns Other error codes as defined for the socket_bind_insert() function.
    159158 */
    160 int socket_bind(socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port);
     159extern int socket_bind(socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port);
    161160
    162161/** Binds the socket to a free port.
     
    171170 *  @returns Other error codes as defined for the socket_bind_insert() function.
    172171 */
    173 int socket_bind_free_port(socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port);
     172extern int socket_bind_free_port(socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port);
    174173
    175174/** Creates a new socket.
     
    182181 *  @returns ENOMEM if there is not enough memory left.
    183182 */
    184 int socket_create(socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id);
     183extern int socket_create(socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id);
    185184
    186185/** Destroys the socket.
     
    195194 *  @returns ENOTSOCK if the socket is not found.
    196195 */
    197 int socket_destroy(int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
     196extern int socket_destroy(int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
    198197
    199198/** Replies the packet or the packet queue data to the application via the socket.
     
    206205 *  @returns Other error codes as defined for the data_reply() function.
    207206 */
    208 int socket_reply_packets(packet_t packet, size_t * length);
     207extern int socket_reply_packets(packet_t packet, size_t * length);
    209208
    210209/** Finds the bound port socket.
     
    216215 *  @returns NULL if no socket was found.
    217216 */
    218 socket_core_ref socket_port_find(socket_ports_ref global_sockets, int port, const char * key, size_t key_length);
     217extern socket_core_ref socket_port_find(socket_ports_ref global_sockets, int port, const char * key, size_t key_length);
    219218
    220219/** Releases the socket port.
     
    224223 *  @param[in] socket The socket to be unbound.
    225224 */
    226 void socket_port_release(socket_ports_ref global_sockets, socket_core_ref socket);
     225extern void socket_port_release(socket_ports_ref global_sockets, socket_core_ref socket);
    227226
    228227/** Adds the socket to an already bound port.
     
    236235 *  @returns Other error codes as defined for the socket_port_add_core() function.
    237236 */
    238 int socket_port_add(socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length);
     237extern int socket_port_add(socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length);
    239238
    240239#endif
  • uspace/lib/socket/include/socket_messages.h

    r7d6fe4db r849ed54  
    4242#include <ipc/ipc.h>
    4343
    44 #include "../messages.h"
    45 
    46 #include "../include/socket_codes.h"
     44#include <net_messages.h>
     45#include <socket_codes.h>
    4746
    4847/** Socket client messages.
Note: See TracChangeset for help on using the changeset viewer.