Changeset fb4d788 in mainline for uspace/lib/nettl/include/nettl/portrng.h
- Timestamp:
- 2015-07-28T11:28:14Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6accc5cf
- Parents:
- df2bce3 (diff), 47726b5e (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nettl/include/nettl/portrng.h
rdf2bce3 rfb4d788 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup nettest29 /** @addtogroup libnettl 30 30 * @{ 31 31 */ 32 33 /** @file 34 * Networking test support functions. 32 /** 33 * @file Port range allocator. 35 34 */ 36 35 37 #ifndef NET_TEST_38 #define NET_TEST_36 #ifndef LIBNETTL_PORTRNG_H_ 37 #define LIBNETTL_PORTRNG_H_ 39 38 40 #include <net/socket.h> 39 #include <stdbool.h> 40 #include <stdint.h> 41 41 42 extern void print_mark(unsigned int); 43 extern int sockets_create(int, int *, unsigned int, uint16_t, sock_type_t); 44 extern int sockets_close(int, int *, unsigned int); 45 extern int sockets_connect(int, int *, unsigned int, struct sockaddr *, 46 socklen_t); 47 extern int sockets_sendto(int, int *, unsigned int, struct sockaddr *, 48 socklen_t, char *, size_t, unsigned int, sock_type_t); 49 extern int sockets_recvfrom(int, int *, unsigned int, struct sockaddr *, 50 socklen_t *, char *, size_t, unsigned int); 51 extern int sockets_sendto_recvfrom(int, int *, unsigned int, struct sockaddr *, 52 socklen_t *, char *, size_t, unsigned int, sock_type_t); 42 /** Allocated port */ 43 typedef struct { 44 /** Link to portrng_t.used */ 45 link_t lprng; 46 /** Port number */ 47 uint16_t pn; 48 /** User argument */ 49 void *arg; 50 } portrng_port_t; 51 52 typedef struct { 53 list_t used; /* of portrng_port_t */ 54 } portrng_t; 55 56 typedef enum { 57 pf_allow_system = 0x1 58 } portrng_flags_t; 59 60 extern int portrng_create(portrng_t **); 61 extern void portrng_destroy(portrng_t *); 62 extern int portrng_alloc(portrng_t *, uint16_t, void *, 63 portrng_flags_t, uint16_t *); 64 extern int portrng_find_port(portrng_t *, uint16_t, void **); 65 extern void portrng_free_port(portrng_t *, uint16_t); 66 extern bool portrng_empty(portrng_t *); 53 67 54 68 #endif … … 56 70 /** @} 57 71 */ 58
Note:
See TracChangeset
for help on using the changeset viewer.