Name
cidr_query — Obtain data associated with a CIDR block
Synopsis
#include "modules/generic/cidrdb.h"
| int **cidr_query** (
| name, | |
| | addr, | |
| | ac, | |
| | bag, | |
| | value, | |
| | resumeptr, | |
| | resumefunc)
; | |
const char * <var class="pdparam">name</var>
;
char * <var class="pdparam">addr</var>
;
accept_construct * <var class="pdparam">ac</var>
;
ec_bag * <var class="pdparam">bag</var>
;
string * <var class="pdparam">value</var>
;
void * <var class="pdparam">resumeptr</var>
;
void(*)(void *) <var class="pdparam">resumefunc</var>
;
Description
Obtain data associated with a CIDR block. In order to use this function you must load the cidrdb module.
- name
-
The name of the CIDR block.
- addr
-
the address of interest (may be NULL).
- ac
-
The accept construct (may be NULL). For more information about this struct see “accept_construct”.
- bag
-
The environmental bag (may be NULL). For more information about this struct see “ec_bag”.
- value
-
The variable to hold the matching value, or NULL if you are not interested.
- resumeptr
-
The context for the resumefunc (may be NULL).
- resumefunc
-
The optional resumption function (may be NULL).
This function returns 1
if the query matched an entry in the CIDR, or 0
if it does not.
If the resumefunc is specified, then in cases where the underlying data is pending resolution, the cidr_query function will return CIDR_QUERY_PENDING and will arrange to call resumefunc(resumeptr) when the load completes.
If resumefunc is not provided, and the data is pending, then the caller will block until it is made available.