C/C++ - RED Brick

This is the description of the C/C++ API bindings for the RED Brick. General information and technical specifications for the RED Brick are summarized in its hardware description.

An installation guide for the C/C++ API bindings is part of their general description.

API

Most functions of the C/C++ bindings return an error code (e_code). Data returned from the device, when a getter is called, is handled via output parameters. These parameters are labeled with the ret_ prefix.

Possible error codes are:

  • E_OK = 0
  • E_TIMEOUT = -1
  • E_NO_STREAM_SOCKET = -2
  • E_HOSTNAME_INVALID = -3
  • E_NO_CONNECT = -4
  • E_NO_THREAD = -5
  • E_NOT_ADDED = -6 (unused since C/C++ bindings version 2.0.0)
  • E_ALREADY_CONNECTED = -7
  • E_NOT_CONNECTED = -8
  • E_INVALID_PARAMETER = -9
  • E_NOT_SUPPORTED = -10
  • E_UNKNOWN_ERROR_CODE = -11
  • E_STREAM_OUT_OF_SYNC = -12
  • E_INVALID_UID = -13
  • E_NON_ASCII_CHAR_IN_SECRET = -14
  • E_WRONG_DEVICE_TYPE = -15
  • E_DEVICE_REPLACED = -16
  • E_WRONG_RESPONSE_LENGTH = -17

as defined in ip_connection.h.

All functions listed below are thread-safe.

Note

The API documentation for the RED Brick is currently incomplete.

The RED Brick API is meant to be used by the Brick Viewer to implement the offered functionality (getting status information, managing programs etc.). Normal users will not need to use this API, it may only be interesting for power users.

FIXME: explain sessions

The RED Brick API operates on reference counted objects (strings, lists, files, directories, processes and programs) that are identified by their 16bit object ID. Functions that allocate or return an object ID (e.g. red_allocate_string() and red_get_next_directory_entry()) increase the reference count of the returned object. If the object is no longer needed then red_release_object() has to be called to decrease the reference count of the object again. In contrast to allocation and getter functions, the reference count for an object returned by a callback is not increased and red_release_object() must not be called for such an object in response to a callback.

There are functions (e.g. red_get_file_info()) that only return valid objects under certain conditions. This conditions are documented for the specific functions. For invalid objects red_release_object() must not be called.

There are also function (e.g. red_set_program_stdio_redirection()) that have conditionally unused object parameters. Under which conditions an object parameter is unused is documented for the specific functions. For unused object parameters 0 has to be passed as object ID.

The RED Brick API is more complex then the typical Brick API and requires more elaborate error reporting than the TCP/IP protocol can provide with its 2bit error code. Therefore, almost all functions of the RED Brick API return an 8bit error code. Possible error codes are:

  • Success = 0
  • UnknownError = 1
  • InvalidOperation = 2
  • OperationAborted = 3
  • InternalError = 4
  • UnknownSessionID = 5
  • NoFreeSessionID = 6
  • UnknownObjectID = 7
  • NoFreeObjectID = 8
  • ObjectIsLocked = 9
  • NoMoreData = 10
  • WrongListItemType = 11
  • ProgramIsPurged = 12
  • InvalidParameter = 128 (EINVAL)
  • NoFreeMemory = 129 (ENOMEM)
  • NoFreeSpace = 130 (ENOSPC)
  • AccessDenied = 131 (EACCES)
  • AlreadyExists = 132 (EEXIST)
  • DoesNotExist = 133 (ENOENT)
  • Interrupted = 134 (EINTR)
  • IsDirectory = 135 (EISDIR)
  • NotADirectory = 136 (ENOTDIR)
  • WouldBlock = 137 (EWOULDBLOCK)
  • Overflow = 138 (EOVERFLOW)
  • BadFileDescriptor = 139 (EBADF)
  • OutOfRange = 140 (ERANGE)
  • NameTooLong = 141 (ENAMETOOLONG)
  • InvalidSeek = 142 (ESPIPE)
  • NotSupported = 143 (ENOTSUP)
  • TooManyOpenFiles = 144 (EMFILE)

If a function returns an error code other than Success then its other return values (if any) are invalid and must not be used.

The error code InvalidOperation is returned if the requested operation cannot be performed because the current state of the object does not allow it. For example, trying to append an item to a full list object or trying to undefine an already undefined program.

The error code NotSupported is returned if the requested operation can never be performed. For example, trying to append a list object to itself, trying to get the name of a file object with type Pipe or trying to create a directory non-recursively with more than the last part of the directory name referring to non-existing directories.

String objects store UTF-8 encoded data.

Advanced Functions

