lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Fabrics::PassiveEndpoint Class Reference

Listening libfabric endpoint that accepts or rejects connection requests and keeps the Endpoints it accepted. More...

#include <Endpoint.hh>

Inherits Pds::Fabrics::EndpointBase.

Public Member Functions

 PassiveEndpoint (const char *addr, const char *port, uint64_t flags=0, Info *hints=0)
 Create a passive endpoint that owns a new Fabric for addr and port (FI_SOURCE is added to flags).
 
 ~PassiveEndpoint ()
 Call shutdown(), then delete all accepted endpoints.
 
void shutdown ()
 Shut down every accepted endpoint, close the passive endpoint and set the state to EP_INIT; queues and fabric are kept.
 
bool listen (int backlog=0)
 Open the passive endpoint, bind it to the event queue, try to set the backlog (FI_ENOSYS is ignored) and call fi_listen(); the state becomes EP_LISTEN.
 
bool listen (int backlog, uint16_t &port)
 Like listen(int), but first binds the endpoint to the address from getaddrinfo() (fi_setname) and afterwards stores the bound port in port.
 
Endpoint * accept (int timeout=-1, EventQueue *eq=0, CompletionQueue *txcq=0, uint64_t txFlags=0, CompletionQueue *rxcq=0, uint64_t rxFlags=0, void *context=NULL)
 Wait (with timeout) for a connection request, create an Endpoint on this fabric with the given queues and accept it (that handshake waits without timeout).
 
bool reject (int timeout=-1)
 Wait (with timeout) for a connection request and reject it with fi_reject(); returns false if not listening, if no request is read, or if the rejection fails.
 
bool close (Endpoint *endpoint)
 Remove endpoint from the accepted list and delete it if it is found; always returns true.
 
- Public Member Functions inherited from Pds::Fabrics::EndpointBase
State state () const
 Return the current endpoint State.
 
Fabric * fabric () const
 Return the Fabric used by this endpoint.
 
EventQueue * eq () const
 Return the event queue.
 
CompletionQueue * txcq () const
 Return the transmit completion queue.
 
CompletionQueue * rxcq () const
 Return the receive completion queue.
 
bool event (uint32_t *event, void *entry, bool *cm_entry)
 Read one event from the event queue without blocking (EventQueue::event()); returns false, copying the queue's error, if no event was read.
 
bool event_wait (uint32_t *event, void *entry, bool *cm_entry, int timeout=-1)
 Wait for one event on the event queue with the given timeout (EventQueue::event_wait()); returns false, copying the queue's error, if no event was read.
 
bool event_error (struct fi_eq_err_entry *entry)
 Read one error entry from the event queue into entry; returns false, copying the queue's error, if none could be read.
 
- Public Member Functions inherited from Pds::Fabrics::ErrorHandler
 ErrorHandler ()
 Allocate the message buffer and start with no error (FI_SUCCESS and a message built from the text None).
 
virtual ~ErrorHandler ()
 Free the message buffer.
 
int error_num () const
 Return the last recorded error number (FI_SUCCESS if none).
 
const char * error () const
 Return the last recorded error message.
 
void clear_error ()
 Reset the error number to FI_SUCCESS and the message to the no-error text.
 

Additional Inherited Members

- Protected Member Functions inherited from Pds::Fabrics::EndpointBase
 EndpointBase (const char *addr, const char *port, uint64_t flags=0, Info *hints=0)
 
 EndpointBase (Fabric *fabric, EventQueue *eq=0, CompletionQueue *txcq=0, CompletionQueue *rxcq=0)
 
virtual ~EndpointBase ()
 
bool handle_event (ssize_t event_ret, bool *cm_entry, const char *cmd)
 
bool initialize ()
 
- Protected Member Functions inherited from Pds::Fabrics::ErrorHandler
void set_custom_error (const char *fmt,...)
 
void set_error (const char *error_desc)
 
- Protected Attributes inherited from Pds::Fabrics::EndpointBase
State _state
 
const bool _fab_owner
 
bool _eq_owner
 
bool _txcq_owner
 
bool _rxcq_owner
 
Fabric * _fabric
 
EventQueue * _eq
 
CompletionQueue * _txcq
 
CompletionQueue * _rxcq
 
- Protected Attributes inherited from Pds::Fabrics::ErrorHandler
int _errno
 
char * _error
 

Detailed Description

Listening libfabric endpoint that accepts or rejects connection requests and keeps the Endpoints it accepted.

Constructor & Destructor Documentation

◆ PassiveEndpoint()

Pds::Fabrics::PassiveEndpoint::PassiveEndpoint ( const char *  addr,
const char *  port,
uint64_t  flags = 0,
Info *  hints = 0 
)

Create a passive endpoint that owns a new Fabric for addr and port (FI_SOURCE is added to flags).

◆ ~PassiveEndpoint()

Pds::Fabrics::PassiveEndpoint::~PassiveEndpoint ( )

Call shutdown(), then delete all accepted endpoints.

Member Function Documentation

◆ accept()

Endpoint * Pds::Fabrics::PassiveEndpoint::accept ( int  timeout = -1,
EventQueue *  eq = 0,
CompletionQueue *  txcq = 0,
uint64_t  txFlags = 0,
CompletionQueue *  rxcq = 0,
uint64_t  rxFlags = 0,
void *  context = NULL 
)

Wait (with timeout) for a connection request, create an Endpoint on this fabric with the given queues and accept it (that handshake waits without timeout).

Returns the new Endpoint, which this object keeps and later deletes, or NULL on failure; a failed accept rejects the request.

◆ close()

bool Pds::Fabrics::PassiveEndpoint::close ( Endpoint *  endpoint)

Remove endpoint from the accepted list and delete it if it is found; always returns true.

◆ listen() [1/2]

bool Pds::Fabrics::PassiveEndpoint::listen ( int  backlog,
uint16_t &  port 
)

Like listen(int), but first binds the endpoint to the address from getaddrinfo() (fi_setname) and afterwards stores the bound port in port.

◆ listen() [2/2]

bool Pds::Fabrics::PassiveEndpoint::listen ( int  backlog = 0)

Open the passive endpoint, bind it to the event queue, try to set the backlog (FI_ENOSYS is ignored) and call fi_listen(); the state becomes EP_LISTEN.

Returns false on failure.

◆ reject()

bool Pds::Fabrics::PassiveEndpoint::reject ( int  timeout = -1)

Wait (with timeout) for a connection request and reject it with fi_reject(); returns false if not listening, if no request is read, or if the rejection fails.

◆ shutdown()

void Pds::Fabrics::PassiveEndpoint::shutdown ( )
virtual

Shut down every accepted endpoint, close the passive endpoint and set the state to EP_INIT; queues and fabric are kept.

Reimplemented from Pds::Fabrics::EndpointBase.


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