Changes in uspace/lib/nettl/src/portrng.c [8a637a4:c3f7d37] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nettl/src/portrng.c
r8a637a4 rc3f7d37 46 46 #include <io/log.h> 47 47 48 /** Create port range.49 *50 * @param rpr Place to store pointer to new port range51 * @return EOK on success, ENOMEM if out of memory52 */53 48 int portrng_create(portrng_t **rpr) 54 49 { … … 67 62 } 68 63 69 /** Destroy port range.70 *71 * @param pr Port range72 */73 64 void portrng_destroy(portrng_t *pr) 74 65 { … … 78 69 } 79 70 80 /** Allocate port number from port range.81 *82 * @param pr Port range83 * @param pnum Port number to allocate specific port, or zero to allocate84 * any valid port from range85 * @param arg User argument to set for port86 * @param flags Flags, @c pf_allow_system to allow ports from system range87 * to be specified by @a pnum.88 * @param apnum Place to store allocated port number89 *90 * @return EOK on success, ENOENT if no free port number found, EEXIST91 * if @a pnum is specified but it is already allocated,92 * EINVAL if @a pnum is specified from the system range, but93 * @c pf_allow_system was not set.94 */95 71 int portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg, 96 72 portrng_flags_t flags, uint16_t *apnum) … … 137 113 if (port->pn == pnum) { 138 114 log_msg(LOG_DEFAULT, LVL_DEBUG2, "port already used"); 139 return EEXIST ;115 return EEXISTS; 140 116 } 141 117 } … … 155 131 } 156 132 157 /** Find allocated port number and return its argument.158 *159 * @param pr Port range160 * @param pnum Port number161 * @param rarg Place to store user argument162 *163 * @return EOK on success, ENOENT if specified port number is not allocated164 */165 133 int portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg) 166 134 { … … 175 143 } 176 144 177 /** Free port in port range.178 *179 * @param pr Port range180 * @param pnum Port number181 */182 145 void portrng_free_port(portrng_t *pr, uint16_t pnum) 183 146 { … … 195 158 } 196 159 197 /** Determine if port range is empty.198 *199 * @param pr Port range200 * @return @c true if no ports are allocated from @a pr, @c false otherwise201 */202 160 bool portrng_empty(portrng_t *pr) 203 161 {
Note:
See TracChangeset
for help on using the changeset viewer.