/*
* A non-blocking copy of fr_conduit_read().
*/
-ssize_t fr_conduit_read_async(int fd, fr_conduit_type_t *pconduit, void *out, size_t outlen,
- size_t *leftover)
+ssize_t fr_conduit_read_async(int fd, fr_conduit_type_t *pconduit,
+ void *out, size_t outlen, size_t *leftover)
{
ssize_t r;
size_t data_len;
offset += r;
if (offset == outlen) {
- *pconduit = ntohl(hdr.conduit);
+ *pconduit = ntohs(hdr.conduit);
/*
* The other end can't set this.
/*
* Read the data into the buffer.
*/
- *pconduit = ntohl(hdr.conduit);
+ *pconduit = ntohs(hdr.conduit);
data_len = ntohl(hdr.length);
if (data_len == 0) return 0;
if (data_len > UINT32_MAX) data_len = UINT32_MAX; /* For Coverity */
return -1;
}
- hdr.conduit = htonl(conduit);
+ hdr.conduit = htons(conduit);
hdr.length = htonl(outlen);
#if 0
FR_CONDUIT_WANT_MORE,
} fr_conduit_type_t;
+typedef enum fr_conduit_origin_t {
+ FR_ORIGIN_SIGNAL = 0,
+ FR_ORIGIN_DEBUG,
+ FR_ORIGIN_WORKER,
+} fr_conduit_origin_t;
+
typedef enum fr_conduit_result_t {
FR_CONDUIT_FAIL = 0,
FR_CONDUIT_SUCCESS
} fr_cs_buffer_t;
typedef struct fr_conduit_hdr_t {
- uint32_t conduit;
+ uint16_t origin;
+ uint16_t conduit;
uint32_t length;
} fr_conduit_hdr_t;
fr_conduit_hdr_t *hdr = (fr_conduit_hdr_t *) buffer;
uint32_t magic;
- if (htonl(hdr->conduit) != FR_CONDUIT_INIT_ACK) {
+ if (htons(hdr->conduit) != FR_CONDUIT_INIT_ACK) {
DEBUG("ERROR: Connection is missing initial ACK packet.");
return -1;
}