chewie.radius_datatypes module

Radius Attribute Datatypes

class chewie.radius_datatypes.Concat(bytes_data=None, raw_data=None)

Bases: DataType

AttributeTypes that use Concat must override their pack()

DATA_TYPE_VALUE = 6
data()

Subclass should override this as needed. Returns:

The python type (int, str, bytes) of the bytes_data.

This will perform any decoding as required instead of using the unprocessed bytes_data.

data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

full_length()
Returns:

Length of the whole field include the header (type and length)

pack(attribute_type)
classmethod parse(packed_value)
class chewie.radius_datatypes.DataType

Bases: object

Parent datatype class, subclass should provide implementation for abstractmethods. May

AVP_HEADER_LEN = 2
DATA_TYPE_VALUE = None
MAX_DATA_LENGTH = 253
MIN_DATA_LENGTH = 1
bytes_data = None
data()

Subclass should override this as needed. Returns:

The python type (int, str, bytes) of the bytes_data.

This will perform any decoding as required instead of using the unprocessed bytes_data.

data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

full_length()
Returns:

Length of the whole field include the header (type and length)

classmethod is_valid_length(packed_value)
pack(attribute_type)
parse(packed_value)
class chewie.radius_datatypes.Enum(bytes_data=None, raw_data=None)

Bases: DataType

DATA_TYPE_VALUE = 2
MAX_DATA_LENGTH = 4
MIN_DATA_LENGTH = 4
data()

Subclass should override this as needed. Returns:

The python type (int, str, bytes) of the bytes_data.

This will perform any decoding as required instead of using the unprocessed bytes_data.

data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

pack(attribute_type)
classmethod parse(packed_value)
class chewie.radius_datatypes.Integer(bytes_data=None, raw_data=None)

Bases: DataType

DATA_TYPE_VALUE = 1
MAX_DATA_LENGTH = 4
MIN_DATA_LENGTH = 4
data()

Subclass should override this as needed. Returns:

The python type (int, str, bytes) of the bytes_data.

This will perform any decoding as required instead of using the unprocessed bytes_data.

data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

pack(attribute_type)
classmethod parse(packed_value)
class chewie.radius_datatypes.String(bytes_data=None, raw_data=None)

Bases: DataType

DATA_TYPE_VALUE = 5
data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

pack(attribute_type)
classmethod parse(packed_value)
class chewie.radius_datatypes.Text(bytes_data=None, raw_data=None)

Bases: DataType

DATA_TYPE_VALUE = 4
data()

Subclass should override this as needed. Returns:

The python type (int, str, bytes) of the bytes_data.

This will perform any decoding as required instead of using the unprocessed bytes_data.

data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

pack(attribute_type)
classmethod parse(packed_value)
class chewie.radius_datatypes.Vsa(bytes_data=None, raw_data=None)

Bases: DataType

DATA_TYPE_VALUE = 14
MIN_DATA_LENGTH = 5
VENDOR_ID_LEN = 4
data_length()
Returns:

length of the data field, and not total length of the attribute (including the

type and length).

If total is required use full_length.

pack(attribute_type)
classmethod parse(packed_value)