fr_pair_unflatten(request->pair_list.reply);
} /* else noop */
- if (listen->app->encode) {
- slen = listen->app->encode(listen->app_instance, request,
- reply->m.data, reply->m.rb_size);
- } else if (listen->app_io->encode) {
+ if (listen->app_io->encode) {
slen = listen->app_io->encode(listen->app_io_instance, request,
reply->m.data, reply->m.rb_size);
+ } else if (listen->app->encode) {
+ slen = listen->app->encode(listen->app_instance, request,
+ reply->m.data, reply->m.rb_size);
}
if (slen < 0) {
RPERROR("Failed encoding request");
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_dhcpv4_t const *inst = talloc_get_type_abort_const(instance, proto_dhcpv4_t);
fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
dhcp_packet_t *reply = (dhcp_packet_t *) buffer;
COPY(xid);
MEMCPY(chaddr);
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
data_len = fr_dhcpv4_encode(buffer, buffer_len, original, request->reply->code,
ntohl(original->xid), &request->reply_pairs);
if (data_len < 0) {
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_dhcpv6_t const *inst = talloc_get_type_abort_const(instance, proto_dhcpv6_t);
fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
fr_dhcpv6_packet_t *reply = (fr_dhcpv6_packet_t *) buffer;
memset(buffer, 0, buffer_len);
memcpy(&reply->transaction_id, &original->transaction_id, sizeof(reply->transaction_id));
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
data_len = fr_dhcpv6_encode(&FR_DBUFF_TMP(buffer, buffer_len),
request->packet->data, request->packet->data_len,
request->reply->code, &request->reply_pairs);
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_dns_t const *inst = talloc_get_type_abort_const(instance, proto_dns_t);
// fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_dns_packet_t *reply = (fr_dns_packet_t *) buffer;
fr_dns_packet_t *original = (fr_dns_packet_t *) request->packet->data;
return -1;
}
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
packet_ctx.tmp_ctx = talloc(request, uint8_t);
packet_ctx.packet = buffer;
packet_ctx.packet_len = buffer_len;
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_radius_t const *inst = talloc_get_type_abort_const(instance, proto_radius_t);
fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
ssize_t data_len;
return sizeof(new_client);
}
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
/*
* Overwrite the src ip address on the outbound packet
* with the one specified by the client. This is useful
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_tacacs_t const *inst = talloc_get_type_abort_const(instance, proto_tacacs_t);
fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
ssize_t data_len;
return sizeof(new_client);
}
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
secret = client->secret;
if (secret) secretlen = talloc_array_length(client->secret) - 1;
return inst->io.app_io->decode(inst->io.app_io_instance, request, data, data_len);
}
-static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
+static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
{
- proto_vmps_t const *inst = talloc_get_type_abort_const(instance, proto_vmps_t);
fr_io_track_t *track = talloc_get_type_abort(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
ssize_t data_len;
return sizeof(new_client);
}
- /*
- * If the app_io encodes the packet, then we don't need
- * to do that.
- */
- if (inst->io.app_io->encode) {
- data_len = inst->io.app_io->encode(inst->io.app_io_instance, request, buffer, buffer_len);
- if (data_len > 0) return data_len;
- }
-
/*
* Overwrite the src ip address on the outbound packet
* with the one specified by the client. This is useful