Changeset 048cd69 in mainline for uspace/lib/c/include/inet


Ignore:
Timestamp:
2015-06-07T15:41:04Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
204ba47
Parents:
4d11204 (diff), c3f7d37 (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:

Merge network transport layer API rewrite.

Location:
uspace/lib/c/include/inet
Files:
2 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/inet/addr.h

    r4d11204 r048cd69  
    3737
    3838#include <stdint.h>
    39 #include <net/in.h>
    40 #include <net/in6.h>
    41 #include <net/socket.h>
    4239
    4340typedef uint32_t addr32_t;
     
    126123extern void inet_addr_set(addr32_t, inet_addr_t *);
    127124extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *);
    128 extern void inet_sockaddr_in_addr(const sockaddr_in_t *, inet_addr_t *);
    129125
    130126extern void inet_addr_set6(addr128_t, inet_addr_t *);
    131127extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *);
    132 extern void inet_sockaddr_in6_addr(const sockaddr_in6_t *, inet_addr_t *);
    133 
    134 extern uint16_t inet_addr_sockaddr_in(const inet_addr_t *, sockaddr_in_t *,
    135     sockaddr_in6_t *);
    136 
    137 extern ip_ver_t ipver_from_af(int af);
    138 extern int inet_addr_sockaddr(const inet_addr_t *, uint16_t, sockaddr_t **,
    139     socklen_t *);
    140128
    141129#endif
  • uspace/lib/c/include/inet/endpoint.h

    r4d11204 r048cd69  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  *  Character string to integer map.
     35#ifndef LIBC_INET_ASSOC_H_
     36#define LIBC_INET_ASSOC_H_
     37
     38#include <stdint.h>
     39#include <inet/addr.h>
     40#include <loc.h>
     41
     42/** Internet port number ranges
     43 *
     44 * Port number ranges per RFC 6335 section 6 (Port Number Ranges.
     45 * Technically port zero is a system port. But since it is reserved,
     46 * we will use it as a special value denoting no port is specified
     47 * and we will exclude it from the system port range to disallow
     48 * ever assigning it.
    3549 */
    36 
    37 #ifndef LIBC_CHAR_MAP_H_
    38 #define LIBC_CHAR_MAP_H_
    39 
    40 #include <libarch/types.h>
    41 
    42 /** Invalid assigned value used also if an&nbsp;entry does not exist. */
    43 #define CHAR_MAP_NULL  (-1)
    44 
    45 /** Type definition of the character string to integer map.
    46  *  @see char_map
    47  */
    48 typedef struct char_map char_map_t;
    49 
    50 /** Character string to integer map item.
    51  *
    52  * This structure recursivelly contains itself as a character by character tree.
    53  * The actually mapped character string consists of all the parent characters
    54  * and the actual one.
    55  */
    56 struct char_map {
    57         /** Actually mapped character. */
    58         uint8_t c;
    59         /** Stored integral value. */
    60         int value;
    61         /** Next character array size. */
    62         int size;
    63         /** First free position in the next character array. */
    64         int next;
    65         /** Next character array. */
    66         char_map_t **items;
    67         /** Consistency check magic value. */
    68         int magic;
     50enum inet_port_ranges {
     51        /** Special value meaning no specific port */
     52        inet_port_any = 0,
     53        /** Lowest system port (a.k.a. well known port) */
     54        inet_port_sys_lo = 1,
     55        /** Highest system port (a.k.a. well known port) */
     56        inet_port_sys_hi = 1023,
     57        /** Lowest user port (a.k.a. registered port) */
     58        inet_port_user_lo = 1024,
     59        /** Highest user port (a.k.a. registered port) */
     60        inet_port_user_hi = 49151,
     61        /** Lowest dynamic port (a.k.a. private or ephemeral port) */
     62        inet_port_dyn_lo = 49152,
     63        /** Highest dynamic port (a.k.a. private or ephemeral port) */
     64        inet_port_dyn_hi = 65535
    6965};
    7066
    71 extern int char_map_initialize(char_map_t *);
    72 extern void char_map_destroy(char_map_t *);
    73 extern int char_map_exclude(char_map_t *, const uint8_t *, size_t);
    74 extern int char_map_add(char_map_t *, const uint8_t *, size_t, const int);
    75 extern int char_map_find(const char_map_t *, const uint8_t *, size_t);
    76 extern int char_map_update(char_map_t *, const uint8_t *, size_t, const int);
     67/** Internet endpoint (address-port pair), a.k.a. socket */
     68typedef struct {
     69        inet_addr_t addr;
     70        uint16_t port;
     71} inet_ep_t;
     72
     73/** Internet endpoint pair */
     74typedef struct {
     75        service_id_t local_link;
     76        inet_ep_t local;
     77        inet_ep_t remote;
     78} inet_ep2_t;
     79
     80extern void inet_ep_init(inet_ep_t *);
     81extern void inet_ep2_init(inet_ep2_t *);
    7782
    7883#endif
  • uspace/lib/c/include/inet/iplink.h

    r4d11204 r048cd69  
    4444        async_sess_t *sess;
    4545        struct iplink_ev_ops *ev_ops;
     46        void *arg;
    4647} iplink_t;
    4748
     
    8182} iplink_ev_ops_t;
    8283
    83 extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **);
     84extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, void *, iplink_t **);
    8485extern void iplink_close(iplink_t *);
    8586extern int iplink_send(iplink_t *, iplink_sdu_t *);
     
    9091extern int iplink_get_mac48(iplink_t *, addr48_t *);
    9192extern int iplink_set_mac48(iplink_t *, addr48_t);
     93extern void *iplink_get_userptr(iplink_t *);
    9294
    9395#endif
Note: See TracChangeset for help on using the changeset viewer.