Serial console parsers configuration

Overview

Definition of API to configure serial console parsers. More…

// typedefs

typedef struct tapi_parser_id tapi_parser_id;

// structs

struct tapi_parser_id;

// global functions

te_errno tapi_serial_tester_event_add(const char* name);
void tapi_serial_tester_event_del(const char* name);
te_errno tapi_serial_handler_ext_add(const char* ev_name, const char* h_name, int priority, const char* path);
te_errno tapi_serial_handler_int_add(const char* ev_name, const char* h_name, int priority, int signo);
void tapi_serial_handler_del(const char* ev_name, const char* h_name);
tapi_parser_id* tapi_serial_id_init(const char* agent, const char* c_name, const char* name);
void tapi_serial_id_cleanup(tapi_parser_id* id);
te_errno tapi_serial_parser_add(tapi_parser_id* id);
void tapi_serial_parser_del(tapi_parser_id* id);
te_errno tapi_serial_parser_enable(tapi_parser_id* id);
te_errno tapi_serial_parser_disable(tapi_parser_id* id);
te_errno tapi_serial_logging_enable(tapi_parser_id* id, const char* level);
te_errno tapi_serial_logging_disable(tapi_parser_id* id);
te_errno tapi_serial_parser_event_add(tapi_parser_id* id, const char* name, const char* t_name);
void tapi_serial_parser_event_del(tapi_parser_id* id, const char* name);
int tapi_serial_parser_pattern_add(tapi_parser_id* id, const char* e_name, const char* pattern);
void tapi_serial_parser_pattern_del(tapi_parser_id* id, const char* e_name, int pat_i);
te_errno tapi_serial_parser_reset(tapi_parser_id* id);
te_errno tapi_serial_parser_event_get_count(const tapi_parser_id* id, const char* e_name, int* count);

// macros

#define TE_SERIAL_MAX_NAME
#define TE_SERIAL_MAX_PATH
#define TE_SERIAL_PARSER_PORT
#define TE_SERIAL_PARSER_USER

Detailed Documentation

Definition of API to configure serial console parsers. See design document OKTL-0000469-SERIAL.txt. User manual: https://oktetlabs.ru/dokuwiki/doku.php/te/serial_console_parser

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct tapi_parser_id tapi_parser_id

Structure describes the parser identificator

Global Functions

te_errno tapi_serial_tester_event_add(const char* name)

Create a new empty Tester event

Parameters:

name

Event name

Returns:

Status code

void tapi_serial_tester_event_del(const char* name)

Remove a Tester event

Parameters:

name

Event name

te_errno tapi_serial_handler_ext_add(const char* ev_name, const char* h_name, int priority, const char* path)

Add a new external handler for event

Parameters:

ev_name

Event name

h_name

Handler name

priority

Handler priority

path

Path to the handler

Returns:

Status code

te_errno tapi_serial_handler_int_add(const char* ev_name, const char* h_name, int priority, int signo)

Add a new internal handler for event

Parameters:

ev_name

Event name

h_name

Handler name

priority

Handler priority

signo

Signal number

Returns:

Status code

void tapi_serial_handler_del(const char* ev_name, const char* h_name)

Remove handler

Parameters:

ev_name

Event name

h_name

Handler name

tapi_parser_id* tapi_serial_id_init(const char* agent, const char* c_name, const char* name)

Initialization of the parser id. The function calls the malloc. User should call cleanup function (tapi_serial_id_cleanup()) after use. By default conserver port value 3109 will be assigned.

Parameters:

agent

Agent name

c_name

Serial console name

name

The parser name

void tapi_serial_id_cleanup(tapi_parser_id* id)

Cleanup and free the parser id

te_errno tapi_serial_parser_add(tapi_parser_id* id)

Create and launch a new parser

Parameters:

id

Location of the parser id

Returns:

Status code

void tapi_serial_parser_del(tapi_parser_id* id)

Stop and remove parser

Parameters:

id

Location of the parser id

te_errno tapi_serial_parser_enable(tapi_parser_id* id)

Start a parser thread

Parameters:

id

Location of the parser id

Returns:

Status code

te_errno tapi_serial_parser_disable(tapi_parser_id* id)

Stop a parser thread

Parameters:

id

Location of the parser id

Returns:

Status code

te_errno tapi_serial_logging_enable(tapi_parser_id* id, const char* level)

Enable logging of the serial console to main log

Parameters:

id

Location of the parser id

level

Level name of the message for logging(logger_defs.h) Use NULL to no change the value.

te_errno tapi_serial_logging_disable(tapi_parser_id* id)

Disable logging of the serial console to main log

Parameters:

id

Location of the parser id

te_errno tapi_serial_parser_event_add(tapi_parser_id* id, const char* name, const char* t_name)

Add parser event to the parser

Parameters:

id

Location of the parser id

name

The parser event name

t_name

The Tester event name. Use a name of one of the events declarated in the Tester subtree. Use empty string if you do not need any processing on Tester

Returns:

Status code

void tapi_serial_parser_event_del(tapi_parser_id* id, const char* name)

Delete parser event

Parameters:

id

Location of the parser id

name

The parser event name

int tapi_serial_parser_pattern_add(tapi_parser_id* id, const char* e_name, const char* pattern)

Add a pattern to the parser event

Parameters:

id

Location of the parser id

e_name

The parser event name

pattern

The pattern string

Returns:

Index number of pattern or -1 in case of failure

void tapi_serial_parser_pattern_del(tapi_parser_id* id, const char* e_name, int pat_i)

Remove a pattern from the parser event

Parameters:

id

Location of the parser id

e_name

The parser event name

pat_i

Index of the pattern

te_errno tapi_serial_parser_reset(tapi_parser_id* id)

Reset status for each event of the parser

Parameters:

id

Location of the parser id

Returns:

Status code

te_errno tapi_serial_parser_event_get_count(const tapi_parser_id* id, const char* e_name, int* count)

Get number of times that a given parser event occurred.

Parameters:

id

Location of the parser ID

e_name

Event name

count

Where to save the requested number

Returns:

Status code.