openc2lib.core.args

Command Arguments

The definition of the (exendible) arguments of the OpenC2 Command (Sec. 3.3.1.4 of the Language Specification).

 1""" Command Arguments
 2
 3	The definition of the (exendible) arguments of the OpenC2 Command 
 4	(Sec. 3.3.1.4 of the Language Specification).
 5"""
 6import logging
 7
 8from openc2lib.types.datatypes import DateTime, Duration, ResponseType
 9from openc2lib.types.basetypes import Map
10from openc2lib.core.register import Register
11from openc2lib.core.profile import Profiles
12
13logger = logging.getLogger('openc2lib')
14
15ExtendedArguments = Register()
16""" List of extensions
17
18	This variable contains all argument extensions registered by Profiles. It is a dictionary which key
19	is the profile name, and the value is the `Args` class defined for that Profile.
20
21	Each `Args` definition for a Profile must be registered here to be available for encoding/decoding
22	OpenC2 `Message`s.
23
24	Multiple registration of extensions for the same Profile will raise a `ValueError` Exception.
25
26	Usage: see the `Register` interface.	
27"""
28
29
30class Args(Map):
31	""" OpenC2 Arguments
32
33		This class defines the base class structure and the common arguments.
34		Extensions for specific profiles must be derived from this class by giving the relevant `fieldtypes`, and
35		providing the base class and extension type.
36	"""
37	fieldtypes = dict(start_time= DateTime, stop_time= DateTime, duration= Duration, response_requested= ResponseType)
38	""" Allowed arguments
39
40		This is a list of allowed keys and corresponding argument types (classes). The keys and types are set according
41		to the Language Specification. This argument defines the syntax for the base Map that builds the
42		Args type. There is (currently) no controls on input data; this argument is only used to instantiate
43		the Args object from an OpenC2 Message.
44	"""
45	extend = None
46	""" Base class
47
48		This  field must be set to `Args` in all derived classes (i.e., definition of Arguments for specific Profiles).
49	"""
50
51	regext = ExtendedArguments
52	""" Extension Name Space
53	
54		This field is for internal use only and must not be modified by any derived class.	
55	"""
logger = <Logger openc2lib (WARNING)>
ExtendedArguments = {'slpf': <class 'openc2lib.profiles.slpf.args.Args'>}

List of extensions

This variable contains all argument extensions registered by Profiles. It is a dictionary which key is the profile name, and the value is the Args class defined for that Profile.

Each Args definition for a Profile must be registered here to be available for encoding/decoding OpenC2 Messages.

Multiple registration of extensions for the same Profile will raise a ValueError Exception.

Usage: see the Register interface.

class Args(openc2lib.types.basetypes.Map):
31class Args(Map):
32	""" OpenC2 Arguments
33
34		This class defines the base class structure and the common arguments.
35		Extensions for specific profiles must be derived from this class by giving the relevant `fieldtypes`, and
36		providing the base class and extension type.
37	"""
38	fieldtypes = dict(start_time= DateTime, stop_time= DateTime, duration= Duration, response_requested= ResponseType)
39	""" Allowed arguments
40
41		This is a list of allowed keys and corresponding argument types (classes). The keys and types are set according
42		to the Language Specification. This argument defines the syntax for the base Map that builds the
43		Args type. There is (currently) no controls on input data; this argument is only used to instantiate
44		the Args object from an OpenC2 Message.
45	"""
46	extend = None
47	""" Base class
48
49		This  field must be set to `Args` in all derived classes (i.e., definition of Arguments for specific Profiles).
50	"""
51
52	regext = ExtendedArguments
53	""" Extension Name Space
54	
55		This field is for internal use only and must not be modified by any derived class.	
56	"""

OpenC2 Arguments

This class defines the base class structure and the common arguments. Extensions for specific profiles must be derived from this class by giving the relevant fieldtypes, and providing the base class and extension type.

fieldtypes = {'start_time': <class 'openc2lib.types.datatypes.DateTime'>, 'stop_time': <class 'openc2lib.types.datatypes.DateTime'>, 'duration': <class 'openc2lib.types.datatypes.Duration'>, 'response_requested': <aenum 'ResponseType'>}

Allowed arguments

This is a list of allowed keys and corresponding argument types (classes). The keys and types are set according to the Language Specification. This argument defines the syntax for the base Map that builds the Args type. There is (currently) no controls on input data; this argument is only used to instantiate the Args object from an OpenC2 Message.

extend = None

Base class

This field must be set to Args in all derived classes (i.e., definition of Arguments for specific Profiles).

regext = {'slpf': <class 'openc2lib.profiles.slpf.args.Args'>}

Extension Name Space

This field is for internal use only and must not be modified by any derived class.

Inherited Members
openc2lib.types.basetypes.Map
todict
fromdict
builtins.dict
get
setdefault
pop
popitem
keys
items
values
update
fromkeys
clear
copy