int red_create_session(RED *red, uint32_t lifetime, uint8_t *ret_error_code, uint16_t *ret_session_id)
Parameters:
  • red – Type: RED *
  • lifetime – Type: uint32_t, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_session_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_expire_session(RED *red, uint16_t session_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_expire_session_unchecked(RED *red, uint16_t session_id)
Parameters:
  • red – Type: RED *
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int
int red_keep_session_alive(RED *red, uint16_t session_id, uint32_t lifetime, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
  • lifetime – Type: uint32_t, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_release_object(RED *red, uint16_t object_id, uint16_t session_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • object_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Decreases the reference count of an object by one and returns the resulting error code. If the reference count reaches zero the object gets destroyed.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_release_object_unchecked(RED *red, uint16_t object_id, uint16_t session_id)
Parameters:
  • red – Type: RED *
  • object_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int
int red_allocate_string(RED *red, uint32_t length_to_reserve, const char *buffer, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_string_id)
Parameters:
  • red – Type: RED *
  • length_to_reserve – Type: uint32_t, Unit: 1 B, Range: [0 to 232 - 1]
  • buffer – Type: const char[58]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Allocates a new string object, reserves length_to_reserve bytes memory for it and sets up to the first 60 bytes. Set length_to_reserve to the length of the string that should be stored in the string object.

Returns the object ID of the new string object and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_truncate_string(RED *red, uint16_t string_id, uint32_t length, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • length – Type: uint32_t, Unit: 1 B, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Truncates a string object to length bytes and returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_string_length(RED *red, uint16_t string_id, uint8_t *ret_error_code, uint32_t *ret_length)
Parameters:
  • red – Type: RED *
  • string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_length – Type: uint32_t, Unit: 1 B, Range: [0 to 232 - 1]
Returns:
  • e_code – Type: int

Returns the length of a string object and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_set_string_chunk(RED *red, uint16_t string_id, uint32_t offset, const char *buffer, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • offset – Type: uint32_t, Unit: 1 B, Range: [0 to 232 - 1]
  • buffer – Type: const char[58]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Sets a chunk of up to 58 bytes in a string object beginning at offset.

Returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_string_chunk(RED *red, uint16_t string_id, uint32_t offset, uint8_t *ret_error_code, char ret_buffer[63])
Parameters:
  • red – Type: RED *
  • string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • offset – Type: uint32_t, Unit: 1 B, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_buffer – Type: char[63]
Returns:
  • e_code – Type: int

Returns a chunk up to 63 bytes from a string object beginning at offset and returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_allocate_list(RED *red, uint16_t length_to_reserve, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_list_id)
Parameters:
  • red – Type: RED *
  • length_to_reserve – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_list_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Allocates a new list object and reserves memory for length_to_reserve items. Set length_to_reserve to the number of items that should be stored in the list object.

Returns the object ID of the new list object and the resulting error code.

When a list object gets destroyed then the reference count of each object in the list object is decreased by one.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_list_length(RED *red, uint16_t list_id, uint8_t *ret_error_code, uint16_t *ret_length)
Parameters:
  • red – Type: RED *
  • list_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_length – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Returns the length of a list object in items and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_list_item(RED *red, uint16_t list_id, uint16_t index, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_item_object_id, uint8_t *ret_type)
Parameters:
  • red – Type: RED *
  • list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • index – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_item_object_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_type – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Returns the object ID and type of the object stored at index in a list object and returns the resulting error code.

Possible object types are:

  • String = 0
  • List = 1
  • File = 2
  • Directory = 3
  • Process = 4
  • Program = 5

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_type:

  • RED_OBJECT_TYPE_STRING = 0
  • RED_OBJECT_TYPE_LIST = 1
  • RED_OBJECT_TYPE_FILE = 2
  • RED_OBJECT_TYPE_DIRECTORY = 3
  • RED_OBJECT_TYPE_PROCESS = 4
  • RED_OBJECT_TYPE_PROGRAM = 5
int red_append_to_list(RED *red, uint16_t list_id, uint16_t item_object_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • item_object_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Appends an object to a list object and increases the reference count of the appended object by one.

Returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_remove_from_list(RED *red, uint16_t list_id, uint16_t index, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • index – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Removes the object stored at index from a list object and decreases the reference count of the removed object by one.

Returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_open_file(RED *red, uint16_t name_string_id, uint32_t flags, uint16_t permissions, uint32_t uid, uint32_t gid, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_file_id)
Parameters:
  • red – Type: RED *
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • flags – Type: uint32_t, Range: See constants
  • permissions – Type: uint16_t, Range: See constants
  • uid – Type: uint32_t, Range: [0 to 232 - 1]
  • gid – Type: uint32_t, Range: [0 to 232 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_file_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Opens an existing file or creates a new file and allocates a new file object for it.

FIXME: name has to be absolute

The reference count of the name string object is increased by one. When the file object gets destroyed then the reference count of the name string object is decreased by one. Also the name string object is locked and cannot be modified while the file object holds a reference to it.

The flags parameter takes a ORed combination of the following possible file flags (in hexadecimal notation):

  • ReadOnly = 0x0001 (O_RDONLY)
  • WriteOnly = 0x0002 (O_WRONLY)
  • ReadWrite = 0x0004 (O_RDWR)
  • Append = 0x0008 (O_APPEND)
  • Create = 0x0010 (O_CREAT)
  • Exclusive = 0x0020 (O_EXCL)
  • NonBlocking = 0x0040 (O_NONBLOCK)
  • Truncate = 0x0080 (O_TRUNC)
  • Temporary = 0x0100
  • Replace = 0x0200

FIXME: explain Temporary and Replace flag

The permissions parameter takes a ORed combination of the following possible file permissions (in octal notation) that match the common UNIX permission bits:

  • UserRead = 00400
  • UserWrite = 00200
  • UserExecute = 00100
  • GroupRead = 00040
  • GroupWrite = 00020
  • GroupExecute = 00010
  • OthersRead = 00004
  • OthersWrite = 00002
  • OthersExecute = 00001

Returns the object ID of the new file object and the resulting error code.

The following constants are available for this function:

For flags:

  • RED_FILE_FLAG_READ_ONLY = 1
  • RED_FILE_FLAG_WRITE_ONLY = 2
  • RED_FILE_FLAG_READ_WRITE = 4
  • RED_FILE_FLAG_APPEND = 8
  • RED_FILE_FLAG_CREATE = 16
  • RED_FILE_FLAG_EXCLUSIVE = 32
  • RED_FILE_FLAG_NON_BLOCKING = 64
  • RED_FILE_FLAG_TRUNCATE = 128
  • RED_FILE_FLAG_TEMPORARY = 256
  • RED_FILE_FLAG_REPLACE = 512

For permissions:

  • RED_FILE_PERMISSION_USER_ALL = 448
  • RED_FILE_PERMISSION_USER_READ = 256
  • RED_FILE_PERMISSION_USER_WRITE = 128
  • RED_FILE_PERMISSION_USER_EXECUTE = 64
  • RED_FILE_PERMISSION_GROUP_ALL = 56
  • RED_FILE_PERMISSION_GROUP_READ = 32
  • RED_FILE_PERMISSION_GROUP_WRITE = 16
  • RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • RED_FILE_PERMISSION_OTHERS_ALL = 7
  • RED_FILE_PERMISSION_OTHERS_READ = 4
  • RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • RED_FILE_PERMISSION_OTHERS_EXECUTE = 1

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_create_pipe(RED *red, uint32_t flags, uint64_t length, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_file_id)
Parameters:
  • red – Type: RED *
  • flags – Type: uint32_t, Range: See constants
  • length – Type: uint64_t, Unit: 1 B, Range: [0 to 264 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_file_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Creates a new pipe and allocates a new file object for it.

The flags parameter takes a ORed combination of the following possible pipe flags (in hexadecimal notation):

  • NonBlockingRead = 0x0001
  • NonBlockingWrite = 0x0002

The length of the pipe buffer can be specified with the length parameter in bytes. If length is set to zero, then the default pipe buffer length is used.

Returns the object ID of the new file object and the resulting error code.

The following constants are available for this function:

For flags:

  • RED_PIPE_FLAG_NON_BLOCKING_READ = 1
  • RED_PIPE_FLAG_NON_BLOCKING_WRITE = 2

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_file_info(RED *red, uint16_t file_id, uint16_t session_id, uint8_t *ret_error_code, uint8_t *ret_type, uint16_t *ret_name_string_id, uint32_t *ret_flags, uint16_t *ret_permissions, uint32_t *ret_uid, uint32_t *ret_gid, uint64_t *ret_length, uint64_t *ret_access_timestamp, uint64_t *ret_modification_timestamp, uint64_t *ret_status_change_timestamp)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_type – Type: uint8_t, Range: See constants
  • ret_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_flags – Type: uint32_t, Range: See constants
  • ret_permissions – Type: uint16_t, Range: See constants
  • ret_uid – Type: uint32_t, Range: [0 to 232 - 1]
  • ret_gid – Type: uint32_t, Range: [0 to 232 - 1]
  • ret_length – Type: uint64_t, Unit: 1 B, Range: [0 to 264 - 1]
  • ret_access_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
  • ret_modification_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
  • ret_status_change_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
Returns:
  • e_code – Type: int

Returns various information about a file and the resulting error code.

Possible file types are:

  • Unknown = 0
  • Regular = 1
  • Directory = 2
  • Character = 3
  • Block = 4
  • FIFO = 5
  • Symlink = 6
  • Socket = 7
  • Pipe = 8

If the file type is Pipe then the returned name string object is invalid, because a pipe has no name. Otherwise the returned name string object was used to open or create the file object, as passed to red_open_file().

The returned flags were used to open or create the file object, as passed to red_open_file() or red_create_pipe(). See the respective function for a list of possible file and pipe flags.

FIXME: everything except flags and length is invalid if file type is Pipe

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_type:

  • RED_FILE_TYPE_UNKNOWN = 0
  • RED_FILE_TYPE_REGULAR = 1
  • RED_FILE_TYPE_DIRECTORY = 2
  • RED_FILE_TYPE_CHARACTER = 3
  • RED_FILE_TYPE_BLOCK = 4
  • RED_FILE_TYPE_FIFO = 5
  • RED_FILE_TYPE_SYMLINK = 6
  • RED_FILE_TYPE_SOCKET = 7
  • RED_FILE_TYPE_PIPE = 8

For ret_flags:

  • RED_FILE_FLAG_READ_ONLY = 1
  • RED_FILE_FLAG_WRITE_ONLY = 2
  • RED_FILE_FLAG_READ_WRITE = 4
  • RED_FILE_FLAG_APPEND = 8
  • RED_FILE_FLAG_CREATE = 16
  • RED_FILE_FLAG_EXCLUSIVE = 32
  • RED_FILE_FLAG_NON_BLOCKING = 64
  • RED_FILE_FLAG_TRUNCATE = 128
  • RED_FILE_FLAG_TEMPORARY = 256
  • RED_FILE_FLAG_REPLACE = 512

For ret_permissions:

  • RED_FILE_PERMISSION_USER_ALL = 448
  • RED_FILE_PERMISSION_USER_READ = 256
  • RED_FILE_PERMISSION_USER_WRITE = 128
  • RED_FILE_PERMISSION_USER_EXECUTE = 64
  • RED_FILE_PERMISSION_GROUP_ALL = 56
  • RED_FILE_PERMISSION_GROUP_READ = 32
  • RED_FILE_PERMISSION_GROUP_WRITE = 16
  • RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • RED_FILE_PERMISSION_OTHERS_ALL = 7
  • RED_FILE_PERMISSION_OTHERS_READ = 4
  • RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • RED_FILE_PERMISSION_OTHERS_EXECUTE = 1
int red_read_file(RED *red, uint16_t file_id, uint8_t length_to_read, uint8_t *ret_error_code, uint8_t ret_buffer[62], uint8_t *ret_length_read)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • length_to_read – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_buffer – Type: uint8_t[62], Range: [0 to 255]
  • ret_length_read – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Returns:
  • e_code – Type: int

Reads up to 62 bytes from a file object.

Returns the bytes read, the actual number of bytes read and the resulting error code.

If there is not data to be read, either because the file position reached end-of-file or because there is not data in the pipe, then zero bytes are returned.

If the file object was created by red_open_file() without the NonBlocking flag or by red_create_pipe() without the NonBlockingRead flag then the error code NotSupported is returned.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_read_file_async(RED *red, uint16_t file_id, uint64_t length_to_read)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • length_to_read – Type: uint64_t, Unit: 1 B, Range: [0 to 264 - 1]
Returns:
  • e_code – Type: int

Reads up to 263 - 1 bytes from a file object asynchronously.

Reports the bytes read (in 60 byte chunks), the actual number of bytes read and the resulting error code via the RED_CALLBACK_ASYNC_FILE_READ callback.

If there is not data to be read, either because the file position reached end-of-file or because there is not data in the pipe, then zero bytes are reported.

If the file object was created by red_open_file() without the NonBlocking flag or by red_create_pipe() without the NonBlockingRead flag then the error code NotSupported is reported via the RED_CALLBACK_ASYNC_FILE_READ callback.

int red_abort_async_file_read(RED *red, uint16_t file_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Aborts a red_read_file_async() operation in progress.

Returns the resulting error code.

On success the RED_CALLBACK_ASYNC_FILE_READ callback will report OperationAborted.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_write_file(RED *red, uint16_t file_id, uint8_t buffer[61], uint8_t length_to_write, uint8_t *ret_error_code, uint8_t *ret_length_written)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • buffer – Type: uint8_t[61], Range: [0 to 255]
  • length_to_write – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_length_written – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Returns:
  • e_code – Type: int

Writes up to 61 bytes to a file object.

Returns the actual number of bytes written and the resulting error code.

If the file object was created by red_open_file() without the NonBlocking flag or by red_create_pipe() without the NonBlockingWrite flag then the error code NotSupported is returned.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_write_file_unchecked(RED *red, uint16_t file_id, uint8_t buffer[61], uint8_t length_to_write)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • buffer – Type: uint8_t[61], Range: [0 to 255]
  • length_to_write – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Returns:
  • e_code – Type: int

Writes up to 61 bytes to a file object.

Does neither report the actual number of bytes written nor the resulting error code.

If the file object was created by red_open_file() without the NonBlocking flag or by red_create_pipe() without the NonBlockingWrite flag then the write operation will fail silently.

int red_write_file_async(RED *red, uint16_t file_id, uint8_t buffer[61], uint8_t length_to_write)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • buffer – Type: uint8_t[61], Range: [0 to 255]
  • length_to_write – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
Returns:
  • e_code – Type: int

Writes up to 61 bytes to a file object.

Reports the actual number of bytes written and the resulting error code via the RED_CALLBACK_ASYNC_FILE_WRITE callback.

If the file object was created by red_open_file() without the NonBlocking flag or by red_create_pipe() without the NonBlockingWrite flag then the error code NotSupported is reported via the RED_CALLBACK_ASYNC_FILE_WRITE callback.

int red_set_file_position(RED *red, uint16_t file_id, int64_t offset, uint8_t origin, uint8_t *ret_error_code, uint64_t *ret_position)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • offset – Type: int64_t, Unit: 1 B, Range: [-263 to 263 - 1]
  • origin – Type: uint8_t, Range: See constants
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_position – Type: uint64_t, Unit: 1 B, Range: [0 to 264 - 1]
Returns:
  • e_code – Type: int

Set the current seek position of a file object relative to origin.

Possible file origins are:

  • Beginning = 0
  • Current = 1
  • End = 2

Returns the resulting absolute seek position and error code.

If the file object was created by red_create_pipe() then it has no seek position and the error code InvalidSeek is returned.

The following constants are available for this function:

For origin:

  • RED_FILE_ORIGIN_BEGINNING = 0
  • RED_FILE_ORIGIN_CURRENT = 1
  • RED_FILE_ORIGIN_END = 2

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_file_position(RED *red, uint16_t file_id, uint8_t *ret_error_code, uint64_t *ret_position)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_position – Type: uint64_t, Unit: 1 B, Range: [0 to 264 - 1]
Returns:
  • e_code – Type: int

Returns the current seek position of a file object and returns the resulting error code.

If the file object was created by red_create_pipe() then it has no seek position and the error code InvalidSeek is returned.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_set_file_events(RED *red, uint16_t file_id, uint16_t events, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • events – Type: uint16_t, Range: See constants
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For events:

  • RED_FILE_EVENT_READABLE = 1
  • RED_FILE_EVENT_WRITABLE = 2

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_file_events(RED *red, uint16_t file_id, uint8_t *ret_error_code, uint16_t *ret_events)
Parameters:
  • red – Type: RED *
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_events – Type: uint16_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_events:

  • RED_FILE_EVENT_READABLE = 1
  • RED_FILE_EVENT_WRITABLE = 2
int red_open_directory(RED *red, uint16_t name_string_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_directory_id)
Parameters:
  • red – Type: RED *
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_directory_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Opens an existing directory and allocates a new directory object for it.

FIXME: name has to be absolute

The reference count of the name string object is increased by one. When the directory object is destroyed then the reference count of the name string object is decreased by one. Also the name string object is locked and cannot be modified while the directory object holds a reference to it.

Returns the object ID of the new directory object and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_directory_name(RED *red, uint16_t directory_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_name_string_id)
Parameters:
  • red – Type: RED *
  • directory_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Returns the name of a directory object, as passed to red_open_directory(), and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_next_directory_entry(RED *red, uint16_t directory_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_name_string_id, uint8_t *ret_type)
Parameters:
  • red – Type: RED *
  • directory_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_type – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Returns the next entry in a directory object and the resulting error code.

If there is not next entry then error code NoMoreData is returned. To rewind a directory object call red_rewind_directory().

Possible directory entry types are:

  • Unknown = 0
  • Regular = 1
  • Directory = 2
  • Character = 3
  • Block = 4
  • FIFO = 5
  • Symlink = 6
  • Socket = 7

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_type:

  • RED_DIRECTORY_ENTRY_TYPE_UNKNOWN = 0
  • RED_DIRECTORY_ENTRY_TYPE_REGULAR = 1
  • RED_DIRECTORY_ENTRY_TYPE_DIRECTORY = 2
  • RED_DIRECTORY_ENTRY_TYPE_CHARACTER = 3
  • RED_DIRECTORY_ENTRY_TYPE_BLOCK = 4
  • RED_DIRECTORY_ENTRY_TYPE_FIFO = 5
  • RED_DIRECTORY_ENTRY_TYPE_SYMLINK = 6
  • RED_DIRECTORY_ENTRY_TYPE_SOCKET = 7
int red_rewind_directory(RED *red, uint16_t directory_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • directory_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Rewinds a directory object and returns the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_create_directory(RED *red, uint16_t name_string_id, uint32_t flags, uint16_t permissions, uint32_t uid, uint32_t gid, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • flags – Type: uint32_t, Range: See constants
  • permissions – Type: uint16_t, Range: See constants
  • uid – Type: uint32_t, Range: [0 to 232 - 1]
  • gid – Type: uint32_t, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

FIXME: name has to be absolute

The following constants are available for this function:

For flags:

  • RED_DIRECTORY_FLAG_RECURSIVE = 1
  • RED_DIRECTORY_FLAG_EXCLUSIVE = 2

For permissions:

  • RED_FILE_PERMISSION_USER_ALL = 448
  • RED_FILE_PERMISSION_USER_READ = 256
  • RED_FILE_PERMISSION_USER_WRITE = 128
  • RED_FILE_PERMISSION_USER_EXECUTE = 64
  • RED_FILE_PERMISSION_GROUP_ALL = 56
  • RED_FILE_PERMISSION_GROUP_READ = 32
  • RED_FILE_PERMISSION_GROUP_WRITE = 16
  • RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • RED_FILE_PERMISSION_OTHERS_ALL = 7
  • RED_FILE_PERMISSION_OTHERS_READ = 4
  • RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • RED_FILE_PERMISSION_OTHERS_EXECUTE = 1

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_processes(RED *red, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_processes_list_id)
Parameters:
  • red – Type: RED *
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_processes_list_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_spawn_process(RED *red, uint16_t executable_string_id, uint16_t arguments_list_id, uint16_t environment_list_id, uint16_t working_directory_string_id, uint32_t uid, uint32_t gid, uint16_t stdin_file_id, uint16_t stdout_file_id, uint16_t stderr_file_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_process_id)
Parameters:
  • red – Type: RED *
  • executable_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • arguments_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • environment_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • working_directory_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • uid – Type: uint32_t, Range: [0 to 232 - 1]
  • gid – Type: uint32_t, Range: [0 to 232 - 1]
  • stdin_file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • stdout_file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • stderr_file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_process_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_kill_process(RED *red, uint16_t process_id, uint8_t signal, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
  • signal – Type: uint8_t, Range: See constants
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

Sends a UNIX signal to a process object and returns the resulting error code.

Possible UNIX signals are:

  • Interrupt = 2
  • Quit = 3
  • Abort = 6
  • Kill = 9
  • User1 = 10
  • User2 = 12
  • Terminate = 15
  • Continue = 18
  • Stop = 19

The following constants are available for this function:

For signal:

  • RED_PROCESS_SIGNAL_INTERRUPT = 2
  • RED_PROCESS_SIGNAL_QUIT = 3
  • RED_PROCESS_SIGNAL_ABORT = 6
  • RED_PROCESS_SIGNAL_KILL = 9
  • RED_PROCESS_SIGNAL_USER1 = 10
  • RED_PROCESS_SIGNAL_USER2 = 12
  • RED_PROCESS_SIGNAL_TERMINATE = 15
  • RED_PROCESS_SIGNAL_CONTINUE = 18
  • RED_PROCESS_SIGNAL_STOP = 19

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_process_command(RED *red, uint16_t process_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_executable_string_id, uint16_t *ret_arguments_list_id, uint16_t *ret_environment_list_id, uint16_t *ret_working_directory_string_id)
Parameters:
  • red – Type: RED *
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_executable_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_arguments_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_environment_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_working_directory_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Returns the executable, arguments, environment and working directory used to spawn a process object, as passed to red_spawn_process(), and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_process_identity(RED *red, uint16_t process_id, uint8_t *ret_error_code, uint32_t *ret_pid, uint32_t *ret_uid, uint32_t *ret_gid)
Parameters:
  • red – Type: RED *
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_pid – Type: uint32_t, Range: [0 to 232 - 1]
  • ret_uid – Type: uint32_t, Range: [0 to 232 - 1]
  • ret_gid – Type: uint32_t, Range: [0 to 232 - 1]
Returns:
  • e_code – Type: int

Returns the process ID and the user and group ID used to spawn a process object, as passed to red_spawn_process(), and the resulting error code.

The process ID is only valid if the state is Running or Stopped, see red_get_process_state().

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_process_stdio(RED *red, uint16_t process_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_stdin_file_id, uint16_t *ret_stdout_file_id, uint16_t *ret_stderr_file_id)
Parameters:
  • red – Type: RED *
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_stdin_file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_stdout_file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_stderr_file_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Returns the stdin, stdout and stderr files used to spawn a process object, as passed to red_spawn_process(), and the resulting error code.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_process_state(RED *red, uint16_t process_id, uint8_t *ret_error_code, uint8_t *ret_state, uint64_t *ret_timestamp, uint8_t *ret_exit_code)
Parameters:
  • red – Type: RED *
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_state – Type: uint8_t, Range: See constants
  • ret_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
  • ret_exit_code – Type: uint8_t, Range: [0 to 255]
Returns:
  • e_code – Type: int

Returns the current state, timestamp and exit code of a process object, and the resulting error code.

Possible process states are:

  • Unknown = 0
  • Running = 1
  • Error = 2
  • Exited = 3
  • Killed = 4
  • Stopped = 5

The timestamp represents the UNIX time since when the process is in its current state.

The exit code is only valid if the state is Error, Exited, Killed or Stopped and has different meanings depending on the state:

  • Error: error code for error occurred while spawning the process (see below)
  • Exited: exit status of the process
  • Killed: UNIX signal number used to kill the process
  • Stopped: UNIX signal number used to stop the process

Possible exit/error codes in Error state are:

  • InternalError = 125
  • CannotExecute = 126
  • DoesNotExist = 127

The CannotExecute error can be caused by the executable being opened for writing.

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_state:

  • RED_PROCESS_STATE_UNKNOWN = 0
  • RED_PROCESS_STATE_RUNNING = 1
  • RED_PROCESS_STATE_ERROR = 2
  • RED_PROCESS_STATE_EXITED = 3
  • RED_PROCESS_STATE_KILLED = 4
  • RED_PROCESS_STATE_STOPPED = 5
int red_get_programs(RED *red, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_programs_list_id)
Parameters:
  • red – Type: RED *
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_programs_list_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_define_program(RED *red, uint16_t identifier_string_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_program_id)
Parameters:
  • red – Type: RED *
  • identifier_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_program_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_purge_program(RED *red, uint16_t program_id, uint32_t cookie, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • cookie – Type: uint32_t, Range: [0 to 232 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_program_identifier(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_identifier_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_identifier_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_program_root_directory(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_root_directory_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_root_directory_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

FIXME: root directory is absolute: <home>/programs/<identifier>

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_set_program_command(RED *red, uint16_t program_id, uint16_t executable_string_id, uint16_t arguments_list_id, uint16_t environment_list_id, uint16_t working_directory_string_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • executable_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • arguments_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • environment_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • working_directory_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

FIXME: working directory is relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_program_command(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_executable_string_id, uint16_t *ret_arguments_list_id, uint16_t *ret_environment_list_id, uint16_t *ret_working_directory_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_executable_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_arguments_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_environment_list_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_working_directory_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

FIXME: working directory is relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_set_program_stdio_redirection(RED *red, uint16_t program_id, uint8_t stdin_redirection, uint16_t stdin_file_name_string_id, uint8_t stdout_redirection, uint16_t stdout_file_name_string_id, uint8_t stderr_redirection, uint16_t stderr_file_name_string_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • stdin_redirection – Type: uint8_t, Range: See constants
  • stdin_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • stdout_redirection – Type: uint8_t, Range: See constants
  • stdout_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • stderr_redirection – Type: uint8_t, Range: See constants
  • stderr_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

FIXME: stdio file names are relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

For stdin_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stdout_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stderr_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_program_stdio_redirection(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint8_t *ret_stdin_redirection, uint16_t *ret_stdin_file_name_string_id, uint8_t *ret_stdout_redirection, uint16_t *ret_stdout_file_name_string_id, uint8_t *ret_stderr_redirection, uint16_t *ret_stderr_file_name_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_stdin_redirection – Type: uint8_t, Range: See constants
  • ret_stdin_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_stdout_redirection – Type: uint8_t, Range: See constants
  • ret_stdout_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_stderr_redirection – Type: uint8_t, Range: See constants
  • ret_stderr_file_name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

FIXME: stdio file names are relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_stdin_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For ret_stdout_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For ret_stderr_redirection:

  • RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5
int red_set_program_schedule(RED *red, uint16_t program_id, uint8_t start_mode, bool continue_after_error, uint32_t start_interval, uint16_t start_fields_string_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • start_mode – Type: uint8_t, Range: See constants
  • continue_after_error – Type: bool
  • start_interval – Type: uint32_t, Range: [0 to 232 - 1]
  • start_fields_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For start_mode:

  • RED_PROGRAM_START_MODE_NEVER = 0
  • RED_PROGRAM_START_MODE_ALWAYS = 1
  • RED_PROGRAM_START_MODE_INTERVAL = 2
  • RED_PROGRAM_START_MODE_CRON = 3

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_program_schedule(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint8_t *ret_start_mode, bool *ret_continue_after_error, uint32_t *ret_start_interval, uint16_t *ret_start_fields_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_start_mode – Type: uint8_t, Range: See constants
  • ret_continue_after_error – Type: bool
  • ret_start_interval – Type: uint32_t, Range: [0 to 232 - 1]
  • ret_start_fields_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_start_mode:

  • RED_PROGRAM_START_MODE_NEVER = 0
  • RED_PROGRAM_START_MODE_ALWAYS = 1
  • RED_PROGRAM_START_MODE_INTERVAL = 2
  • RED_PROGRAM_START_MODE_CRON = 3
int red_get_program_scheduler_state(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint8_t *ret_state, uint64_t *ret_timestamp, uint16_t *ret_message_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_state – Type: uint8_t, Range: See constants
  • ret_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
  • ret_message_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

FIXME: message is currently valid in error-occurred state only

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For ret_state:

  • RED_PROGRAM_SCHEDULER_STATE_STOPPED = 0
  • RED_PROGRAM_SCHEDULER_STATE_RUNNING = 1
int red_continue_program_schedule(RED *red, uint16_t program_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_start_program(RED *red, uint16_t program_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_last_spawned_program_process(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_process_id, uint64_t *ret_timestamp)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_process_id – Type: uint16_t, Range: [0 to 216 - 1]
  • ret_timestamp – Type: uint64_t, Range: [0 to 264 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_custom_program_option_names(RED *red, uint16_t program_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_names_list_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_names_list_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_set_custom_program_option_value(RED *red, uint16_t program_id, uint16_t name_string_id, uint16_t value_string_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • value_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_custom_program_option_value(RED *red, uint16_t program_id, uint16_t name_string_id, uint16_t session_id, uint8_t *ret_error_code, uint16_t *ret_value_string_id)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
  • session_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
  • ret_value_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_remove_custom_program_option(RED *red, uint16_t program_id, uint16_t name_string_id, uint8_t *ret_error_code)
Parameters:
  • red – Type: RED *
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • name_string_id – Type: uint16_t, Range: [0 to 216 - 1]
Output Parameters:
  • ret_error_code – Type: uint8_t, Range: See constants
Returns:
  • e_code – Type: int

The following constants are available for this function:

For ret_error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
int red_get_identity(RED *red, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier)
Parameters:
  • red – Type: RED *
Output Parameters:
  • ret_uid – Type: char[8]
  • ret_connected_uid – Type: char[8]
  • ret_position – Type: char, Range: ['0' to '8']
  • ret_hardware_version – Type: uint8_t[3]
    • 0: major – Type: uint8_t, Range: [0 to 255]
    • 1: minor – Type: uint8_t, Range: [0 to 255]
    • 2: revision – Type: uint8_t, Range: [0 to 255]
  • ret_firmware_version – Type: uint8_t[3]
    • 0: major – Type: uint8_t, Range: [0 to 255]
    • 1: minor – Type: uint8_t, Range: [0 to 255]
    • 2: revision – Type: uint8_t, Range: [0 to 255]
  • ret_device_identifier – Type: uint16_t, Range: [0 to 216 - 1]
Returns:
  • e_code – Type: int

Returns the UID, the UID where the Brick is connected to, the position, the hardware and firmware version as well as the device identifier.

The position is the position in the stack from '0' (bottom) to '8' (top).

The device identifier numbers can be found here. There is also a constant for the device identifier of this Brick.

Callback Configuration Functions

void red_register_callback(RED *red, int16_t callback_id, void (*function)(void), void *user_data)
Parameters:
  • red – Type: RED *
  • callback_id – Type: int16_t
  • function – Type: void (*)(void)
  • user_data – Type: void *

Registers the given function with the given callback_id. The user_data will be passed as the last parameter to the function.

The available callback IDs with corresponding function signatures are listed below.

Callbacks

Callbacks can be registered to receive time critical or recurring data from the device. The registration is done with the red_register_callback() function:

void my_callback(int value, void *user_data) {
    printf("Value: %d\n", value);
}

red_register_callback(&red,
                      RED_CALLBACK_EXAMPLE,
                      (void (*)(void))my_callback,
                      NULL);

The available constants with corresponding function signatures are described below.

Note

Using callbacks for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.

RED_CALLBACK_ASYNC_FILE_READ
void callback(uint16_t file_id, uint8_t error_code, uint8_t buffer[60], uint8_t length_read, void *user_data)
Callback Parameters:
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • error_code – Type: uint8_t, Range: See constants
  • buffer – Type: uint8_t[60], Range: [0 to 255]
  • length_read – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
  • user_data – Type: void *

This callback reports the result of a call to the red_read_file_async() function.

The following constants are available for this function:

For error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
RED_CALLBACK_ASYNC_FILE_WRITE
void callback(uint16_t file_id, uint8_t error_code, uint8_t length_written, void *user_data)
Callback Parameters:
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • error_code – Type: uint8_t, Range: See constants
  • length_written – Type: uint8_t, Unit: 1 B, Range: [0 to 255]
  • user_data – Type: void *

This callback reports the result of a call to the red_write_file_async() function.

The following constants are available for this function:

For error_code:

  • RED_ERROR_CODE_SUCCESS = 0
  • RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • RED_ERROR_CODE_INVALID_OPERATION = 2
  • RED_ERROR_CODE_OPERATION_ABORTED = 3
  • RED_ERROR_CODE_INTERNAL_ERROR = 4
  • RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • RED_ERROR_CODE_NO_MORE_DATA = 10
  • RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • RED_ERROR_CODE_INVALID_PARAMETER = 128
  • RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • RED_ERROR_CODE_NO_FREE_SPACE = 130
  • RED_ERROR_CODE_ACCESS_DENIED = 121
  • RED_ERROR_CODE_ALREADY_EXISTS = 132
  • RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • RED_ERROR_CODE_INTERRUPTED = 134
  • RED_ERROR_CODE_IS_DIRECTORY = 135
  • RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • RED_ERROR_CODE_WOULD_BLOCK = 137
  • RED_ERROR_CODE_OVERFLOW = 138
  • RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • RED_ERROR_CODE_OUT_OF_RANGE = 140
  • RED_ERROR_CODE_NAME_TOO_LONG = 141
  • RED_ERROR_CODE_INVALID_SEEK = 142
  • RED_ERROR_CODE_NOT_SUPPORTED = 143
  • RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
RED_CALLBACK_FILE_EVENTS_OCCURRED
void callback(uint16_t file_id, uint16_t events, void *user_data)
Callback Parameters:
  • file_id – Type: uint16_t, Range: [0 to 216 - 1]
  • events – Type: uint16_t, Range: See constants
  • user_data – Type: void *

The following constants are available for this function:

For events:

  • RED_FILE_EVENT_READABLE = 1
  • RED_FILE_EVENT_WRITABLE = 2
RED_CALLBACK_PROCESS_STATE_CHANGED
void callback(uint16_t process_id, uint8_t state, uint64_t timestamp, uint8_t exit_code, void *user_data)
Callback Parameters:
  • process_id – Type: uint16_t, Range: [0 to 216 - 1]
  • state – Type: uint8_t, Range: See constants
  • timestamp – Type: uint64_t, Range: [0 to 264 - 1]
  • exit_code – Type: uint8_t, Range: [0 to 255]
  • user_data – Type: void *

The following constants are available for this function:

For state:

  • RED_PROCESS_STATE_UNKNOWN = 0
  • RED_PROCESS_STATE_RUNNING = 1
  • RED_PROCESS_STATE_ERROR = 2
  • RED_PROCESS_STATE_EXITED = 3
  • RED_PROCESS_STATE_KILLED = 4
  • RED_PROCESS_STATE_STOPPED = 5
RED_CALLBACK_PROGRAM_SCHEDULER_STATE_CHANGED
void callback(uint16_t program_id, void *user_data)
Callback Parameters:
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • user_data – Type: void *
RED_CALLBACK_PROGRAM_PROCESS_SPAWNED
void callback(uint16_t program_id, void *user_data)
Callback Parameters:
  • program_id – Type: uint16_t, Range: [0 to 216 - 1]
  • user_data – Type: void *

Virtual Functions

Virtual functions don't communicate with the device itself, but operate only on the API bindings device object. They can be called without the corresponding IP Connection object being connected.

int red_get_api_version(RED *red, uint8_t ret_api_version[3])
Parameters:
  • red – Type: RED *
Output Parameters:
  • ret_api_version – Type: uint8_t[3]
    • 0: major – Type: uint8_t, Range: [0 to 255]
    • 1: minor – Type: uint8_t, Range: [0 to 255]
    • 2: revision – Type: uint8_t, Range: [0 to 255]
Returns:
  • e_code – Type: int

Returns the version of the API definition implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.

int red_get_response_expected(RED *red, uint8_t function_id, bool *ret_response_expected)
Parameters:
  • red – Type: RED *
  • function_id – Type: uint8_t, Range: See constants
Output Parameters:
  • ret_response_expected – Type: bool
Returns:
  • e_code – Type: int

Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.

For getter functions this is enabled by default and cannot be disabled, because those functions will always send a response. For callback configuration functions it is enabled by default too, but can be disabled by red_set_response_expected(). For setter functions it is disabled by default and can be enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.

The following constants are available for this function:

For function_id:

  • RED_FUNCTION_EXPIRE_SESSION_UNCHECKED = 3
  • RED_FUNCTION_RELEASE_OBJECT_UNCHECKED = 6
  • RED_FUNCTION_READ_FILE_ASYNC = 21
  • RED_FUNCTION_WRITE_FILE_UNCHECKED = 24
  • RED_FUNCTION_WRITE_FILE_ASYNC = 25
int red_set_response_expected(RED *red, uint8_t function_id, bool response_expected)
Parameters:
  • red – Type: RED *
  • function_id – Type: uint8_t, Range: See constants
  • response_expected – Type: bool
Returns:
  • e_code – Type: int

Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and callback configuration functions (default value: true). For getter functions it is always enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is sent and errors are silently ignored, because they cannot be detected.

The following constants are available for this function:

For function_id:

  • RED_FUNCTION_EXPIRE_SESSION_UNCHECKED = 3
  • RED_FUNCTION_RELEASE_OBJECT_UNCHECKED = 6
  • RED_FUNCTION_READ_FILE_ASYNC = 21
  • RED_FUNCTION_WRITE_FILE_UNCHECKED = 24
  • RED_FUNCTION_WRITE_FILE_ASYNC = 25
int red_set_response_expected_all(RED *red, bool response_expected)
Parameters:
  • red – Type: RED *
  • response_expected – Type: bool
Returns:
  • e_code – Type: int

Changes the response expected flag for all setter and callback configuration functions of this device at once.

Constants

RED_DEVICE_IDENTIFIER

This constant is used to identify a RED Brick.

The red_get_identity() function and the IPCON_CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

RED_DEVICE_DISPLAY_NAME

This constant represents the human readable name of a RED Brick.