rename config -> options
This commit is contained in:
@@ -110,7 +110,7 @@ struct ip_flow
|
||||
|
||||
struct ip_reassembly
|
||||
{
|
||||
// config
|
||||
// options
|
||||
bool enable;
|
||||
uint32_t timeout;
|
||||
uint32_t bucket_entries;
|
||||
@@ -189,29 +189,29 @@ static inline int is_power_of_2(uint32_t n)
|
||||
return n && !(n & (n - 1));
|
||||
}
|
||||
|
||||
static inline int ip_reassembly_check_config(const struct ip_reassembly_config *config)
|
||||
static inline int ip_reassembly_check_options(const struct ip_reassembly_options *opts)
|
||||
{
|
||||
if (config == NULL)
|
||||
if (opts == NULL)
|
||||
{
|
||||
IP_REASSEMBLE_DEBUG("invalid config");
|
||||
IP_REASSEMBLE_DEBUG("invalid options");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (config->enable)
|
||||
if (opts->enable)
|
||||
{
|
||||
if (config->timeout == 0)
|
||||
if (opts->timeout == 0)
|
||||
{
|
||||
IP_REASSEMBLE_DEBUG("invalid timeout");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (config->bucket_entries == 0 || is_power_of_2(config->bucket_entries) == 0)
|
||||
if (opts->bucket_entries == 0 || is_power_of_2(opts->bucket_entries) == 0)
|
||||
{
|
||||
IP_REASSEMBLE_DEBUG("invalid bucket entries, must be power of 2");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (config->bucket_num == 0)
|
||||
if (opts->bucket_num == 0)
|
||||
{
|
||||
IP_REASSEMBLE_DEBUG("invalid bucket num");
|
||||
return -1;
|
||||
@@ -752,9 +752,9 @@ error_out_overlap:
|
||||
* Public API
|
||||
******************************************************************************/
|
||||
|
||||
struct ip_reassembly *ip_reassembly_new(const struct ip_reassembly_config *config)
|
||||
struct ip_reassembly *ip_reassembly_new(const struct ip_reassembly_options *opts)
|
||||
{
|
||||
if (ip_reassembly_check_config(config) != 0)
|
||||
if (ip_reassembly_check_options(opts) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -765,10 +765,10 @@ struct ip_reassembly *ip_reassembly_new(const struct ip_reassembly_config *confi
|
||||
IP_REASSEMBLE_ERROR("unable to allocate memory");
|
||||
return NULL;
|
||||
}
|
||||
mgr->enable = config->enable;
|
||||
mgr->timeout = config->timeout;
|
||||
mgr->bucket_entries = config->bucket_entries;
|
||||
mgr->bucket_num = config->bucket_num;
|
||||
mgr->enable = opts->enable;
|
||||
mgr->timeout = opts->timeout;
|
||||
mgr->bucket_entries = opts->bucket_entries;
|
||||
mgr->bucket_num = opts->bucket_num;
|
||||
|
||||
if (!mgr->enable)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user