portset.c File Reference

#include <config.h>
#include <isc/mem.h>
#include <isc/portset.h>
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>

Go to the source code of this file.

Data Structures

struct  isc_portset
 Internal representation of portset. It's an array of 32-bit integers, each bit corresponding to a single port in the ascending order. For example, the second most significant bit of buf[0] corresponds to port 1. More...

Defines

#define ISC_PORTSET_BUFSIZE   (65536 / (sizeof(isc_uint32_t) * 8))

Functions

static isc_boolean_t portset_isset (isc_portset_t *portset, in_port_t port)
static void portset_add (isc_portset_t *portset, in_port_t port)
static void portset_remove (isc_portset_t *portset, in_port_t port)
isc_result_t isc_portset_create (isc_mem_t *mctx, isc_portset_t **portsetp)
 Create a port set and initialize it as an empty set.
void isc_portset_destroy (isc_mem_t *mctx, isc_portset_t **portsetp)
 Destroy a port set.
isc_boolean_t isc_portset_isset (isc_portset_t *portset, in_port_t port)
 Test whether the given port is stored in the portset.
unsigned int isc_portset_nports (isc_portset_t *portset)
 Provides the number of ports stored in the given portset.
void isc_portset_add (isc_portset_t *portset, in_port_t port)
 Add the given port to the portset. The port may or may not be stored in the portset.
void isc_portset_remove (isc_portset_t *portset, in_port_t port)
 Remove the given port to the portset. The port may or may not be stored in the portset.
void isc_portset_addrange (isc_portset_t *portset, in_port_t port_lo, in_port_t port_hi)
 Add a subset of [port_lo, port_hi] (inclusive) to the portset. Ports in the subset may or may not be stored in portset.
void isc_portset_removerange (isc_portset_t *portset, in_port_t port_lo, in_port_t port_hi)
 Subtract a subset of [port_lo, port_hi] (inclusive) from the portset. Ports in the subset may or may not be stored in portset.


Detailed Description

Definition in file portset.c.


Define Documentation

#define ISC_PORTSET_BUFSIZE   (65536 / (sizeof(isc_uint32_t) * 8))

Definition at line 29 of file portset.c.


Function Documentation

static isc_boolean_t portset_isset ( isc_portset_t portset,
in_port_t  port 
) [inline, static]

Definition at line 42 of file portset.c.

References isc_portset::buf, and ISC_TF.

Referenced by isc_portset_isset(), portset_add(), and portset_remove().

static void portset_add ( isc_portset_t portset,
in_port_t  port 
) [inline, static]

Definition at line 47 of file portset.c.

References isc_portset::buf, isc_portset::nports, and portset_isset().

Referenced by isc_portset_add(), and isc_portset_addrange().

static void portset_remove ( isc_portset_t portset,
in_port_t  port 
) [inline, static]

Definition at line 55 of file portset.c.

References isc_portset::buf, isc_portset::nports, and portset_isset().

Referenced by isc_portset_remove(), and isc_portset_removerange().

isc_result_t isc_portset_create ( isc_mem_t mctx,
isc_portset_t **  portsetp 
)

Create a port set and initialize it as an empty set.

Requires:

Returns:

Definition at line 63 of file portset.c.

References isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, and REQUIRE.

Referenced by create_default_portset(), and load_configuration().

void isc_portset_destroy ( isc_mem_t mctx,
isc_portset_t **  portsetp 
)

Destroy a port set.

Requires:

Definition at line 80 of file portset.c.

References isc_mem_put, and REQUIRE.

Referenced by dns_dispatchmgr_create(), and load_configuration().

isc_boolean_t isc_portset_isset ( isc_portset_t portset,
in_port_t  port 
)

Test whether the given port is stored in the portset.

Requires:

Returns

Definition at line 90 of file portset.c.

References portset_isset(), and REQUIRE.

Referenced by dns_dispatchmgr_setavailports().

unsigned int isc_portset_nports ( isc_portset_t portset  ) 

Provides the number of ports stored in the given portset.

Requires:

Returns

Definition at line 97 of file portset.c.

References isc_portset::nports, and REQUIRE.

Referenced by dns_dispatchmgr_setavailports().

void isc_portset_add ( isc_portset_t portset,
in_port_t  port 
)

Add the given port to the portset. The port may or may not be stored in the portset.

Requires:

Definition at line 104 of file portset.c.

References portset_add(), and REQUIRE.

Referenced by load_configuration(), and portset_fromconf().

void isc_portset_remove ( isc_portset_t portset,
in_port_t  port 
)

Remove the given port to the portset. The port may or may not be stored in the portset.

Requires:

Definition at line 111 of file portset.c.

References portset_remove().

Referenced by portset_fromconf().

void isc_portset_addrange ( isc_portset_t portset,
in_port_t  port_lo,
in_port_t  port_hi 
)

Add a subset of [port_lo, port_hi] (inclusive) to the portset. Ports in the subset may or may not be stored in portset.

Requires:

Definition at line 116 of file portset.c.

References portset_add(), and REQUIRE.

Referenced by create_default_portset(), load_configuration(), and portset_fromconf().

void isc_portset_removerange ( isc_portset_t portset,
in_port_t  port_lo,
in_port_t  port_hi 
)

Subtract a subset of [port_lo, port_hi] (inclusive) from the portset. Ports in the subset may or may not be stored in portset.

Requires:

Definition at line 131 of file portset.c.

References portset_remove(), and REQUIRE.

Referenced by portset_fromconf().


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha