openc2lib.core.content

OpenC2 Command content

This module defines the content of an OpenC2 Message, as defined in Sec. 3.2 of the Language Specification.

 1"""OpenC2 Command content
 2
 3This module defines the content of an OpenC2 Message, as defined
 4in Sec. 3.2 of the Language Specification.
 5
 6"""
 7
 8import enum
 9
10class MessageType(enum.Enum):
11	"""OpenC2 Message Type
12	
13	Message type can be either `command` or `response`.
14	"""
15	command = 1
16	response = 2
17
18
19class Content:
20	""" Content of the OpenC2 Message
21
22		A content is the base class to derive either a `Command` or a `Response`. 
23	"""
24	msg_type: MessageType = None
25	"The type of Content (`MessageType`)"
26
27	def getType(self):
28		""" Returns the Content type """
29		return self.msg_type
class MessageType(enum.Enum):
11class MessageType(enum.Enum):
12	"""OpenC2 Message Type
13	
14	Message type can be either `command` or `response`.
15	"""
16	command = 1
17	response = 2

OpenC2 Message Type

Message type can be either command or response.

command = <MessageType.command: 1>
response = <MessageType.response: 2>
Inherited Members
enum.Enum
name
value
class Content:
20class Content:
21	""" Content of the OpenC2 Message
22
23		A content is the base class to derive either a `Command` or a `Response`. 
24	"""
25	msg_type: MessageType = None
26	"The type of Content (`MessageType`)"
27
28	def getType(self):
29		""" Returns the Content type """
30		return self.msg_type

Content of the OpenC2 Message

A content is the base class to derive either a Command or a Response.

msg_type: MessageType = None

The type of Content (MessageType)

def getType(self):
28	def getType(self):
29		""" Returns the Content type """
30		return self.msg_type

Returns the Content type