Changeset 19a4f73 in mainline for uspace/lib/c
- Timestamp:
- 2013-06-20T15:21:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2e3ee6
- Parents:
- 3e66428
- Location:
- uspace/lib/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
r3e66428 r19a4f73 144 144 } 145 145 146 int inet2_get_srcaddr(inet2_addr_t *remote, uint8_t tos, inet2_addr_t *local) 147 { 148 uint32_t remote_addr; 149 int rc = inet2_addr_pack(remote, &remote_addr); 150 if (rc != EOK) 151 return rc; 152 153 async_exch_t *exch = async_exchange_begin(inet_sess); 154 155 sysarg_t local_addr; 156 rc = async_req_2_1(exch, INET_GET_SRCADDR, (sysarg_t) remote_addr, 157 tos, &local_addr); 158 159 async_exchange_end(exch); 160 161 if (rc != EOK) 162 return rc; 163 164 inet2_addr_unpack(local_addr, local); 165 return EOK; 166 } 167 146 168 static void inet_ev_recv(ipc_callid_t callid, ipc_call_t *call) 147 169 { -
uspace/lib/c/generic/inet/addr2.c
r3e66428 r19a4f73 40 40 #include <stdio.h> 41 41 42 // TODO temporarily 43 #include <assert.h> 44 45 static inet2_addr_t inet2_addr_any = { 46 .family = AF_INET, 47 .addr = {0, 0, 0, 0} 48 }; 49 50 static inet2_addr_t inet2_addr6_any = { 51 .family = AF_INET6, 52 .addr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 53 }; 54 42 55 /** Parse network address family. 43 56 * … … 336 349 } 337 350 338 int inet2_addr_is_empty(inet2_addr_t *addr) 339 { 340 return (addr->family == 0); 351 int inet2_addr_is_any(inet2_addr_t *addr) 352 { 353 return ((addr->family == 0) || 354 (inet2_addr_compare(addr, &inet2_addr_any)) || 355 (inet2_addr_compare(addr, &inet2_addr6_any))); 356 } 357 358 void inet_inet2(inet_addr_t *addr, inet2_addr_t *addr2) 359 { 360 // TODO temporarily 361 inet2_addr_unpack(addr->ipv4, addr2); 362 } 363 364 void inet2_inet(inet2_addr_t *addr2, inet_addr_t *addr) 365 { 366 // TODO temporarily 367 assert(addr2->family == AF_INET); 368 inet2_addr_pack(addr2, &addr->ipv4); 341 369 } 342 370 -
uspace/lib/c/include/inet/addr2.h
r3e66428 r19a4f73 38 38 #include <stdint.h> 39 39 #include <net/in.h> 40 #include <inet/addr.h> 40 41 41 42 #define INET2_ADDR_SIZE 16 … … 84 85 85 86 extern int inet2_addr_compare(inet2_addr_t *, inet2_addr_t *); 86 extern int inet2_addr_is_empty(inet2_addr_t *); 87 extern int inet2_addr_is_any(inet2_addr_t *); 88 89 extern void inet_inet2(inet_addr_t *, inet2_addr_t *); 90 extern void inet2_inet(inet2_addr_t *, inet_addr_t *); 87 91 88 92 #endif -
uspace/lib/c/include/inet/inet.h
r3e66428 r19a4f73 37 37 38 38 #include <inet/addr.h> 39 #include <inet/addr2.h> 39 40 #include <sys/types.h> 40 41 … … 60 61 extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t); 61 62 extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *); 63 extern int inet2_get_srcaddr(inet2_addr_t *, uint8_t, inet2_addr_t *); 62 64 63 65 #endif -
uspace/lib/c/include/net/in.h
r3e66428 r19a4f73 47 47 #define INADDR_ANY 0 48 48 49 /** Type definition of the INET address.50 * @see in_addr51 */52 typedef struct in_addr in_addr_t;53 54 /** Type definition of the INET socket address.55 * @see sockaddr_in56 */57 typedef struct sockaddr_in sockaddr_in_t;58 59 49 /** INET address. */ 60 struct in_addr {50 typedef struct in_addr { 61 51 /** 4 byte IP address. */ 62 52 uint32_t s_addr; 63 } ;53 } in_addr_t; 64 54 65 55 /** INET socket address. 66 56 * @see sockaddr 67 57 */ 68 struct sockaddr_in {58 typedef struct sockaddr_in { 69 59 /** Address family. Should be AF_INET. */ 70 60 uint16_t sin_family; … … 72 62 uint16_t sin_port; 73 63 /** Internet address. */ 74 struct in_addrsin_addr;64 in_addr_t sin_addr; 75 65 /** Padding to meet the sockaddr size. */ 76 66 uint8_t sin_zero[8]; 77 } ;67 } sockaddr_in_t; 78 68 79 69 #endif -
uspace/lib/c/include/net/ip_protocols.h
r3e66428 r19a4f73 44 44 /*@{*/ 45 45 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 49 50 50 51 /*@}*/
Note:
See TracChangeset
for help on using the changeset viewer.