Package Reference#

fipv/fipv.c#

static PyObject *ipv4(PyObject *self, PyObject *args)#
[source]

Module function for validating IPv4 values.

Parameters:
  • self (PyObject*) – the module itself

  • args (PyObject*) – function arguments as a python object

Returns:

Python boolean object, True if value is a valid IPv4

otherwise returns False

static PyObject *ipv4_cidr(PyObject *self, PyObject *args)#
[source]

Module function for validating IPv4 CIDR values.

Parameters:
  • self (PyObject*) – the module itself

  • args (PyObject*) – function arguments as a python object

Returns:

Python boolean object, True if value is a valid IPv4 CIDR

otherwise returns False

static PyObject *ipv6(PyObject *self, PyObject *args)#
[source]

Module function for validating IPv6 values.

Parameters:
  • self (PyObject*) – the module itself

  • args (PyObject*) – function arguments as a python object

Returns:

Python boolean object, True if value is a valid IPv6

otherwise returns False

static PyObject *ipv6_cidr(PyObject *self, PyObject *args)#
[source]

Module function for validating IPv6 CIDR values.

Parameters:
  • self (PyObject*) – the module itself

  • args (PyObject*) – function arguments as a python object

Returns:

Python boolean object, True if value is a valid IPv6 CIDR

otherwise returns False

include/split.h#

struct split_t split(char *target_str, char *delimiters)#
[source]

Basically it splits dynamically given string.

Parameters:
  • target_str (char*) – target string to be splitted

  • delimiters (char*) – list of delimiter characters as a char pointer

Returns:

splitted results as a struct split_t type

void free_split(struct split_t *split_ptr)#
[source]

Deallocate any type of struct split_t object.

Parameters:
  • split_ptr (struct split_t*) – target address of split_t object

bool free_split_r(struct split_t *ptr, bool ret)#
[source]
Reentrant function for free_split. The _r indicates

that. Basically it frees given split_t pointer address (uses free_split) and returns given return value.

Parameters:
  • ptr (struct split_t*) – target address of split_t object

  • ret (bool) – return value as a bool

Returns:

directly given ret value

include/types.h#

struct split_t#
[source]

Struct type definition for store splitted results.

int length#
[source]

splitted tokens length

char **tokens#
[source]

tokenizer

include/utils.h#

bool is_digit(char *target_str)#
[source]

Checks if the given string is a digit.

Parameters:
  • target_str (char*) – target string to be checked

Returns:

true if string is a digit otherwise false

bool is_xdigit(char *target_str)#
[source]

Checks if the given string is a hexadecimal.

Parameters:
  • target_str (char*) – target string to be checked

Returns:

true if string is a hexadecimal otherwise false

bool startswith(char *target_str, char chr)#
[source]

Returns true if the given string startswith given character.

Parameters:
  • target_str (char*) – target string

  • chr (char) – comparing character

Returns:

true if target_str startswith chr

bool endswith(char *target_str, char chr)#
[source]

Returns true if the given string endswith given character.

Parameters:
  • target_str (char*) – target string

  • chr (char) – comparing character

Returns:

true if target_str endswith chr

int blanks(char *target_str, char delimiter)#
[source]
Definition of blank is python empty string (''). If you split ..

with . in python, you get 3 empty string (['', '', '']) simply blanks function counts these empty strings.

Parameters:
  • target_str (char*) – target string to count blanks

  • delimiter (char) – delimiter character

Returns:

count of empty strings

include/xalloc.h#

void *xmem_err(void *p)#
[source]

Throw exception and exit program if p is NULL pointer.

Parameters:
  • p (void*) – target pointer

Returns:

p if p is not NULL

void *xmalloc(size_t size)#
[source]

Allocate memory from heap and initialize with zero values.

Parameters:
  • size (size_t) – allocation byte size

Returns:

head of allocated address

void *xrealloc(void *target, size_t new_size)#
[source]

Reallocate given pointer address.

Parameters:
  • target (void*) – target pointer to be reallocated

  • new_size (size_t) – new allocation size

Returns:

head of reallocated address

void *xcalloc(size_t count, size_t size)#
[source]
Allocate memory from heap with count and

automatic initialize with zero values.

Parameters:
  • count (size_t) – allocation count

  • size (size_t) – allocation size

Returns:

head of allocated address

include/validators/ipv4.h#

bool is_ipv4(char *ipv4_addr)#
[source]

Returns true if given string is a IPv4 otherwise false.

Parameters:
  • ipv4_addr (char*) – target string to be validated

Returns:

true if given address is a IPv4 address

bool is_ipv4_cidr(char *ipv4_addr_cidr)#
[source]

Returns true if given string is a IPv4CIDR otherwise false.

Parameters:
  • ipv4_addr_cidrr (char*) – target string to be validated

Returns:

true if given address is a IPv4CIDR

include/validators/ipv6.h#

bool is_ipv6(char *ipv6_addr)#
[source]

Returns true if given string is a IPv6 otherwise false.

Parameters:
  • ipv6_addr (char*) – target string to be validated

Returns:

true if given address is a IPv6 address

bool is_ipv6_cidr(char *ipv6_addr_cidr)#
[source]

Returns true if given string is a IPv6CIDR otherwise false.

Parameters:
  • ipv6_addr_cidr (char*) – target string to be validated

Returns:

true if given address is a IPv6CIDR