#include <isc/net.h>
Go to the source code of this file.
Defines | |
#define | ISC_PORTSET_H 1 |
Functions | |
ISC_LANG_BEGINDECLS 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. |
This module provides simple utilities to handle a set of transport protocol (UDP or TCP) port numbers, e.g., for creating an ACL list. An isc_portset_t object is an opaque instance of a port set, for which the user can add or remove a specific port or a range of consecutive ports. This object is expected to be used as a temporary work space only, and does not protect simultaneous access from multiple threads. Therefore it must not be stored in a place that can be accessed from multiple threads.
Definition in file portset.h.
ISC_LANG_BEGINDECLS 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:
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:
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:
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().