Motr  M0
m0_net_tm_event Struct Reference

#include <net.h>

Collaboration diagram for m0_net_tm_event:
Collaboration graph

Data Fields

enum m0_net_tm_ev_type nte_type
 
struct m0_net_transfer_mcnte_tm
 
m0_time_t nte_time
 
int32_t nte_status
 
enum m0_net_tm_state nte_next_state
 
struct m0_net_end_pointnte_ep
 
void * nte_payload
 

Detailed Description

Data structure used to provide asynchronous notification of significant events, such as the completion of buffer operations, transfer machine state changes and general errors.

All events have the following fields set:

  • nte_type
  • nte_tm
  • nte_time
  • nte_status

The nte_type field should be referenced to determine the type of event, and which other fields of this structure get set:

  • M0_NET_TEV_ERROR provides error notification, out of the context of any buffer operation completion, or a transfer machine state change. No additional fields are set.
  • M0_NET_TEV_STATE_CHANGE provides notification of a transfer machine state change. The nte_next_state field describes the destination state. Refer to the nte_status field to determine if the operation succeeded. The nte_ep field is set if the next state is M0_NET_TM_STARTED; the value is used to set the ntm_ep field of the transfer machine.
  • M0_NET_TEV_DIAGNOSTIC provides diagnostic information. The nte_payload field may point to transport specific data. The API does not require nor specify how a transport produces diagnostic information, but does require that diagnostic events not be produced unless explicitly requested.

This data structure is typically allocated on the stack of the thread that invokes the m0_net_tm_event_post() subroutine. Applications should not attempt to save a reference to it from their callback functions.

See also
m0_net_tm_event_post() for details on event delivery concurrency.

Definition at line 686 of file net.h.

Field Documentation

◆ nte_ep

struct m0_net_end_point* nte_ep

End point pointer to be used to set the value of the ntm_ep field when the state changes to M0_NET_TM_STARTED.

Definition at line 729 of file net.h.

◆ nte_next_state

enum m0_net_tm_state nte_next_state

Valid only if the nte_type is M0_NET_TEV_STATE_CHANGE.

The next state of the transfer machine is set in this field. Any associated error condition defined by the nte_status field.

Definition at line 723 of file net.h.

◆ nte_payload

void* nte_payload

Valid only if the nte_type is M0_NET_TEV_STATE_DIAGNOSTIC.

Transports may use this to point to internal data; they could also choose to embed the event data structure in a transport specific structure appropriate to the event. Either approach would be of use to a diagnostic application.

Definition at line 739 of file net.h.

◆ nte_status

int32_t nte_status

Status or error code associated with the event.

In all event types other than M0_NET_TEV_DIAGNOSTIC, a 0 in this field implies successful completion, and a negative error number is used to indicate the reasons for failure. The following errors are well defined:

  • -ENOBUFS This indicates that the transfer machine lost messages due to a lack of receive buffers.

Diagnostic events are free to make any use of this field.

Definition at line 715 of file net.h.

◆ nte_time

m0_time_t nte_time

Time the event is posted.

Definition at line 701 of file net.h.

◆ nte_tm

struct m0_net_transfer_mc* nte_tm

Transfer machine pointer.

Definition at line 696 of file net.h.

◆ nte_type

enum m0_net_tm_ev_type nte_type

Indicates the type of event. Other fields get set depending on the value of this field.

Definition at line 691 of file net.h.


The documentation for this struct was generated from the following file: