portset.c revision 391ac1cbfd70da63569b621113f66a1526c2640c
/*
* Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: portset.c,v 1.3 2008/06/24 21:44:11 marka Exp $ */
/*! \file */
/*%
* 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.
*/
struct isc_portset {
unsigned int nports; /*%< number of ports in the set */
};
inline isc_boolean_t
}
inline void
}
}
inline void
}
}
return (ISC_R_NOMEMORY);
/* Make the set 'empty' by default */
return (ISC_R_SUCCESS);
}
void
}
}
unsigned int
}
void
}
void
}
void
{
in_port_t p;
p = port_lo;
do {
portset_add(portset, p);
} while (p++ < port_hi);
}
void
{
in_port_t p;
p = port_lo;
do {
portset_remove(portset, p);
} while (p++ < port_hi);
}