Ignore:
Timestamp:
2015-06-17T23:45:24Z (9 years ago)
Author:
Michal Koutný <xm.koutny+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
523b17a
Parents:
fc7bf19 (diff), 2654afb (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.
Message:

Sync with mainline

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/nettl/include/nettl/portrng.h

    rfc7bf19 rcf3aee19  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup nettest
     29/** @addtogroup libnettl
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * Networking test support functions.
     32/**
     33 * @file Port range allocator.
    3534 */
    3635
    37 #ifndef NET_TEST_
    38 #define NET_TEST_
     36#ifndef LIBNETTL_PORTRNG_H_
     37#define LIBNETTL_PORTRNG_H_
    3938
    40 #include <net/socket.h>
     39#include <stdbool.h>
     40#include <stdint.h>
    4141
    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 */
     43typedef 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
     52typedef struct {
     53        list_t used; /* of portrng_port_t */
     54} portrng_t;
     55
     56typedef enum {
     57        pf_allow_system = 0x1
     58} portrng_flags_t;
     59
     60extern int portrng_create(portrng_t **);
     61extern void portrng_destroy(portrng_t *);
     62extern int portrng_alloc(portrng_t *, uint16_t, void *,
     63    portrng_flags_t, uint16_t *);
     64extern int portrng_find_port(portrng_t *, uint16_t, void **);
     65extern void portrng_free_port(portrng_t *, uint16_t);
     66extern bool portrng_empty(portrng_t *);
    5367
    5468#endif
     
    5670/** @}
    5771 */
    58 
Note: See TracChangeset for help on using the changeset viewer.