Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nettl/src/portrng.c

    r8a637a4 rc3f7d37  
    4646#include <io/log.h>
    4747
    48 /** Create port range.
    49  *
    50  * @param rpr Place to store pointer to new port range
    51  * @return EOK on success, ENOMEM if out of memory
    52  */
    5348int portrng_create(portrng_t **rpr)
    5449{
     
    6762}
    6863
    69 /** Destroy port range.
    70  *
    71  * @param pr Port range
    72  */
    7364void portrng_destroy(portrng_t *pr)
    7465{
     
    7869}
    7970
    80 /** Allocate port number from port range.
    81  *
    82  * @param pr    Port range
    83  * @param pnum  Port number to allocate specific port, or zero to allocate
    84  *              any valid port from range
    85  * @param arg   User argument to set for port
    86  * @param flags Flags, @c pf_allow_system to allow ports from system range
    87  *              to be specified by @a pnum.
    88  * @param apnum Place to store allocated port number
    89  *
    90  * @return EOK on success, ENOENT if no free port number found, EEXIST
    91  *         if @a pnum is specified but it is already allocated,
    92  *         EINVAL if @a pnum is specified from the system range, but
    93  *         @c pf_allow_system was not set.
    94  */
    9571int portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg,
    9672    portrng_flags_t flags, uint16_t *apnum)
     
    137113                        if (port->pn == pnum) {
    138114                                log_msg(LOG_DEFAULT, LVL_DEBUG2, "port already used");
    139                                 return EEXIST;
     115                                return EEXISTS;
    140116                        }
    141117                }
     
    155131}
    156132
    157 /** Find allocated port number and return its argument.
    158  *
    159  * @param pr   Port range
    160  * @param pnum Port number
    161  * @param rarg Place to store user argument
    162  *
    163  * @return EOK on success, ENOENT if specified port number is not allocated
    164  */
    165133int portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg)
    166134{
     
    175143}
    176144
    177 /** Free port in port range.
    178  *
    179  * @param pr   Port range
    180  * @param pnum Port number
    181  */
    182145void portrng_free_port(portrng_t *pr, uint16_t pnum)
    183146{
     
    195158}
    196159
    197 /** Determine if port range is empty.
    198  *
    199  * @param pr Port range
    200  * @return @c true if no ports are allocated from @a pr, @c false otherwise
    201  */
    202160bool portrng_empty(portrng_t *pr)
    203161{
Note: See TracChangeset for help on using the changeset viewer.