Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 58e9dec in mainline


Ignore:
Timestamp:
2015-05-22T07:31:57Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
2989c7e
Parents:
2f19103
Message:

Definitions for RFC 6335 port number ranges.

Location:
uspace
Files:
6 edited

Legend:

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

    r2f19103 r58e9dec  
    4040#include <loc.h>
    4141
     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.
     49 */
     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
     65};
     66
    4267/** Internet endpoint (address-port pair), a.k.a. socket */
    4368typedef struct {
  • uspace/srv/net/tcp/conn.c

    r2f19103 r58e9dec  
    344344                return false;
    345345
    346         if ((patt->port != TCP_PORT_ANY) &&
     346        if ((patt->port != inet_port_any) &&
    347347            (patt->port != ep->port))
    348348                return false;
  • uspace/srv/net/tcp/tcp_type.h

    r2f19103 r58e9dec  
    113113} tcp_control_t;
    114114
    115 enum tcp_port {
    116         TCP_PORT_ANY = 0
    117 };
    118 
    119115/** Connection incoming segments queue */
    120116typedef struct {
  • uspace/srv/net/tcp/ucall.c

    r2f19103 r58e9dec  
    342342                conn->ident.remote.addr = epp->remote.addr;
    343343
    344         if (conn->ident.remote.port == TCP_PORT_ANY)
     344        if (conn->ident.remote.port == inet_port_any)
    345345                conn->ident.remote.port = epp->remote.port;
    346346
  • uspace/srv/net/udp/assoc.c

    r2f19103 r58e9dec  
    3939#include <stdbool.h>
    4040#include <fibril_synch.h>
     41#include <inet/endpoint.h>
    4142#include <io/log.h>
    4243#include <stdlib.h>
     
    270271
    271272        if ((inet_addr_is_any(&epp.remote.addr)) ||
    272             (epp.remote.port == UDP_PORT_ANY))
     273            (epp.remote.port == inet_port_any))
    273274                return EINVAL;
    274275
     
    422423        log_msg(LOG_DEFAULT, LVL_NOTE, "addr OK");
    423424
    424         if ((patt->port != UDP_PORT_ANY) &&
     425        if ((patt->port != inet_port_any) &&
    425426            (patt->port != ep->port))
    426427                return false;
     
    476477                    aepp, la, ra);
    477478                /* Skip unbound associations */
    478                 if (aepp->local.port == UDP_PORT_ANY) {
     479                if (aepp->local.port == inet_port_any) {
    479480                        log_msg(LOG_DEFAULT, LVL_NOTE, "skip unbound");
    480481                        continue;
  • uspace/srv/net/udp/udp_type.h

    r2f19103 r58e9dec  
    6161        XF_DUMMY = 0x1
    6262} xflags_t;
    63 
    64 enum udp_port {
    65         UDP_PORT_ANY = 0
    66 };
    6763
    6864/** Unencoded UDP message (datagram) */
Note: See TracChangeset for help on using the changeset viewer.