|
Open Model Railroad Network (OpenMRN)
|
Console session metadata. More...
Public Member Functions | |
| Session (Service *service, int fd_in, int fd_out) | |
| Constructor. | |
| ~Session () | |
| Desctructor. | |
Public Member Functions inherited from StateFlowBase | |
| void | run () override |
| Callback from the executor. | |
| void | notify () override |
| Wakeup call arrived. | |
| Service * | service () |
| Return a pointer to the service I am bound to. | |
Public Member Functions inherited from Executable | |
| void | test_deletion () |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Private Member Functions | |
| StateFlowBase::Action | entry () |
| Entry point to the state machine. | |
| StateFlowBase::Action | process_read () |
| Process the incoming command line input. | |
| StateFlowBase::Action | exit_interactive () |
| Wait for completion of an interactive command in order to cleanup based on result. | |
| CommandStatus | callback (int argc, const char *argv[]) |
| Process a potential callback for a given command. | |
| void | prompt (FILE *fp) |
| Print the standard prompt. | |
| bool | callback_result_process (CommandStatus status, const char *name) |
| Process the result of the command callback. | |
| DISALLOW_COPY_AND_ASSIGN (Session) | |
Private Attributes | |
| int | fdIn |
| input file descriptor of the session | |
| int | fdOut |
| output file descriptor of the session | |
| FILE * | fp |
| file pointer of session | |
| char * | line |
| current line content | |
| size_t | line_size |
| current max line size | |
| size_t | pos |
| current line position | |
| const char * | args [MAX_ARGS] |
| parsed argument list | |
| StateFlowBase::StateFlowSelectHelper | selectHelper |
| metadata for waiting on the listen socket to become active | |
| Command * | command |
| Command instance that we are currently acting on. | |
Additional Inherited Members | |
Static Public Member Functions inherited from StateFlowBase | |
| template<class T , typename... Args> | |
| static void | invoke_subflow_and_ignore_result (FlowInterface< Buffer< T > > *target_flow, Args &&... args) |
| Calls a helper flow to perform some actions. | |
Protected Types inherited from StateFlowBase | |
| typedef Action(StateFlowBase::* | Callback) () |
| State Flow callback prototype. | |
Protected Member Functions inherited from StateFlowBase | |
| StateFlowBase (Service *service) | |
| Constructor. | |
| ~StateFlowBase () | |
| Destructor. | |
| void | reset_flow (Callback c) |
| Resets the flow to the specified state. | |
| bool | is_state (Callback c) |
| bool | is_terminated () |
| void | start_flow (Callback c) |
| Resets the flow to the specified state and starts it. | |
| Action | again () |
| Call the current state again via call_immediately. | |
| Action | exit () |
| Terminate current StateFlow activity. | |
| Action | delete_this () |
| Terminates the flow and deletes *this. | |
| Action | set_terminated () |
| Sets the flow to terminated state. | |
| Action | call_immediately (Callback c) |
| Imediately call the next state upon return. | |
| Action | wait () |
| Wait for an asynchronous call. | |
| Action | wait_and_call (Callback c) |
| Wait for resource to become available before proceeding to next state. | |
| template<class T > | |
| Action | allocate_and_call (FlowInterface< Buffer< T > > *target_flow, Callback c, Pool *pool=nullptr) |
| Allocates a buffer from a pool and proceed to the next state when allocation is successful. | |
| Action | allocate_and_call (Callback c, QAsync *queue) |
| Allocates an entry from an asynchronous queue, and transitions to a state once the allocation is complete. | |
| template<class T > | |
| Buffer< T > * | full_allocation_result (FlowInterface< Buffer< T > > *target_flow) |
| Takes the result of the asynchronous allocation without resetting the object. | |
| template<class T > | |
| T * | full_allocation_result (TypedQAsync< T > *queue) |
| Takes the result of the asynchronous allocation without resetting the object. | |
| template<class T > | |
| void | cast_allocation_result (T **member) |
| Takes the result of the asynchronous allocation without resetting the object. | |
| template<class T > | |
| Buffer< T > * | get_allocation_result (FlowInterface< Buffer< T > > *target_flow) |
| Takes the result of the asynchronous allocation. | |
| Action | yield_and_call (Callback c) |
| Place the current flow to the back of the executor, and transition to a new state after we get the CPU again. | |
| Action | yield () |
| Place the current flow to the back of the executor, and re-try the current state after we get the CPU again. | |
| Action | sleep_and_call (::Timer *timer, long long timeout_nsec, Callback c) |
| Suspends execution of this control flow for a specified time. | |
| template<class T , typename... Args> | |
| Action | invoke_subflow_and_wait (FlowInterface< Buffer< T > > *target_flow, Callback c, Args &&... args) |
| Calls a helper flow to perform some actions. | |
| Action | read_repeated (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| Blocks until size bytes are read and then invokes the next state. | |
| Action | read_single (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| Attempts to read at most size_t bytes, and blocks the caller until at least one byte is read. | |
| Action | read_nonblocking (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| Attempts to read at most size bytes, and then invokes the next state, even if only zero bytes are available right now. | |
| Action | read_repeated_with_timeout (StateFlowTimedSelectHelper *helper, long long timeout_nsec, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| Blocks until size bytes are read, or a timeout expires. | |
| Action | internal_try_read () |
| Implementation state that gets repeatedly called upon every wakeup and tries to make progress on reading. | |
| Action | write_repeated (StateFlowSelectHelper *helper, int fd, const void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| Writes some data into a file descriptor, repeating the operation as necessary until all bytes are written. | |
| Action | internal_try_write () |
| Implementation state that gets repeatedly called upon every wakeup and tries to make progress on writing. | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Console session metadata.
Definition at line 353 of file Console.hxx.
| Console::Session::Session | ( | Service * | service, |
| int | fd_in, | ||
| int | fd_out | ||
| ) |
Constructor.
| service | service instance that this session belongs to |
| fd_in | input file descriptor for the session |
| fd_out | output file descriptor for the session |
Definition at line 260 of file Console.cxx.
|
inline |
Desctructor.
Definition at line 365 of file Console.hxx.
|
private |
Process a potential callback for a given command.
| argc | number of arguments including the command itself |
| argv | array of arguments starting with the command itself |
Definition at line 379 of file Console.cxx.
|
private |
Process the result of the command callback.
| status | the result of running a command |
| name | name of the command itself |
Definition at line 428 of file Console.cxx.
|
inlineprivate |
Entry point to the state machine.
Read some command line input.
Definition at line 382 of file Console.hxx.
|
private |
Wait for completion of an interactive command in order to cleanup based on result.
Definition at line 408 of file Console.cxx.
|
private |
Process the incoming command line input.
Definition at line 278 of file Console.cxx.
|
inlineprivate |
Print the standard prompt.
| fp | FILE pointer to send prompt to |
Definition at line 410 of file Console.hxx.
|
private |
parsed argument list
Definition at line 429 of file Console.hxx.
|
private |
Command instance that we are currently acting on.
Definition at line 435 of file Console.hxx.
|
private |
input file descriptor of the session
Definition at line 423 of file Console.hxx.
|
private |
output file descriptor of the session
Definition at line 424 of file Console.hxx.
|
private |
file pointer of session
Definition at line 425 of file Console.hxx.
|
private |
current line content
Definition at line 426 of file Console.hxx.
|
private |
current max line size
Definition at line 427 of file Console.hxx.
|
private |
current line position
Definition at line 428 of file Console.hxx.
|
private |
metadata for waiting on the listen socket to become active
Definition at line 432 of file Console.hxx.