Changeset 98abd40 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2013-07-06T21:57:22Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c8bb1633, cdc8a391
Parents:
b8e72fd1 (diff), 507c6f3 (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:
2 added
16 edited

Legend:

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

    rb8e72fd1 r98abd40  
    5757} bd_srv_t;
    5858
    59 typedef struct bd_ops {
     59struct bd_ops {
    6060        int (*open)(bd_srvs_t *, bd_srv_t *);
    6161        int (*close)(bd_srv_t *);
     
    6565        int (*get_block_size)(bd_srv_t *, size_t *);
    6666        int (*get_num_blocks)(bd_srv_t *, aoff64_t *);
    67 } bd_ops_t;
     67};
    6868
    6969extern void bd_srvs_init(bd_srvs_t *);
  • uspace/lib/c/include/inet/addr.h

    rb8e72fd1 r98abd40  
    3737
    3838#include <stdint.h>
     39#include <net/in.h>
     40#include <net/in6.h>
     41
     42typedef uint32_t addr32_t;
     43typedef uint8_t addr48_t[6];
     44typedef uint8_t addr128_t[16];
    3945
    4046/** Node address */
    4147typedef struct {
    42         uint32_t ipv4;
     48        uint16_t family;
     49        union {
     50                addr32_t addr;
     51                addr128_t addr6;
     52        };
    4353} inet_addr_t;
    4454
    4555/** Network address */
    4656typedef struct {
     57        /** Address family */
     58        uint16_t family;
     59       
    4760        /** Address */
    48         uint32_t ipv4;
    49         /** Number of valid bits in @c ipv4 */
    50         int bits;
     61        union {
     62                addr32_t addr;
     63                addr128_t addr6;
     64        };
     65       
     66        /** Number of valid bits */
     67        uint8_t prefix;
    5168} inet_naddr_t;
    5269
     70extern const addr48_t addr48_broadcast;
     71
     72extern void addr48(const addr48_t, addr48_t);
     73extern void addr128(const addr128_t, addr128_t);
     74
     75extern void host2addr128_t_be(const addr128_t, addr128_t);
     76extern void addr128_t_be2host(const addr128_t, addr128_t);
     77
     78extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t);
     79extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t,
     80    uint8_t);
     81
     82extern void inet_addr6(inet_addr_t *, uint16_t, uint16_t, uint16_t, uint16_t,
     83    uint16_t, uint16_t, uint16_t, uint16_t);
     84extern void inet_naddr6(inet_naddr_t *, uint16_t, uint16_t, uint16_t, uint16_t,
     85    uint16_t, uint16_t, uint16_t, uint16_t, uint8_t);
     86
     87extern int inet_addr_family(const char *, uint16_t *);
     88extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *);
     89
     90extern void inet_addr_any(inet_addr_t *);
     91extern void inet_naddr_any(inet_naddr_t *);
     92
     93extern int inet_addr_compare(const inet_addr_t *, const inet_addr_t *);
     94extern int inet_addr_is_any(const inet_addr_t *);
     95
     96extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *);
     97
     98extern int inet_addr_parse(const char *, inet_addr_t *);
    5399extern int inet_naddr_parse(const char *, inet_naddr_t *);
    54 extern int inet_addr_parse(const char *, inet_addr_t *);
    55 extern int inet_naddr_format(inet_naddr_t *, char **);
    56 extern int inet_addr_format(inet_addr_t *, char **);
     100
     101extern int inet_addr_format(const inet_addr_t *, char **);
     102extern int inet_naddr_format(const inet_naddr_t *, char **);
     103
     104extern uint16_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *);
     105extern uint16_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *,
     106    uint8_t *);
     107
     108extern void inet_addr_set(addr32_t, inet_addr_t *);
     109extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *);
     110extern void inet_sockaddr_in_addr(const sockaddr_in_t *, inet_addr_t *);
     111
     112extern void inet_addr_set6(addr128_t, inet_addr_t *);
     113extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *);
     114extern void inet_sockaddr_in6_addr(const sockaddr_in6_t *, inet_addr_t *);
     115
     116extern uint16_t inet_addr_sockaddr_in(const inet_addr_t *, sockaddr_in_t *,
     117    sockaddr_in6_t *);
    57118
    58119#endif
  • uspace/lib/c/include/inet/dnsr.h

    rb8e72fd1 r98abd40  
    3737
    3838#include <inet/inet.h>
     39#include <inet/addr.h>
    3940
    4041enum {
  • uspace/lib/c/include/inet/inetping.h

    rb8e72fd1 r98abd40  
    4040
    4141typedef struct {
    42         inet_addr_t src;
    43         inet_addr_t dest;
     42        uint32_t src;
     43        uint32_t dest;
    4444        uint16_t seq_no;
    4545        void *data;
     
    5353extern int inetping_init(inetping_ev_ops_t *);
    5454extern int inetping_send(inetping_sdu_t *);
    55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
    56 
     55extern int inetping_get_srcaddr(uint32_t, uint32_t *);
    5756
    5857#endif
  • uspace/lib/c/include/inet/iplink.h

    rb8e72fd1 r98abd40  
    3838#include <async.h>
    3939#include <sys/types.h>
     40#include <inet/addr.h>
    4041
    4142struct iplink_ev_ops;
     
    4647} iplink_t;
    4748
    48 typedef struct {
    49         uint32_t ipv4;
    50 } iplink_addr_t;
    51 
    52 /** IP link Service Data Unit */
     49/** Internet link Service Data Unit */
    5350typedef struct {
    5451        /** Local source address */
    55         iplink_addr_t lsrc;
     52        inet_addr_t src;
    5653        /** Local destination address */
    57         iplink_addr_t ldest;
     54        inet_addr_t dest;
    5855        /** Serialized IP packet */
    5956        void *data;
     
    6259} iplink_sdu_t;
    6360
     61/** Internet link receive Service Data Unit */
     62typedef struct {
     63        /** Serialized datagram */
     64        void *data;
     65        /** Size of @c data in bytes */
     66        size_t size;
     67} iplink_recv_sdu_t;
     68
    6469typedef struct iplink_ev_ops {
    65         int (*recv)(iplink_t *, iplink_sdu_t *);
     70        int (*recv)(iplink_t *, iplink_recv_sdu_t *, uint16_t);
    6671} iplink_ev_ops_t;
    6772
     
    6974extern void iplink_close(iplink_t *);
    7075extern int iplink_send(iplink_t *, iplink_sdu_t *);
    71 extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
    72 extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
     76extern int iplink_addr_add(iplink_t *, inet_addr_t *);
     77extern int iplink_addr_remove(iplink_t *, inet_addr_t *);
    7378extern int iplink_get_mtu(iplink_t *, size_t *);
    7479
  • uspace/lib/c/include/inet/iplink_srv.h

    rb8e72fd1 r98abd40  
    4040#include <stdbool.h>
    4141#include <sys/types.h>
     42#include <inet/addr.h>
     43#include <inet/iplink.h>
    4244
    4345struct iplink_ops;
     
    5153} iplink_srv_t;
    5254
    53 typedef struct {
    54         uint32_t ipv4;
    55 } iplink_srv_addr_t;
    56 
    57 /** IP link Service Data Unit */
    58 typedef 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;
    68 
    6955typedef struct iplink_ops {
    7056        int (*open)(iplink_srv_t *);
    7157        int (*close)(iplink_srv_t *);
    72         int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
     58        int (*send)(iplink_srv_t *, iplink_sdu_t *);
    7359        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 *);
     60        int (*addr_add)(iplink_srv_t *, inet_addr_t *);
     61        int (*addr_remove)(iplink_srv_t *, inet_addr_t *);
    7662} iplink_ops_t;
    7763
     
    7965
    8066extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
    81 extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *);
     67extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, uint16_t);
    8268
    8369#endif
  • uspace/lib/c/include/io/con_srv.h

    rb8e72fd1 r98abd40  
    6666} con_srv_t;
    6767
    68 typedef struct con_ops {
     68struct con_ops {
    6969        int (*open)(con_srvs_t *, con_srv_t *);
    7070        int (*close)(con_srv_t *);
     
    8383        void (*set_cursor_visibility)(con_srv_t *, bool);
    8484        int (*get_event)(con_srv_t *, cons_event_t *);
    85 } con_ops_t;
     85};
    8686
    8787extern void con_srvs_init(con_srvs_t *);
  • uspace/lib/c/include/ipc/inet.h

    rb8e72fd1 r98abd40  
    4545        INET_PORT_CFG,
    4646        /** Ping service port */
    47         INET_PORT_PING
     47        INET_PORT_PING,
     48        /** Ping6 service port */
     49        INET_PORT_PING6
    4850} inet_port_t;
    4951
     
    8890} inetping_request_t;
    8991
     92/** Events on Inet ping6 port */
     93typedef enum {
     94        INETPING6_EV_RECV = IPC_FIRST_USER_METHOD
     95} inetping6_event_t;
     96
     97/** Requests on Inet ping6 port */
     98typedef enum {
     99        INETPING6_SEND = IPC_FIRST_USER_METHOD,
     100        INETPING6_GET_SRCADDR
     101} inetping6_request_t;
     102
    90103#endif
    91104
  • uspace/lib/c/include/ipc/services.h

    rb8e72fd1 r98abd40  
    5353} services_t;
    5454
    55 #define SERVICE_NAME_DNSR     "net/dnsr"
    56 #define SERVICE_NAME_INET     "net/inet"
    57 #define SERVICE_NAME_INETCFG  "net/inetcfg"
    58 #define SERVICE_NAME_INETPING "net/inetping"
     55#define SERVICE_NAME_DNSR       "net/dnsr"
     56#define SERVICE_NAME_INET       "net/inet"
     57#define SERVICE_NAME_INETCFG    "net/inetcfg"
     58#define SERVICE_NAME_INETPING   "net/inetping"
     59#define SERVICE_NAME_INETPING6  "net/inetping6"
    5960
    6061#endif
  • uspace/lib/c/include/mem.h

    rb8e72fd1 r98abd40  
    3737
    3838#include <sys/types.h>
     39#include <cc.h>
    3940
    4041extern void *memset(void *, int, size_t)
    41     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     42    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4243extern void *memcpy(void *, const void *, size_t)
    43     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     44    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4445extern void *memmove(void *, const void *, size_t);
    4546extern int memcmp(const void *, const void *, size_t);
  • uspace/lib/c/include/net/in.h

    rb8e72fd1 r98abd40  
    4545#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
    47 #define INADDR_ANY 0
    48 
    49 /** Type definition of the INET address.
    50  * @see in_addr
    51  */
    52 typedef struct in_addr in_addr_t;
    53 
    54 /** Type definition of the INET socket address.
    55  * @see sockaddr_in
    56  */
    57 typedef struct sockaddr_in      sockaddr_in_t;
     47#define INADDR_ANY  0
    5848
    5949/** INET address. */
    60 struct in_addr {
     50typedef struct in_addr {
    6151        /** 4 byte IP address. */
    6252        uint32_t s_addr;
    63 };
     53} in_addr_t;
    6454
    6555/** INET socket address.
    6656 * @see sockaddr
    6757 */
    68 struct sockaddr_in {
     58typedef struct sockaddr_in {
    6959        /** Address family. Should be AF_INET. */
    7060        uint16_t sin_family;
     
    7262        uint16_t sin_port;
    7363        /** Internet address. */
    74         struct in_addr sin_addr;
     64        in_addr_t sin_addr;
    7565        /** Padding to meet the sockaddr size. */
    7666        uint8_t sin_zero[8];
    77 };
     67} sockaddr_in_t;
    7868
    7969#endif
  • uspace/lib/c/include/net/in6.h

    rb8e72fd1 r98abd40  
    4343
    4444/** INET6 string address maximum length. */
    45 #define INET6_ADDRSTRLEN        (8 * 4 + 7 + 1)
    46 
    47 /** Type definition of the INET6 address.
    48  * @see in6_addr
    49  */
    50 typedef struct in6_addr in6_addr_t;
    51 
    52 /** Type definition of the INET6 socket address.
    53  * @see sockaddr_in6
    54  */
    55 typedef struct sockaddr_in6     sockaddr_in6_t;
     45#define INET6_ADDRSTRLEN  (8 * 4 + 7 + 1)
    5646
    5747/** INET6 address. */
    58 struct in6_addr {
     48typedef struct in6_addr {
    5949        /** 16 byte IPv6 address. */
    60         unsigned char s6_addr[16];
    61 };
     50        uint8_t s6_addr[16];
     51} in6_addr_t;
    6252
    6353/** INET6 socket address.
    6454 * @see sockaddr
    6555 */
    66 struct sockaddr_in6 {
     56typedef struct sockaddr_in6 {
    6757        /** Address family. Should be AF_INET6. */
    6858        uint16_t sin6_family;
     
    7565        /** Scope identifier. */
    7666        uint32_t sin6_scope_id;
    77 };
     67} sockaddr_in6_t;
     68
     69extern const in6_addr_t in6addr_any;
    7870
    7971#endif
  • uspace/lib/c/include/net/inet.h

    rb8e72fd1 r98abd40  
    4141#include <byteorder.h>
    4242
    43 /** Type definition of the socket address.
    44  * @see sockaddr
    45  */
    46 typedef struct sockaddr         sockaddr_t;
    47 
    4843/** Type definition of the address information.
    4944 * @see addrinfo
    5045 */
    51 typedef struct addrinfo         addrinfo_t;
     46typedef struct addrinfo addrinfo_t;
    5247
    5348/** Socket address. */
    54 struct sockaddr {
     49typedef struct sockaddr {
    5550        /** Address family. @see socket.h */
    5651        uint16_t sa_family;
    5752        /** 14 byte protocol address. */
    5853        uint8_t sa_data[14];
    59 };
     54} sockaddr_t;
    6055
    6156extern int inet_ntop(uint16_t, const uint8_t *, char *, size_t);
  • uspace/lib/c/include/net/ip_protocols.h

    rb8e72fd1 r98abd40  
    4444/*@{*/
    4545
    46 #define IPPROTO_ICMP    1
    47 #define IPPROTO_TCP     6
    48 #define IPPROTO_UDP     17
     46#define IPPROTO_ICMP    1
     47#define IPPROTO_TCP     6
     48#define IPPROTO_UDP     17
     49#define IPPROTO_ICMPV6  58
    4950
    5051/*@}*/
  • uspace/lib/c/include/net/socket_codes.h

    rb8e72fd1 r98abd40  
    4545
    4646enum {
    47         AF_UNKNOWN = 0,
    48         AF_INET,        /* IPv4 address */
    49         AF_INET6        /* IPv6 address */
     47        AF_NONE = 0,
     48        AF_INET,  /* IPv4 address */
     49        AF_INET6  /* IPv6 address */
    5050};
    5151
     
    5353
    5454/** @name Protocol families definitions
    55  *  Same as address families.
     55 * Same as address families.
    5656 */
    5757/*@{*/
    5858
    59 #define PF_INET         AF_INET
    60 #define PF_INET6        AF_INET6
     59#define PF_INET   AF_INET
     60#define PF_INET6  AF_INET6
    6161
    6262/*@}*/
  • uspace/lib/c/include/str.h

    rb8e72fd1 r98abd40  
    109109extern char *str_ndup(const char *, size_t max_size);
    110110
    111 extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *);
    112 extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *);
    113 extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *);
    114 extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *);
    115 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
     111extern int str_uint8_t(const char *, const char **, unsigned int, bool,
     112    uint8_t *);
     113extern int str_uint16_t(const char *, const char **, unsigned int, bool,
     114    uint16_t *);
     115extern int str_uint32_t(const char *, const char **, unsigned int, bool,
     116    uint32_t *);
     117extern int str_uint64_t(const char *, const char **, unsigned int, bool,
     118    uint64_t *);
     119extern int str_size_t(const char *, const char **, unsigned int, bool,
     120    size_t *);
    116121
    117122extern void order_suffix(const uint64_t, uint64_t *, char *);
Note: See TracChangeset for help on using the changeset viewer.