Changeset 4c14b88 in mainline for uspace/lib/c/include
- Timestamp:
- 2013-12-31T07:57:14Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b973dc
- Parents:
- 6297465 (diff), 208b5f5 (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. - Location:
- uspace/lib/c/include
- Files:
-
- 3 added
- 1 deleted
- 12 edited
- 2 moved
-
adt/checksum.h (moved) (moved from uspace/lib/c/include/net/device.h ) (2 diffs)
-
adt/list.h (modified) (4 diffs)
-
bitops.h (modified) (1 diff)
-
inet/addr.h (modified) (6 diffs)
-
inet/dhcp.h (added)
-
inet/dnsr.h (modified) (1 diff)
-
inet/inetcfg.h (modified) (1 diff)
-
inet/inetping.h (modified) (3 diffs)
-
inet/iplink.h (modified) (2 diffs)
-
inet/iplink_srv.h (modified) (2 diffs)
-
ipc/dhcp.h (added)
-
ipc/inet.h (modified) (2 diffs)
-
ipc/services.h (modified) (2 diffs)
-
math.h (added)
-
net/ip_codes.h (deleted)
-
setjmp.h (modified) (3 diffs)
-
stdio.h (modified) (1 diff)
-
types/inetping.h (moved) (moved from uspace/lib/c/include/inet/inetping6.h ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/checksum.h
r6297465 r4c14b88 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Dominik Taborsky 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Network device.35 33 */ 36 34 37 #ifndef LIBC_ NET_DEVICE_H_38 #define LIBC_ NET_DEVICE_H_35 #ifndef LIBC_CHECKSUM_H_ 36 #define LIBC_CHECKSUM_H_ 39 37 40 #include <adt/int_map.h> 41 #include <nic/nic.h> 38 #include <sys/types.h> 42 39 43 /** Device identifier to generic type map declaration. */ 44 #define DEVICE_MAP_DECLARE INT_MAP_DECLARE 45 46 /** Device identifier to generic type map implementation. */ 47 #define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT 48 49 /** Device identifier type. */ 50 typedef int nic_device_id_t; 51 52 /** Invalid device identifier. */ 53 #define NIC_DEVICE_INVALID_ID (-1) 40 extern uint32_t compute_crc32(uint8_t *, size_t); 41 extern uint32_t compute_crc32_seed(uint8_t *, size_t, uint32_t); 54 42 55 43 #endif -
uspace/lib/c/include/adt/list.h
r6297465 r4c14b88 38 38 39 39 #include <assert.h> 40 #include <stdbool.h> 40 41 #include <unistd.h> 41 42 … … 72 73 iterator = list_get_instance(_link, itype, member), \ 73 74 _link != &(list).head; _link = _link->next) 75 76 #define list_foreach_rev(list, member, itype, iterator) \ 77 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \ 78 for (link_t *_link = (list).head.prev; \ 79 iterator = list_get_instance(_link, itype, member), \ 80 _link != &(list).head; _link = _link->prev) 74 81 75 82 /** Unlike list_foreach(), allows removing items while traversing a list. … … 105 112 106 113 #define assert_link_not_used(link) \ 107 assert( ((link)->prev == NULL) && ((link)->next == NULL))114 assert(!link_used(link)) 108 115 109 116 /** Returns true if the link is definitely part of a list. False if not sure. */ … … 357 364 } 358 365 366 /** Determine if link is used. 367 * 368 * @param link Link 369 * @return @c true if link is used, @c false if not. 370 */ 371 static inline bool link_used(link_t *link) 372 { 373 if (link->prev == NULL && link->next == NULL) 374 return false; 375 376 assert(link->prev != NULL && link->next != NULL); 377 return true; 378 } 379 359 380 extern int list_member(const link_t *, const list_t *); 360 381 extern void list_concat(list_t *, list_t *); -
uspace/lib/c/include/bitops.h
r6297465 r4c14b88 107 107 } 108 108 109 extern int __popcountsi2(int);110 111 109 #endif 112 110 -
uspace/lib/c/include/inet/addr.h
r6297465 r4c14b88 39 39 #include <net/in.h> 40 40 #include <net/in6.h> 41 #include <net/socket.h> 41 42 42 43 typedef uint32_t addr32_t; … … 44 45 typedef uint8_t addr128_t[16]; 45 46 47 typedef enum { 48 /** Any IP protocol version */ 49 ip_any, 50 /** IPv4 */ 51 ip_v4, 52 /** IPv6 */ 53 ip_v6 54 } ip_ver_t; 55 46 56 /** Node address */ 47 57 typedef struct { 48 uint16_t family; 58 /** IP version */ 59 ip_ver_t version; 49 60 union { 50 61 addr32_t addr; … … 55 66 /** Network address */ 56 67 typedef struct { 57 /** Address family*/58 uint16_t family;68 /** IP version */ 69 ip_ver_t version; 59 70 60 71 /** Address */ … … 91 102 uint16_t, uint16_t, uint16_t, uint16_t, uint8_t); 92 103 93 extern int inet_addr_family(const char *, uint16_t *);94 104 extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *); 95 105 extern void inet_addr_naddr(const inet_addr_t *, uint8_t, inet_naddr_t *); … … 110 120 extern int inet_naddr_format(const inet_naddr_t *, char **); 111 121 112 extern uint16_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *);113 extern uint16_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *,122 extern ip_ver_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *); 123 extern ip_ver_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *, 114 124 uint8_t *); 115 125 … … 125 135 sockaddr_in6_t *); 126 136 137 extern ip_ver_t ipver_from_af(int af); 138 extern int inet_addr_sockaddr(const inet_addr_t *, uint16_t, sockaddr_t **, 139 socklen_t *); 140 127 141 #endif 128 142 -
uspace/lib/c/include/inet/dnsr.h
r6297465 r4c14b88 51 51 52 52 extern int dnsr_init(void); 53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, uint16_t);53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, ip_ver_t); 54 54 extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *); 55 55 extern int dnsr_get_srvaddr(inet_addr_t *); -
uspace/lib/c/include/inet/inetcfg.h
r6297465 r4c14b88 48 48 extern int inetcfg_get_link_list(sysarg_t **, size_t *); 49 49 extern int inetcfg_get_sroute_list(sysarg_t **, size_t *); 50 extern int inetcfg_link_add(sysarg_t); 50 51 extern int inetcfg_link_get(sysarg_t, inet_link_info_t *); 52 extern int inetcfg_link_remove(sysarg_t); 51 53 extern int inetcfg_sroute_get(sysarg_t, inet_sroute_info_t *); 52 54 extern int inetcfg_sroute_get_id(const char *, sysarg_t *); -
uspace/lib/c/include/inet/inetping.h
r6297465 r4c14b88 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #include <inet/inet.h> 39 39 #include <sys/types.h> 40 41 typedef struct { 42 uint32_t src; 43 uint32_t dest; 44 uint16_t seq_no; 45 void *data; 46 size_t size; 47 } inetping_sdu_t; 40 #include <types/inetping.h> 48 41 49 42 typedef struct inetping_ev_ops { … … 53 46 extern int inetping_init(inetping_ev_ops_t *); 54 47 extern int inetping_send(inetping_sdu_t *); 55 extern int inetping_get_srcaddr( uint32_t, uint32_t *);48 extern int inetping_get_srcaddr(const inet_addr_t *, inet_addr_t *); 56 49 57 50 #endif -
uspace/lib/c/include/inet/iplink.h
r6297465 r4c14b88 37 37 38 38 #include <async.h> 39 #include <sys/types.h>40 39 #include <inet/addr.h> 41 40 … … 78 77 79 78 typedef struct iplink_ev_ops { 80 int (*recv)(iplink_t *, iplink_recv_sdu_t *, uint16_t);79 int (*recv)(iplink_t *, iplink_recv_sdu_t *, ip_ver_t); 81 80 } iplink_ev_ops_t; 82 81 -
uspace/lib/c/include/inet/iplink_srv.h
r6297465 r4c14b88 39 39 #include <fibril_synch.h> 40 40 #include <stdbool.h> 41 #include <sys/types.h>42 41 #include <inet/addr.h> 43 42 #include <inet/iplink.h> … … 67 66 68 67 extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *); 69 extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, uint16_t);68 extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, ip_ver_t); 70 69 71 70 #endif -
uspace/lib/c/include/ipc/inet.h
r6297465 r4c14b88 72 72 INETCFG_GET_LINK_LIST, 73 73 INETCFG_GET_SROUTE_LIST, 74 INETCFG_LINK_ADD, 74 75 INETCFG_LINK_GET, 76 INETCFG_LINK_REMOVE, 75 77 INETCFG_SROUTE_CREATE, 76 78 INETCFG_SROUTE_DELETE, … … 90 92 } inetping_request_t; 91 93 92 /** Events on Inet ping6 port */93 typedef enum {94 INETPING6_EV_RECV = IPC_FIRST_USER_METHOD95 } inetping6_event_t;96 97 /** Requests on Inet ping6 port */98 typedef enum {99 INETPING6_SEND = IPC_FIRST_USER_METHOD,100 INETPING6_GET_SRCADDR101 } inetping6_request_t;102 103 94 #endif 104 95 -
uspace/lib/c/include/ipc/services.h
r6297465 r4c14b88 54 54 55 55 #define SERVICE_NAME_CORECFG "corecfg" 56 #define SERVICE_NAME_DHCP "net/dhcp" 56 57 #define SERVICE_NAME_DNSR "net/dnsr" 57 58 #define SERVICE_NAME_INET "net/inet" … … 59 60 #define SERVICE_NAME_INETPING "net/inetping" 60 61 #define SERVICE_NAME_INETPING6 "net/inetping6" 62 #define SERVICE_NAME_NETCONF "net/netconf" 61 63 62 64 #endif -
uspace/lib/c/include/setjmp.h
r6297465 r4c14b88 1 1 /* 2 2 * Copyright (c) 2008 Josef Cejka 3 * Copyright (c) 2013 Vojtech Horky 3 4 * All rights reserved. 4 5 * … … 30 31 * @{ 31 32 */ 32 /** @file 33 /** @file Long jump implementation. 34 * 35 * Implementation inspired by Jiri Zarevucky's code from 36 * http://bazaar.launchpad.net/~zarevucky-jiri/helenos/stdc/revision/1544/uspace/lib/posix/setjmp.h 33 37 */ 34 38 … … 38 42 #include <libarch/fibril.h> 39 43 40 typedef context_t jmp_buf[1]; 44 struct jmp_buf_interal { 45 context_t context; 46 int return_value; 47 }; 48 typedef struct jmp_buf_interal jmp_buf[1]; 41 49 42 extern int setjmp(jmp_buf env); 50 /* 51 * Specified as extern to minimize number of included headers 52 * because this file is used as is in libposix too. 53 */ 54 extern int context_save(context_t *ctx) __attribute__((returns_twice)); 55 56 /** 57 * Save current environment (registers). 58 * 59 * This function may return twice. 60 * 61 * @param env Variable where to save the environment (of type jmp_buf). 62 * @return Whether the call returned after longjmp. 63 * @retval 0 Environment was saved, normal execution. 64 * @retval other longjmp was executed and returned here. 65 */ 66 #define setjmp(env) \ 67 ((env)[0].return_value = 0, \ 68 context_save(&(env)[0].context), \ 69 (env)[0].return_value) 70 43 71 extern void longjmp(jmp_buf env, int val) __attribute__((noreturn)); 44 72 -
uspace/lib/c/include/stdio.h
r6297465 r4c14b88 151 151 /* Misc file functions */ 152 152 extern int rename(const char *, const char *); 153 extern int remove(const char *); 153 154 154 155 #endif -
uspace/lib/c/include/types/inetping.h
r6297465 r4c14b88 1 1 /* 2 * Copyright (c) 2013 Martin Decky2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 /** @file 32 /** 33 * @file 34 * @brief 33 35 */ 34 36 35 #ifndef LIBC_ INET_INETPING6_H_36 #define LIBC_ INET_INETPING6_H_37 #ifndef LIBC_TYPES_INETPING_H_ 38 #define LIBC_TYPES_INETPING_H_ 37 39 38 #include <inet/ inet.h>40 #include <inet/addr.h> 39 41 #include <sys/types.h> 40 42 41 43 typedef struct { 42 addr128_t src;43 addr128_t dest;44 inet_addr_t src; 45 inet_addr_t dest; 44 46 uint16_t seq_no; 45 47 void *data; 46 48 size_t size; 47 } inetping6_sdu_t; 48 49 typedef struct inetping6_ev_ops { 50 int (*recv)(inetping6_sdu_t *); 51 } inetping6_ev_ops_t; 52 53 extern int inetping6_init(inetping6_ev_ops_t *); 54 extern int inetping6_send(inetping6_sdu_t *); 55 extern int inetping6_get_srcaddr(addr128_t, addr128_t); 49 } inetping_sdu_t; 56 50 57 51 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
