46 #define EPROTO_LEN __einfo_error ( EINFO_EPROTO_LEN ) 47 #define EINFO_EPROTO_LEN __einfo_uniqify ( EINFO_EPROTO, 0x01, \ 48 "Incorrect reply length" ) 49 #define EPROTO_DATA __einfo_error ( EINFO_EPROTO_DATA ) 50 #define EINFO_EPROTO_DATA __einfo_uniqify ( EINFO_EPROTO, 0x02, \ 51 "Incorrect reply data" ) 52 #define EPROTO_SEQ __einfo_error ( EINFO_EPROTO_SEQ ) 53 #define EINFO_EPROTO_SEQ __einfo_uniqify ( EINFO_EPROTO, 0x03, \ 54 "Delayed or out-of-sequence reply" ) 105 bytes[i] = ( i & 0xff );
121 if (
bytes[i] != ( i & 0xff ) )
194 DBGC (
pinger,
"PINGER %p could not allocate I/O buffer\n",
209 DBGC (
pinger,
"PINGER %p could not transmit: %s\n",
239 DBGC (
pinger,
"PINGER %p received incorrect length %zd " 254 DBGC (
pinger,
"PINGER %p received sequence %d (expected %d)\n",
315 unsigned int sequence,
size_t len,
340 hostname,
NULL ) ) != 0 ) {
341 DBGC (
pinger,
"PINGER %p could not open socket: %s\n",
#define EINVAL
Invalid argument.
An object interface operation.
struct arbelprm_rc_send_wqe rc
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
void intf_close(struct interface *intf, int rc)
Close an object interface.
#define iob_put(iobuf, len)
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
struct refcnt refcnt
Reference count.
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
struct interface xfer
Data transfer interface.
#define XFER_FL_ABS_OFFSET
Offset is absolute.
#define ref_init(refcnt, free)
Initialise a reference counter.
static int pinger_deliver(struct pinger *pinger, struct io_buffer *iobuf, struct xfer_metadata *meta)
Handle received data.
size_t len
Payload length.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static void pinger_window_changed(struct pinger *pinger)
Handle data transfer window change.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
void(* callback)(struct sockaddr *src, unsigned int sequence, size_t len, int rc)
Callback function.
struct io_buffer * xfer_alloc_iob(struct interface *intf, size_t len)
Allocate I/O buffer.
int create_pinger(struct interface *job, const char *hostname, unsigned long timeout, size_t len, unsigned int count, void(*callback)(struct sockaddr *src, unsigned int sequence, size_t len, int rc))
Create pinger.
size_t xfer_window(struct interface *intf)
Check flow control window.
uint16_t sequence
Current sequence number.
static void pinger_expired(struct retry_timer *timer, int over __unused)
Handle timer expiry.
Data transfer interfaces.
#define ENOMEM
Not enough space.
static int pinger_verify(struct pinger *pinger, const void *data)
Verify payload.
#define __unused
Declare a variable or data structure as unused.
static struct interface_operation pinger_job_op[]
Pinger job control interface operations.
#define container_of(ptr, type, field)
Get containing structure.
struct interface job
Job control interface.
uint16_t count
Number of entries.
struct retry_timer timer
Timer.
static void pinger_close(struct pinger *pinger, int rc)
Close pinger.
Generalized socket address structure.
An object interface descriptor.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
char * strerror(int errno)
Retrieve string representation of error number.
void * zalloc(size_t size)
Allocate cleared memory.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static struct interface_operation pinger_xfer_op[]
Pinger data transfer interface operations.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Data transfer interface opening.
unsigned long timeout
Timeout.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
void stop_timer(struct retry_timer *timer)
Stop timer.
static void pinger_generate(struct pinger *pinger, void *data)
Generate payload.
void * data
Start of data.
uint8_t data[48]
Additional event data.
static struct interface_descriptor pinger_xfer_desc
Pinger data transfer interface descriptor.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
static struct interface_descriptor pinger_job_desc
Pinger job control interface descriptor.
unsigned int remaining
Number of remaining expiry events (zero to continue indefinitely)
int pending
Response for current sequence number is still pending.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
int xfer_open_named_socket(struct interface *xfer, int semantics, struct sockaddr *peer, const char *name, struct sockaddr *local)
Open named socket.
#define ref_put(refcnt)
Drop reference to object.
void * memset(void *dest, int character, size_t len) __nonnull