Skip to content

C2 types service

consortium.server.services.c2_types_service

C2TypesService(listener_profiles_service, agent_profiles_service)

get_all_listener_types()

Returns all unique listener types across all loaded listener profiles.

Returns:

Type Description
list[BaseListenerType]

A deduplicated list of all listener types. Empty if no listener profiles

list[BaseListenerType]

are loaded.

get_listener_type_by_name(listener_type_name)

Returns a listener type by its name.

Parameters:

Name Type Description Default
listener_type_name str

The name of the listener type to retrieve.

required

Returns:

Type Description
BaseListenerType

The matching listener type.

Raises:

Type Description
ListenerTypeNotFoundError

If no listener type with the given name is registered.

get_all_agent_types()

Returns all unique agent types across all loaded agent profiles.

Returns:

Type Description
list[BaseAgentType]

A deduplicated list of all agent types. Empty if no agent profiles are

list[BaseAgentType]

loaded.

get_agent_type_by_name(agent_type_name)

Returns an agent type by its name.

Parameters:

Name Type Description Default
agent_type_name str

The name of the agent type to retrieve.

required

Returns:

Type Description
BaseAgentType

The matching agent type.

Raises:

Type Description
AgentTypeNotFoundError

If no agent type with the given name is registered.

get_compatible_listener_types_from_agent_type_name(agent_type_name)

Returns the names of all listener types compatible with the specified agent type.

Compatibility is determined by the compatible_listener_types attribute of the agent template. A single agent type can be declared by more than one agent template, in which case the result is the union of what each of them declares.

Parameters:

Name Type Description Default
agent_type_name str

The name of the agent type to look up.

required

Returns:

Type Description
list[str]

A deduplicated list of compatible listener type names. Empty if the agent

list[str]

type is not registered or has no compatible listener types.

get_registered_compatible_agent_types_from_listener_type_name(listener_type_name)

Returns the names of all registered agent types compatible with the specified listener type.

This is the reverse index of get_compatible_listener_types_from_agent_type_name and reflects which agent types have declared compatibility with the given listener type and are currently registered.

Parameters:

Name Type Description Default
listener_type_name str

The name of the listener type to look up.

required

Returns:

Type Description
list[str]

A deduplicated list of compatible registered agent type names. Empty if

list[str]

the listener type is not registered or has no compatible agent types

list[str]

registered.

is_agent_type_registered(agent_type_name)

Returns whether an agent type with the given name is currently registered.

Parameters:

Name Type Description Default
agent_type_name str

The name of the agent type to check.

required

Returns:

Type Description
bool

True if an agent type with the given name is registered, False

bool

otherwise.

is_listener_type_registered(listener_type_name)

Returns whether a listener type with the given name is currently registered.

Parameters:

Name Type Description Default
listener_type_name str

The name of the listener type to check.

required

Returns:

Type Description
bool

True if a listener type with the given name is registered, False

bool

otherwise.

are_c2_types_compatible(agent_type_name, listener_type_name)

Returns whether the specified agent type and listener type are compatible.

Parameters:

Name Type Description Default
agent_type_name str

The name of the agent type to check.

required
listener_type_name str

The name of the listener type to check.

required

Returns:

Type Description
bool

True if the agent type declares the listener type as compatible,

bool

False otherwise.

Raises:

Type Description
AgentTypeNotFoundError

If no agent type with the given name is registered.

ListenerTypeNotFoundError

If no listener type with the given name is registered.