Changeset a7a7f8c in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2012-04-20T07:32:57Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
097f421
Parents:
90f067d9 (diff), 606c369 (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:

Merge mainline changes

Location:
uspace/lib/c/include
Files:
1 added
11 deleted
4 edited
6 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/async.h

    r90f067d9 ra7a7f8c  
    139139extern void async_wait_for(aid_t, sysarg_t *);
    140140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
     141extern void async_forget(aid_t);
    141142
    142143extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
  • uspace/lib/c/include/inet/inet.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup libc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Hardware types according to the on-line IANA - Address Resolution Protocol
    35  * (ARP) Parameters
    36  * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml,
    37  * cited January 14 2009.
    3833 */
    3934
    40 #ifndef LIBNET_NET_HARDWARE_H_
    41 #define LIBNET_NET_HARDWARE_H_
     35#ifndef LIBC_INET_INET_H_
     36#define LIBC_INET_INET_H_
    4237
    4338#include <sys/types.h>
    4439
    45 /** Network interface layer type type definition. */
    46 typedef uint8_t hw_type_t;
     40#define INET_TTL_MAX 255
    4741
    48 /** @name Network interface layer types definitions */
    49 /*@{*/
     42typedef struct {
     43        uint32_t ipv4;
     44} inet_addr_t;
    5045
    51 /** Ethernet (10Mb) hardware type. */
    52 #define HW_ETHER                1
     46typedef struct {
     47        inet_addr_t src;
     48        inet_addr_t dest;
     49        uint8_t tos;
     50        void *data;
     51        size_t size;
     52} inet_dgram_t;
    5353
    54 /*@}*/
     54typedef struct {
     55        int (*recv)(inet_dgram_t *);
     56} inet_ev_ops_t;
     57
     58typedef enum {
     59        INET_DF = 1
     60} inet_df_t;
     61
     62extern int inet_init(uint8_t, inet_ev_ops_t *);
     63extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t);
     64extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
    5565
    5666#endif
     
    5868/** @}
    5969 */
    60 
  • uspace/lib/c/include/inet/inetping.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  * ICMP common interface implementation.
    35  * @see icmp_common.h
    36  */
     35#ifndef LIBC_INET_INETPING_H_
     36#define LIBC_INET_INETPING_H_
    3737
    38 #include <net/modules.h>
    39 #include <net/icmp_common.h>
    40 #include <ipc/services.h>
    41 #include <ipc/icmp.h>
    42 #include <sys/time.h>
    43 #include <async.h>
     38#include <inet/inet.h>
     39#include <sys/types.h>
    4440
    45 /** Connect to the ICMP module.
    46  *
    47  * @return ICMP module session.
    48  *
    49  */
    50 async_sess_t *icmp_connect_module(void)
    51 {
    52         return connect_to_service(SERVICE_ICMP);
    53 }
     41typedef struct {
     42        inet_addr_t src;
     43        inet_addr_t dest;
     44        uint16_t seq_no;
     45        void *data;
     46        size_t size;
     47} inetping_sdu_t;
     48
     49typedef struct inetping_ev_ops {
     50        int (*recv)(inetping_sdu_t *);
     51} inetping_ev_ops_t;
     52
     53extern int inetping_init(inetping_ev_ops_t *);
     54extern int inetping_send(inetping_sdu_t *);
     55extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
     56
     57
     58#endif
    5459
    5560/** @}
  • uspace/lib/c/include/inet/iplink.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup libc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Internetwork layer module interface for the underlying network interface
    35  * layer. This interface is always called by the remote modules.
    3633 */
    3734
    38 #ifndef LIBNET_IL_REMOTE_H_
    39 #define LIBNET_IL_REMOTE_H_
     35#ifndef LIBC_INET_IPLINK_H_
     36#define LIBC_INET_IPLINK_H_
    4037
    41 #include <ipc/services.h>
     38#include <async.h>
    4239#include <sys/types.h>
    43 #include <net/device.h>
    44 #include <net/packet.h>
    45 #include <async.h>
    4640
    47 /** @name Internetwork layer module interface
    48  * This interface is used by other modules.
    49  */
    50 /*@{*/
     41struct iplink_ev_ops;
    5142
    52 extern int il_device_state_msg(async_sess_t *, nic_device_id_t,
    53     nic_device_state_t, services_t);
    54 extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
    55     services_t);
    56 extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    57     services_t);
    58 extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    59     const uint8_t *);
     43typedef struct {
     44        async_sess_t *sess;
     45        struct iplink_ev_ops *ev_ops;
     46} iplink_t;
    6047
    61 /*@}*/
     48typedef struct {
     49        uint32_t ipv4;
     50} iplink_addr_t;
     51
     52/** IP link Service Data Unit */
     53typedef struct {
     54        /** Local source address */
     55        iplink_addr_t lsrc;
     56        /** Local destination address */
     57        iplink_addr_t ldest;
     58        /** Serialized IP packet */
     59        void *data;
     60        /** Size of @c data in bytes */
     61        size_t size;
     62} iplink_sdu_t;
     63
     64typedef struct iplink_ev_ops {
     65        int (*recv)(iplink_t *, iplink_sdu_t *);
     66} iplink_ev_ops_t;
     67
     68extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **);
     69extern void iplink_close(iplink_t *);
     70extern int iplink_send(iplink_t *, iplink_sdu_t *);
     71extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
     72extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
     73extern int iplink_get_mtu(iplink_t *, size_t *);
    6274
    6375#endif
  • uspace/lib/c/include/inet/iplink_srv.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  * Character string with measured length.
    35  * The structure has been designed for serialization of character strings
    36  * between modules.
    37  */
     35#ifndef LIBC_INET_IPLINK_SRV_H_
     36#define LIBC_INET_IPLINK_SRV_H_
    3837
    39 #ifndef LIBC_MEASURED_STRINGS_H_
    40 #define LIBC_MEASURED_STRINGS_H_
     38#include <async.h>
     39#include <fibril_synch.h>
     40#include <bool.h>
     41#include <sys/types.h>
    4142
    42 #include <sys/types.h>
    43 #include <async.h>
     43struct iplink_ops;
    4444
    45 /** Type definition of the character string with measured length.
    46  * @see measured_string
    47  */
    48 typedef struct measured_string measured_string_t;
     45typedef struct {
     46        fibril_mutex_t lock;
     47        bool connected;
     48        struct iplink_ops *ops;
     49        void *arg;
     50        async_sess_t *client_sess;
     51} iplink_srv_t;
    4952
    50 /** Character string with measured length.
    51  *
    52  * This structure has been designed for serialization of character strings
    53  * between modules.
    54  */
    55 struct measured_string {
    56         /** Character string data. */
    57         uint8_t *value;
    58         /** Character string length. */
    59         size_t length;
    60 };
     53typedef struct {
     54        uint32_t ipv4;
     55} iplink_srv_addr_t;
    6156
    62 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t);
    63 extern measured_string_t *measured_string_copy(measured_string_t *);
     57/** IP link Service Data Unit */
     58typedef struct {
     59        /** Local source address */
     60        iplink_srv_addr_t lsrc;
     61        /** Local destination address */
     62        iplink_srv_addr_t ldest;
     63        /** Serialized IP packet */
     64        void *data;
     65        /** Size of @c data in bytes */
     66        size_t size;
     67} iplink_srv_sdu_t;
    6468
    65 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
    66 extern int measured_strings_reply(const measured_string_t *, size_t);
     69typedef struct iplink_ops {
     70        int (*open)(iplink_srv_t *);
     71        int (*close)(iplink_srv_t *);
     72        int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
     73        int (*get_mtu)(iplink_srv_t *, size_t *);
     74        int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);
     75        int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);
     76} iplink_ops_t;
    6777
    68 extern int measured_strings_return(async_exch_t *, measured_string_t **,
    69     uint8_t **, size_t);
    70 extern int measured_strings_send(async_exch_t *, const measured_string_t *,
    71     size_t);
     78extern void iplink_srv_init(iplink_srv_t *);
     79
     80extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
     81extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *);
    7282
    7383#endif
  • uspace/lib/c/include/ipc/inet.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
    3  * Copyright (c) 2011 Radim Vansa
     2 * Copyright (c) 2012 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup libpacket
     29/** @addtogroup libcipc
    3130 * @{
    3231 */
    33 
    3432/** @file
    35  * Packet server.
    36  * The hosting module has to be compiled with both the packet.c and the
    37  * packet_server.c source files. To function correctly, initialization of the
    38  * packet map by the pm_init() function has to happen at the first place. Then
    39  * the packet messages have to be processed by the packet_server_message()
    40  * function. The packet map should be released by the pm_destroy() function
    41  * during the module termination.
    42  * @see IS_NET_PACKET_MESSAGE()
    4333 */
    4434
    45 #ifndef NET_PACKET_SERVER_H_
    46 #define NET_PACKET_SERVER_H_
     35#ifndef LIBC_IPC_INET_H_
     36#define LIBC_IPC_INET_H_
    4737
    4838#include <ipc/common.h>
    4939
    50 extern int packet_server_init(void);
    51 extern int packet_server_message(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    52     size_t *);
     40/** Inet ports */
     41typedef enum {
     42        /** Default port */
     43        INET_PORT_DEFAULT = 1,
     44        /** Configuration port */
     45        INET_PORT_CFG,
     46        /** Ping service port */
     47        INET_PORT_PING
     48} inet_port_t;
     49
     50/** Requests on Inet default port */
     51typedef enum {
     52        INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
     53        INET_GET_SRCADDR,
     54        INET_SEND,
     55        INET_SET_PROTO
     56} inet_request_t;
     57
     58/** Events on Inet default port */
     59typedef enum {
     60        INET_EV_RECV = IPC_FIRST_USER_METHOD
     61} inet_event_t;
     62
     63/** Requests on Inet configuration port */
     64typedef enum {
     65        INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD,
     66        INETCFG_ADDR_DELETE,
     67        INETCFG_ADDR_GET,
     68        INETCFG_ADDR_GET_ID,
     69        INETCFG_GET_ADDR_LIST,
     70        INETCFG_GET_LINK_LIST,
     71        INETCFG_GET_SROUTE_LIST,
     72        INETCFG_LINK_GET,
     73        INETCFG_SROUTE_CREATE,
     74        INETCFG_SROUTE_DELETE,
     75        INETCFG_SROUTE_GET,
     76        INETCFG_SROUTE_GET_ID
     77} inetcfg_request_t;
     78
     79/** Events on Inet ping port */
     80typedef enum {
     81        INETPING_EV_RECV = IPC_FIRST_USER_METHOD
     82} inetping_event_t;
     83
     84/** Requests on Inet ping port */
     85typedef enum {
     86        INETPING_SEND = IPC_FIRST_USER_METHOD,
     87        INETPING_GET_SRCADDR
     88} inetping_request_t;
    5389
    5490#endif
    5591
    56 /** @}
     92/**
     93 * @}
    5794 */
  • uspace/lib/c/include/ipc/iplink.h

    r90f067d9 ra7a7f8c  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup libcipc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Transport layer modules messages.
    35  * @see tl_interface.h
    3633 */
    3734
    38 #ifndef LIBC_TL_MESSAGES_H_
    39 #define LIBC_TL_MESSAGES_H_
     35#ifndef LIBC_IPC_IPLINK_H_
     36#define LIBC_IPC_IPLINK_H_
    4037
    41 #include <ipc/net.h>
     38#include <ipc/common.h>
    4239
    43 /** Transport layer modules messages. */
    4440typedef enum {
    45         /** Packet received message.
    46          * @see tl_received_msg()
    47          */
    48         NET_TL_RECEIVED = NET_TL_FIRST
    49 } tl_messages;
     41        IPLINK_GET_MTU = IPC_FIRST_USER_METHOD,
     42        IPLINK_SEND,
     43        IPLINK_ADDR_ADD,
     44        IPLINK_ADDR_REMOVE
     45} iplink_request_t;
     46
     47typedef enum {
     48        IPLINK_EV_RECV = IPC_FIRST_USER_METHOD
     49} iplink_event_t;
    5050
    5151#endif
    5252
    53 /** @}
     53/**
     54 * @}
    5455 */
  • uspace/lib/c/include/ipc/services.h

    r90f067d9 ra7a7f8c  
    4848        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
    4949        SERVICE_CLIPBOARD  = FOURCC('c', 'l', 'i', 'p'),
    50         SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),
    51         SERVICE_ETHERNET   = FOURCC('e', 't', 'h', ' '),
    52         SERVICE_NILDUMMY   = FOURCC('n', 'i', 'l', 'd'),
    53         SERVICE_IP         = FOURCC('i', 'p', 'v', '4'),
    54         SERVICE_ARP        = FOURCC('a', 'r', 'p', ' '),
    55         SERVICE_ICMP       = FOURCC('i', 'c', 'm', 'p'),
    5650        SERVICE_UDP        = FOURCC('u', 'd', 'p', ' '),
    5751        SERVICE_TCP        = FOURCC('t', 'c', 'p', ' ')
    5852} services_t;
     53
     54#define SERVICE_NAME_INET     "net/inet"
     55#define SERVICE_NAME_INETCFG  "net/inetcfg"
     56#define SERVICE_NAME_INETPING "net/inetping"
    5957
    6058#endif
  • uspace/lib/c/include/ipc/socket.h

    r90f067d9 ra7a7f8c  
    3838#define LIBC_SOCKET_MESSAGES_H_
    3939
    40 #include <ipc/net.h>
    41 
    4240/** Socket client messages. */
    4341typedef enum {
    4442        /** Creates a new socket. @see socket() */
    45         NET_SOCKET = NET_SOCKET_FIRST,
     43        NET_SOCKET = IPC_FIRST_USER_METHOD,
    4644        /** Binds the socket. @see bind() */
    4745        NET_SOCKET_BIND,
  • uspace/lib/c/include/net/in.h

    r90f067d9 ra7a7f8c  
    4545#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
     47#define INADDR_ANY 0
     48
    4749/** Type definition of the INET address.
    4850 * @see in_addr
Note: See TracChangeset for help on using the changeset viewer.