API
All published payloads to and from the MQTT bindings are in JSON format.
If an error occures, the bindings publish a JSON object containing the error message as member _ERROR
.
It is published on the corresponding response topic: .../response/...
for .../request/...
and .../callback/...
for .../register/...
.
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. request/red_brick/<UID>/allocate_string
and request/red_brick/<UID>/get_next_directory_entry
) increase the reference count of the returned
object. If the object is no longer needed then request/red_brick/<UID>/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 request/red_brick/<UID>/release_object
must not be called for
such an object in response to a callback.
There are functions (e.g. request/red_brick/<UID>/get_file_info
) that only return valid objects
under certain conditions. This conditions are documented for the specific
functions. For invalid objects request/red_brick/<UID>/release_object
must not be called.
There are also function (e.g. request/red_brick/<UID>/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
-
request/
red_brick/
<UID>/
create_session
Request: | - lifetime – Type: int, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- session_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
expire_session
Request: | - session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
expire_session_unchecked
Request: | - session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | |
-
request/
red_brick/
<UID>/
keep_session_alive
Request: | - session_id – Type: int, Range: [0 to 216 - 1]
- lifetime – Type: int, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
release_object
Request: | - object_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
release_object_unchecked
Request: | - object_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | |
-
request/
red_brick/
<UID>/
allocate_string
Request: | - length_to_reserve – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
- buffer – Type: string, Length: up to 58
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- string_id – Type: int, Range: [0 to 216 - 1]
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
truncate_string
Request: | - string_id – Type: int, Range: [0 to 216 - 1]
- length – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
Truncates a string object to length
bytes and returns the resulting
error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_string_length
Request: | - string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- length – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
|
Returns the length of a string object and the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
set_string_chunk
Request: | - string_id – Type: int, Range: [0 to 216 - 1]
- offset – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
- buffer – Type: string, Length: up to 58
|
Response: | - error_code – Type: int, Range: See symbols
|
Sets a chunk of up to 58 bytes in a string object beginning at offset
.
Returns the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_string_chunk
Request: | - string_id – Type: int, Range: [0 to 216 - 1]
- offset – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- buffer – Type: string, Length: up to 63
|
Returns a chunk up to 63 bytes from a string object beginning at offset
and
returns the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
allocate_list
Request: | - length_to_reserve – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- list_id – Type: int, Range: [0 to 216 - 1]
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_list_length
Request: | - list_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- length – Type: int, Range: [0 to 216 - 1]
|
Returns the length of a list object in items and the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_list_item
Request: | - list_id – Type: int, Range: [0 to 216 - 1]
- index – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- item_object_id – Type: int, Range: [0 to 216 - 1]
- type – Type: int, Range: See symbols
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For type:
- "string" = 0
- "list" = 1
- "file" = 2
- "directory" = 3
- "process" = 4
- "program" = 5
-
request/
red_brick/
<UID>/
append_to_list
Request: | - list_id – Type: int, Range: [0 to 216 - 1]
- item_object_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
remove_from_list
Request: | - list_id – Type: int, Range: [0 to 216 - 1]
- index – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
open_file
Request: | - name_string_id – Type: int, Range: [0 to 216 - 1]
- flags – Type: int, Range: See symbols
- permissions – Type: int, Range: See symbols
- uid – Type: int, Range: [0 to 232 - 1]
- gid – Type: int, Range: [0 to 232 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- file_id – Type: int, Range: [0 to 216 - 1]
|
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 symbols are available for this function:
For flags:
- "read_only" = 1
- "write_only" = 2
- "read_write" = 4
- "append" = 8
- "create" = 16
- "exclusive" = 32
- "non_blocking" = 64
- "truncate" = 128
- "temporary" = 256
- "replace" = 512
For permissions:
- "user_all" = 448
- "user_read" = 256
- "user_write" = 128
- "user_execute" = 64
- "group_all" = 56
- "group_read" = 32
- "group_write" = 16
- "group_execute" = 8
- "others_all" = 7
- "others_read" = 4
- "others_write" = 2
- "others_execute" = 1
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
create_pipe
Request: | - flags – Type: int, Range: See symbols
- length – Type: int, Unit: 1 B, Range: [0 to 264 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- file_id – Type: int, Range: [0 to 216 - 1]
|
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 symbols are available for this function:
For flags:
- "non_blocking_read" = 1
- "non_blocking_write" = 2
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_file_info
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- type – Type: int, Range: See symbols
- name_string_id – Type: int, Range: [0 to 216 - 1]
- flags – Type: int, Range: See symbols
- permissions – Type: int, Range: See symbols
- uid – Type: int, Range: [0 to 232 - 1]
- gid – Type: int, Range: [0 to 232 - 1]
- length – Type: int, Unit: 1 B, Range: [0 to 264 - 1]
- access_timestamp – Type: int, Range: [0 to 264 - 1]
- modification_timestamp – Type: int, Range: [0 to 264 - 1]
- status_change_timestamp – Type: int, Range: [0 to 264 - 1]
|
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 request/red_brick/<UID>/open_file
.
The returned flags were used to open or create the file object, as passed to
request/red_brick/<UID>/open_file
or request/red_brick/<UID>/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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For type:
- "unknown" = 0
- "regular" = 1
- "directory" = 2
- "character" = 3
- "block" = 4
- "fifo" = 5
- "symlink" = 6
- "socket" = 7
- "pipe" = 8
For flags:
- "read_only" = 1
- "write_only" = 2
- "read_write" = 4
- "append" = 8
- "create" = 16
- "exclusive" = 32
- "non_blocking" = 64
- "truncate" = 128
- "temporary" = 256
- "replace" = 512
For permissions:
- "user_all" = 448
- "user_read" = 256
- "user_write" = 128
- "user_execute" = 64
- "group_all" = 56
- "group_read" = 32
- "group_write" = 16
- "group_execute" = 8
- "others_all" = 7
- "others_read" = 4
- "others_write" = 2
- "others_execute" = 1
-
request/
red_brick/
<UID>/
read_file
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- length_to_read – Type: int, Unit: 1 B, Range: [0 to 255]
|
Response: | - error_code – Type: int, Range: See symbols
- buffer – Type: [int, ...], Length: 62, Range: [0 to 255]
- length_read – Type: int, Unit: 1 B, Range: [0 to 255]
|
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 request/red_brick/<UID>/open_file
without the NonBlocking
flag or by request/red_brick/<UID>/create_pipe
without the NonBlockingRead flag then the
error code NotSupported is returned.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
read_file_async
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- length_to_read – Type: int, Unit: 1 B, Range: [0 to 264 - 1]
|
Response: | |
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 register/red_brick/<UID>/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 request/red_brick/<UID>/open_file
without the NonBlocking
flag or by request/red_brick/<UID>/create_pipe
without the NonBlockingRead flag then the error
code NotSupported is reported via the register/red_brick/<UID>/async_file_read
callback.
-
request/
red_brick/
<UID>/
abort_async_file_read
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
Aborts a request/red_brick/<UID>/read_file_async
operation in progress.
Returns the resulting error code.
On success the register/red_brick/<UID>/async_file_read
callback will report OperationAborted.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
write_file
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- buffer – Type: [int, ...], Length: 61, Range: [0 to 255]
- length_to_write – Type: int, Unit: 1 B, Range: [0 to 255]
|
Response: | - error_code – Type: int, Range: See symbols
- length_written – Type: int, Unit: 1 B, Range: [0 to 255]
|
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 request/red_brick/<UID>/open_file
without the NonBlocking
flag or by request/red_brick/<UID>/create_pipe
without the NonBlockingWrite flag then the
error code NotSupported is returned.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
write_file_unchecked
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- buffer – Type: [int, ...], Length: 61, Range: [0 to 255]
- length_to_write – Type: int, Unit: 1 B, Range: [0 to 255]
|
Response: | |
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 request/red_brick/<UID>/open_file
without the NonBlocking
flag or by request/red_brick/<UID>/create_pipe
without the NonBlockingWrite flag then the
write operation will fail silently.
-
request/
red_brick/
<UID>/
write_file_async
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- buffer – Type: [int, ...], Length: 61, Range: [0 to 255]
- length_to_write – Type: int, Unit: 1 B, Range: [0 to 255]
|
Response: | |
Writes up to 61 bytes to a file object.
Reports the actual number of bytes written and the resulting error code via the
register/red_brick/<UID>/async_file_write
callback.
If the file object was created by request/red_brick/<UID>/open_file
without the NonBlocking
flag or by request/red_brick/<UID>/create_pipe
without the NonBlockingWrite flag then the
error code NotSupported is reported via the register/red_brick/<UID>/async_file_write
callback.
-
request/
red_brick/
<UID>/
set_file_position
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- offset – Type: int, Unit: 1 B, Range: [-263 to 263 - 1]
- origin – Type: int, Range: See symbols
|
Response: | - error_code – Type: int, Range: See symbols
- position – Type: int, Unit: 1 B, Range: [0 to 264 - 1]
|
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 request/red_brick/<UID>/create_pipe
then it has no seek
position and the error code InvalidSeek is returned.
The following symbols are available for this function:
For origin:
- "beginning" = 0
- "current" = 1
- "end" = 2
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_file_position
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- position – Type: int, Unit: 1 B, Range: [0 to 264 - 1]
|
Returns the current seek position of a file object and returns the
resulting error code.
If the file object was created by request/red_brick/<UID>/create_pipe
then it has no seek
position and the error code InvalidSeek is returned.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
set_file_events
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
- events – Type: int, Range: See symbols
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For events:
- "readable" = 1
- "writable" = 2
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_file_events
Request: | - file_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- events – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For events:
- "readable" = 1
- "writable" = 2
-
request/
red_brick/
<UID>/
open_directory
Request: | - name_string_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- directory_id – Type: int, Range: [0 to 216 - 1]
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_directory_name
Request: | - directory_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- name_string_id – Type: int, Range: [0 to 216 - 1]
|
Returns the name of a directory object, as passed to request/red_brick/<UID>/open_directory
, and
the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_next_directory_entry
Request: | - directory_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- name_string_id – Type: int, Range: [0 to 216 - 1]
- type – Type: int, Range: See symbols
|
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 request/red_brick/<UID>/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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For type:
- "unknown" = 0
- "regular" = 1
- "directory" = 2
- "character" = 3
- "block" = 4
- "fifo" = 5
- "symlink" = 6
- "socket" = 7
-
request/
red_brick/
<UID>/
rewind_directory
Request: | - directory_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
Rewinds a directory object and returns the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
create_directory
Request: | - name_string_id – Type: int, Range: [0 to 216 - 1]
- flags – Type: int, Range: See symbols
- permissions – Type: int, Range: See symbols
- uid – Type: int, Range: [0 to 232 - 1]
- gid – Type: int, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
FIXME: name has to be absolute
The following symbols are available for this function:
For flags:
- "recursive" = 1
- "exclusive" = 2
For permissions:
- "user_all" = 448
- "user_read" = 256
- "user_write" = 128
- "user_execute" = 64
- "group_all" = 56
- "group_read" = 32
- "group_write" = 16
- "group_execute" = 8
- "others_all" = 7
- "others_read" = 4
- "others_write" = 2
- "others_execute" = 1
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_processes
Request: | - session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- processes_list_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
spawn_process
Request: | - executable_string_id – Type: int, Range: [0 to 216 - 1]
- arguments_list_id – Type: int, Range: [0 to 216 - 1]
- environment_list_id – Type: int, Range: [0 to 216 - 1]
- working_directory_string_id – Type: int, Range: [0 to 216 - 1]
- uid – Type: int, Range: [0 to 232 - 1]
- gid – Type: int, Range: [0 to 232 - 1]
- stdin_file_id – Type: int, Range: [0 to 216 - 1]
- stdout_file_id – Type: int, Range: [0 to 216 - 1]
- stderr_file_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- process_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
kill_process
Request: | - process_id – Type: int, Range: [0 to 216 - 1]
- signal – Type: int, Range: See symbols
|
Response: | - error_code – Type: int, Range: See symbols
|
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 symbols are available for this function:
For signal:
- "interrupt" = 2
- "quit" = 3
- "abort" = 6
- "kill" = 9
- "user1" = 10
- "user2" = 12
- "terminate" = 15
- "continue" = 18
- "stop" = 19
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_process_command
Request: | - process_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- executable_string_id – Type: int, Range: [0 to 216 - 1]
- arguments_list_id – Type: int, Range: [0 to 216 - 1]
- environment_list_id – Type: int, Range: [0 to 216 - 1]
- working_directory_string_id – Type: int, Range: [0 to 216 - 1]
|
Returns the executable, arguments, environment and working directory used to
spawn a process object, as passed to request/red_brick/<UID>/spawn_process
, and the resulting
error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_process_identity
Request: | - process_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- pid – Type: int, Range: [0 to 232 - 1]
- uid – Type: int, Range: [0 to 232 - 1]
- gid – Type: int, Range: [0 to 232 - 1]
|
Returns the process ID and the user and group ID used to spawn a process object,
as passed to request/red_brick/<UID>/spawn_process
, and the resulting error code.
The process ID is only valid if the state is Running or Stopped, see
request/red_brick/<UID>/get_process_state
.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_process_stdio
Request: | - process_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- stdin_file_id – Type: int, Range: [0 to 216 - 1]
- stdout_file_id – Type: int, Range: [0 to 216 - 1]
- stderr_file_id – Type: int, Range: [0 to 216 - 1]
|
Returns the stdin, stdout and stderr files used to spawn a process object, as
passed to request/red_brick/<UID>/spawn_process
, and the resulting error code.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_process_state
Request: | - process_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- state – Type: int, Range: See symbols
- timestamp – Type: int, Range: [0 to 264 - 1]
- exit_code – Type: int, Range: [0 to 255]
|
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 symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For state:
- "unknown" = 0
- "running" = 1
- "error" = 2
- "exited" = 3
- "killed" = 4
- "stopped" = 5
-
request/
red_brick/
<UID>/
get_programs
Request: | - session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- programs_list_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
define_program
Request: | - identifier_string_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- program_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
purge_program
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- cookie – Type: int, Range: [0 to 232 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_program_identifier
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- identifier_string_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_program_root_directory
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- root_directory_string_id – Type: int, Range: [0 to 216 - 1]
|
FIXME: root directory is absolute: <home>/programs/<identifier>
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
set_program_command
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- executable_string_id – Type: int, Range: [0 to 216 - 1]
- arguments_list_id – Type: int, Range: [0 to 216 - 1]
- environment_list_id – Type: int, Range: [0 to 216 - 1]
- working_directory_string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
FIXME: working directory is relative to <home>/programs/<identifier>/bin
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_program_command
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- executable_string_id – Type: int, Range: [0 to 216 - 1]
- arguments_list_id – Type: int, Range: [0 to 216 - 1]
- environment_list_id – Type: int, Range: [0 to 216 - 1]
- working_directory_string_id – Type: int, Range: [0 to 216 - 1]
|
FIXME: working directory is relative to <home>/programs/<identifier>/bin
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
set_program_stdio_redirection
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- stdin_redirection – Type: int, Range: See symbols
- stdin_file_name_string_id – Type: int, Range: [0 to 216 - 1]
- stdout_redirection – Type: int, Range: See symbols
- stdout_file_name_string_id – Type: int, Range: [0 to 216 - 1]
- stderr_redirection – Type: int, Range: See symbols
- stderr_file_name_string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
The following symbols are available for this function:
For stdin_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
For stdout_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
For stderr_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_program_stdio_redirection
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- stdin_redirection – Type: int, Range: See symbols
- stdin_file_name_string_id – Type: int, Range: [0 to 216 - 1]
- stdout_redirection – Type: int, Range: See symbols
- stdout_file_name_string_id – Type: int, Range: [0 to 216 - 1]
- stderr_redirection – Type: int, Range: See symbols
- stderr_file_name_string_id – Type: int, Range: [0 to 216 - 1]
|
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For stdin_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
For stdout_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
For stderr_redirection:
- "dev_null" = 0
- "pipe" = 1
- "file" = 2
- "individual_log" = 3
- "continuous_log" = 4
- "stdout" = 5
-
request/
red_brick/
<UID>/
set_program_schedule
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- start_mode – Type: int, Range: See symbols
- continue_after_error – Type: bool
- start_interval – Type: int, Range: [0 to 232 - 1]
- start_fields_string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For start_mode:
- "never" = 0
- "always" = 1
- "interval" = 2
- "cron" = 3
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_program_schedule
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- start_mode – Type: int, Range: See symbols
- continue_after_error – Type: bool
- start_interval – Type: int, Range: [0 to 232 - 1]
- start_fields_string_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For start_mode:
- "never" = 0
- "always" = 1
- "interval" = 2
- "cron" = 3
-
request/
red_brick/
<UID>/
get_program_scheduler_state
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- state – Type: int, Range: See symbols
- timestamp – Type: int, Range: [0 to 264 - 1]
- message_string_id – Type: int, Range: [0 to 216 - 1]
|
FIXME: message is currently valid in error-occurred state only
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
For state:
- "stopped" = 0
- "running" = 1
-
request/
red_brick/
<UID>/
continue_program_schedule
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
start_program
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_last_spawned_program_process
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- process_id – Type: int, Range: [0 to 216 - 1]
- timestamp – Type: int, Range: [0 to 264 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_custom_program_option_names
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- names_list_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
set_custom_program_option_value
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- name_string_id – Type: int, Range: [0 to 216 - 1]
- value_string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_custom_program_option_value
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- name_string_id – Type: int, Range: [0 to 216 - 1]
- session_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
- value_string_id – Type: int, Range: [0 to 216 - 1]
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
remove_custom_program_option
Request: | - program_id – Type: int, Range: [0 to 216 - 1]
- name_string_id – Type: int, Range: [0 to 216 - 1]
|
Response: | - error_code – Type: int, Range: See symbols
|
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
request/
red_brick/
<UID>/
get_identity
Request: | |
Response: | - uid – Type: string, Length: up to 8
- connected_uid – Type: string, Length: up to 8
- position – Type: char, Range: ["0" to "8"]
- hardware_version – Type: [int, ...], Length: 3
- 0: major – Type: int, Range: [0 to 255]
- 1: minor – Type: int, Range: [0 to 255]
- 2: revision – Type: int, Range: [0 to 255]
- firmware_version – Type: [int, ...], Length: 3
- 0: major – Type: int, Range: [0 to 255]
- 1: minor – Type: int, Range: [0 to 255]
- 2: revision – Type: int, Range: [0 to 255]
- device_identifier – Type: int, Range: [0 to 216 - 1]
- _display_name – Type: string
|
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.
If symbolic output is not disabled, the device identifier is mapped to the corresponding name in the format used in topics.
The display name contains the RED's name in a human readable form.
Callbacks
Callbacks can be registered to receive
time critical or recurring data from the device. The registration is done
with the corresponding .../register/...
topic and an optional suffix.
This suffix can be used to deregister the callback later.
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.
-
register/
red_brick/
<UID>/
async_file_read
Register Request: | |
Callback Response: | - file_id – Type: int, Range: [0 to 216 - 1]
- error_code – Type: int, Range: See symbols
- buffer – Type: [int, ...], Length: 60, Range: [0 to 255]
- length_read – Type: int, Unit: 1 B, Range: [0 to 255]
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/async_file_read[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/async_file_read[/<SUFFIX>]
topic for each registered suffix.
This callback reports the result of a call to the request/red_brick/<UID>/read_file_async
function.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
register/
red_brick/
<UID>/
async_file_write
Register Request: | |
Callback Response: | - file_id – Type: int, Range: [0 to 216 - 1]
- error_code – Type: int, Range: See symbols
- length_written – Type: int, Unit: 1 B, Range: [0 to 255]
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/async_file_write[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/async_file_write[/<SUFFIX>]
topic for each registered suffix.
This callback reports the result of a call to the request/red_brick/<UID>/write_file_async
function.
The following symbols are available for this function:
For error_code:
- "success" = 0
- "unknown_error" = 1
- "invalid_operation" = 2
- "operation_aborted" = 3
- "internal_error" = 4
- "unknown_session_id" = 5
- "no_free_session_id" = 6
- "unknown_object_id" = 7
- "no_free_object_id" = 8
- "object_is_locked" = 9
- "no_more_data" = 10
- "wrong_list_item_type" = 11
- "program_is_purged" = 12
- "invalid_parameter" = 128
- "no_free_memory" = 129
- "no_free_space" = 130
- "access_denied" = 121
- "already_exists" = 132
- "does_not_exist" = 133
- "interrupted" = 134
- "is_directory" = 135
- "not_a_directory" = 136
- "would_block" = 137
- "overflow" = 138
- "bad_file_descriptor" = 139
- "out_of_range" = 140
- "name_too_long" = 141
- "invalid_seek" = 142
- "not_supported" = 143
- "too_many_open_files" = 144
-
register/
red_brick/
<UID>/
file_events_occurred
Register Request: | |
Callback Response: | - file_id – Type: int, Range: [0 to 216 - 1]
- events – Type: int, Range: See symbols
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/file_events_occurred[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/file_events_occurred[/<SUFFIX>]
topic for each registered suffix.
The following symbols are available for this function:
For events:
- "readable" = 1
- "writable" = 2
-
register/
red_brick/
<UID>/
process_state_changed
Register Request: | |
Callback Response: | - process_id – Type: int, Range: [0 to 216 - 1]
- state – Type: int, Range: See symbols
- timestamp – Type: int, Range: [0 to 264 - 1]
- exit_code – Type: int, Range: [0 to 255]
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/process_state_changed[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/process_state_changed[/<SUFFIX>]
topic for each registered suffix.
The following symbols are available for this function:
For state:
- "unknown" = 0
- "running" = 1
- "error" = 2
- "exited" = 3
- "killed" = 4
- "stopped" = 5
-
register/
red_brick/
<UID>/
program_scheduler_state_changed
Register Request: | |
Callback Response: | - program_id – Type: int, Range: [0 to 216 - 1]
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/program_scheduler_state_changed[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/program_scheduler_state_changed[/<SUFFIX>]
topic for each registered suffix.
-
register/
red_brick/
<UID>/
program_process_spawned
Register Request: | |
Callback Response: | - program_id – Type: int, Range: [0 to 216 - 1]
|
A callback can be registered for this event by publishing to the .../register/red_brick/<UID>/program_process_spawned[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/red_brick/<UID>/program_process_spawned[/<SUFFIX>]
topic for each registered suffix.