return 0;
}
-static int mschapv1_encode(RADIUS_PACKET *packet, fr_pair_t **request,
+static int mschapv1_encode(fr_radius_packet_t *packet, fr_pair_t **request,
char const *password)
{
unsigned int i;
fd_set set;
fr_time_delta_t our_wait_time;
rc_request_t *request;
- RADIUS_PACKET *reply, **packet_p;
+ fr_radius_packet_t *reply, **packet_p;
volatile int max_fd;
/* And wait for reply, timing out as necessary */
fr_pair_t *password; //!< Cleartext-Password
fr_time_delta_t timestamp;
- RADIUS_PACKET *packet; //!< The outgoing request.
- RADIUS_PACKET *reply; //!< The incoming response.
+ fr_radius_packet_t *packet; //!< The outgoing request.
+ fr_radius_packet_t *reply; //!< The incoming response.
fr_pair_t *filter; //!< If the reply passes the filter, then the request passes.
FR_CODE filter_code; //!< Expected code of the response packet.
fprintf(stdout , "%s\n", buffer);
}
-static void rs_packet_print_csv(uint64_t count, rs_status_t status, fr_pcap_t *handle, RADIUS_PACKET *packet,
+static void rs_packet_print_csv(uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_radius_packet_t *packet,
UNUSED struct timeval *elapsed, struct timeval *latency, UNUSED bool response,
bool body)
{
fprintf(stdout , "%s\n", buffer);
}
-static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t *handle, RADIUS_PACKET *packet,
+static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_radius_packet_t *packet,
struct timeval *elapsed, struct timeval *latency, bool response, bool body)
{
char buffer[2048];
}
static inline void rs_packet_print(rs_request_t *request, uint64_t count, rs_status_t status, fr_pcap_t *handle,
- RADIUS_PACKET *packet, struct timeval *elapsed, struct timeval *latency,
+ fr_radius_packet_t *packet, struct timeval *elapsed, struct timeval *latency,
bool response, bool body)
{
if (!conf->logger) return;
static void rs_packet_cleanup(rs_request_t *request)
{
- RADIUS_PACKET *packet = request->packet;
+ fr_radius_packet_t *packet = request->packet;
uint64_t count = request->id;
RS_ASSERT(request->stats_req);
static uint64_t captured = 0;
rs_status_t status = RS_NORMAL; /* Any special conditions (RTX, Unlinked, ID-Reused) */
- RADIUS_PACKET *packet; /* Current packet were processing */
+ fr_radius_packet_t *packet; /* Current packet were processing */
rs_request_t *original = NULL;
rs_request_t search;
RS_LOST = 0x20
} rs_status_t;
-typedef void (*rs_packet_logger_t)(uint64_t count, rs_status_t status, fr_pcap_t *handle, RADIUS_PACKET *packet,
+typedef void (*rs_packet_logger_t)(uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_radius_packet_t *packet,
struct timeval *elapsed, struct timeval *latency, bool response, bool body);
typedef enum {
#ifdef HAVE_COLLECTDC_H
uint8_t *data; //!< PCAP packet data.
} rs_capture_t;
-/** Wrapper for RADIUS_PACKET
+/** Wrapper for fr_radius_packet_t
*
* Allows an event to be associated with a request packet. This is required because we need to disarm
* the event timer when a response is received, so we don't erroneously log the response as lost.
struct timeval when; //!< Time when the packet was received, or next time an event
//!< is scheduled.
fr_pcap_t *in; //!< PCAP handle the original request was received on.
- RADIUS_PACKET *packet; //!< The original packet.
- RADIUS_PACKET *expect; //!< Request/response.
- RADIUS_PACKET *linked; //!< The subsequent response or forwarded request the packet
+ fr_radius_packet_t *packet; //!< The original packet.
+ fr_radius_packet_t *expect; //!< Request/response.
+ fr_radius_packet_t *linked; //!< The subsequent response or forwarded request the packet
//!< was linked against.
* @param fd the request will be sent on.
* @return new request.
*/
-static RADIUS_PACKET *radsnmp_alloc(radsnmp_conf_t *conf, int fd)
+static fr_radius_packet_t *radsnmp_alloc(radsnmp_conf_t *conf, int fd)
{
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
packet = fr_radius_alloc(conf, true);
fr_cursor_t cursor;
fr_pair_t *vp;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
/*
* Alloc a new packet so we can start adding
* Send the packet
*/
{
- RADIUS_PACKET *reply = NULL;
+ fr_radius_packet_t *reply = NULL;
ssize_t rcode;
fd_set set;
}
-static void print_packet(FILE *fp, RADIUS_PACKET *packet)
+static void print_packet(FILE *fp, fr_radius_packet_t *packet)
{
fr_pair_t *vp;
fr_cursor_t cursor;
{ NULL }
};
-fr_pair_t *eap_packet_to_vp(RADIUS_PACKET *packet, eap_packet_raw_t const *eap)
+fr_pair_t *eap_packet_to_vp(fr_radius_packet_t *packet, eap_packet_raw_t const *eap)
{
int total, size;
uint8_t const *ptr;
/*
* interfaces in eapcommon.c
*/
-fr_pair_t *eap_packet_to_vp(RADIUS_PACKET *packet, eap_packet_raw_t const *reply);
+fr_pair_t *eap_packet_to_vp(fr_radius_packet_t *packet, eap_packet_raw_t const *reply);
eap_packet_raw_t *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_t *vps);
void eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len);
return packet;
}
-fr_pair_t *eap_chbind_packet2vp(RADIUS_PACKET *packet, chbind_packet_t *chbind)
+fr_pair_t *eap_chbind_packet2vp(fr_radius_packet_t *packet, chbind_packet_t *chbind)
{
fr_pair_t *vp;
/* Channel binding function prototypes */
FR_CODE chbind_process(request_t *request, CHBIND_REQ *chbind_req);
-fr_pair_t *eap_chbind_packet2vp(RADIUS_PACKET *packet, chbind_packet_t *chbind);
+fr_pair_t *eap_chbind_packet2vp(fr_radius_packet_t *packet, chbind_packet_t *chbind);
chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_t *vps);
/*
* Debug the packet if requested.
*/
-void common_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received)
+void common_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received)
{
#if defined(WITH_UDPFROMTO) && defined(WITH_IFINDEX_NAME_RESOLUTION)
char if_name[IFNAMSIZ];
typedef int (*rad_listen_send_t)(rad_listen_t *, request_t *);
typedef int (*rad_listen_error_t)(rad_listen_t *, int);
typedef int (*rad_listen_print_t)(rad_listen_t const *, char *, size_t);
-typedef void (*rad_listen_debug_t)(request_t *, RADIUS_PACKET *, bool received);
+typedef void (*rad_listen_debug_t)(request_t *, fr_radius_packet_t *, bool received);
typedef int (*rad_listen_encode_t)(rad_listen_t *, request_t *);
typedef int (*rad_listen_decode_t)(rad_listen_t *, request_t *);
struct listen_socket_t *parent;
RADCLIENT *client;
- RADIUS_PACKET *packet; /* for reading partial packets */
+ fr_radius_packet_t *packet; /* for reading partial packets */
#if 0
fr_tls_session_t *tls_session;
INFO("Starting - reading configuration files ...");
/*
- * About sizeof(request_t) + sizeof(RADIUS_PACKET) * 2 + sizeof(fr_pair_t) * 400
+ * About sizeof(request_t) + sizeof(fr_radius_packet_t) * 2 + sizeof(fr_pair_t) * 400
*
* Which should be enough for many configurations.
*/
/*
* Debug the packet if requested.
*/
-void common_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received)
+void common_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received)
{
#if defined(WITH_UDPFROMTO) && defined(WITH_IFINDEX_NAME_RESOLUTION)
char if_name[IFNAMSIZ];
int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this);
int common_socket_open(CONF_SECTION *cs, rad_listen_t *this);
int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize);
-void common_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received);
+void common_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received);
/** Struct exported by a proto_* module
*
2 + /* packets */
10, /* extra */
(UNLANG_FRAME_PRE_ALLOC * UNLANG_STACK_MAX) + /* Stack memory */
- (sizeof(RADIUS_PACKET) * 2) + /* packets */
+ (sizeof(fr_radius_packet_t) * 2) + /* packets */
128 /* extra */
));
talloc_set_destructor(request, _request_free);
/*
* Verify a packet.
*/
-static void packet_verify(char const *file, int line, request_t const *request, RADIUS_PACKET const *packet, char const *type)
+static void packet_verify(char const *file, int line, request_t const *request, fr_radius_packet_t const *packet, char const *type)
{
TALLOC_CTX *parent;
- fr_fatal_assert_msg(packet, "CONSISTENCY CHECK FAILED %s[%i]: RADIUS_PACKET %s pointer was NULL",
+ fr_fatal_assert_msg(packet, "CONSISTENCY CHECK FAILED %s[%i]: fr_radius_packet_t %s pointer was NULL",
file, line, type);
parent = talloc_parent(packet);
if (parent) fr_log_talloc_report(parent);
- fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%i]: Expected RADIUS_PACKET %s to be parented "
+ fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%i]: Expected fr_radius_packet_t %s to be parented "
"by %p (%s), but parented by %p (%s)",
file, line, type, request, talloc_get_name(request),
parent, parent ? talloc_get_name(parent) : "NULL");
rad_listen_t *listener; //!< The listener that received the request.
RADCLIENT *client; //!< The client that originally sent us the request.
- RADIUS_PACKET *packet; //!< Incoming request.
- RADIUS_PACKET *reply; //!< Outgoing response.
+ fr_radius_packet_t *packet; //!< Incoming request.
+ fr_radius_packet_t *reply; //!< Outgoing response.
fr_pair_t *control; //!< #fr_pair_t (s) used to set per request parameters
//!< for modules and the server core at runtime.
* @note Called with the mutex held.
*/
static fr_state_entry_t *state_entry_create(fr_state_tree_t *state, request_t *request,
- RADIUS_PACKET *packet, fr_state_entry_t *old)
+ fr_radius_packet_t *packet, fr_state_entry_t *old)
{
size_t i;
uint32_t x;
*/
RCSIDH(tcp_h, "$Id$")
-int fr_tcp_read_packet(RADIUS_PACKET *packet, uint32_t max_attributes, bool require_ma);
-RADIUS_PACKET *fr_tcp_recv(int sockfd, int flags);
+int fr_tcp_read_packet(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma);
+fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags);
fr_pair_t **radius_list(request_t *request, pair_list_t list);
-RADIUS_PACKET *radius_packet(request_t *request, pair_list_t list_name);
+fr_radius_packet_t *radius_packet(request_t *request, pair_list_t list_name);
TALLOC_CTX *radius_list_ctx(request_t *request, pair_list_t list_name);
return NULL;
}
-/** Resolve a list to the #RADIUS_PACKET holding the HEAD pointer for a #fr_pair_t list
+/** Resolve a list to the #fr_radius_packet_t holding the HEAD pointer for a #fr_pair_t list
*
- * Returns a pointer to the #RADIUS_PACKET that holds the HEAD pointer of a given list,
+ * Returns a pointer to the #fr_radius_packet_t that holds the HEAD pointer of a given list,
* for the current #request_t.
*
* @param[in] request To resolve list in.
- * @param[in] list #pair_list_t value to resolve to #RADIUS_PACKET.
+ * @param[in] list #pair_list_t value to resolve to #fr_radius_packet_t.
* @return
- * - #RADIUS_PACKET on success.
+ * - #fr_radius_packet_t on success.
* - NULL on failure.
*
* @see radius_list
*/
-RADIUS_PACKET *radius_packet(request_t *request, pair_list_t list)
+fr_radius_packet_t *radius_packet(request_t *request, pair_list_t list)
{
switch (list) {
/* Don't add default */
/** Return the correct TALLOC_CTX to alloc #fr_pair_t in, for a list
*
* Allocating new #fr_pair_t in the context of a #request_t is usually wrong.
- * #fr_pair_t should be allocated in the context of a #RADIUS_PACKET, so that if the
- * #RADIUS_PACKET is freed before the #request_t, the associated #fr_pair_t lists are
+ * #fr_pair_t should be allocated in the context of a #fr_radius_packet_t, so that if the
+ * #fr_radius_packet_t is freed before the #request_t, the associated #fr_pair_t lists are
* freed too.
*
* @param[in] request containing the target lists.
*/
static xlat_action_t xlat_eval_pair_virtual(TALLOC_CTX *ctx, fr_cursor_t *out, request_t *request, tmpl_t const *vpt)
{
- RADIUS_PACKET *packet = NULL;
+ fr_radius_packet_t *packet = NULL;
fr_value_box_t *value;
/*
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-/** RADIUS_PACKET alloc/free functions
+/** fr_radius_packet_t alloc/free functions
*
* @file src/lib/util/packet.c
*
#include <talloc.h>
-/** Allocate a new RADIUS_PACKET
+/** Allocate a new fr_radius_packet_t
*
* @param ctx the context in which the packet is allocated. May be NULL if
* the packet is not associated with a request_t.
* @param new_vector if true a new request authenticator will be generated.
* @return
- * - New RADIUS_PACKET.
+ * - New fr_radius_packet_t.
* - NULL on error.
*/
-RADIUS_PACKET *fr_radius_alloc(TALLOC_CTX *ctx, bool new_vector)
+fr_radius_packet_t *fr_radius_alloc(TALLOC_CTX *ctx, bool new_vector)
{
- RADIUS_PACKET *rp;
+ fr_radius_packet_t *rp;
- rp = talloc_zero(ctx, RADIUS_PACKET);
+ rp = talloc_zero(ctx, fr_radius_packet_t);
if (!rp) {
fr_strerror_printf("out of memory");
return NULL;
return rp;
}
-/** Allocate a new RADIUS_PACKET response
+/** Allocate a new fr_radius_packet_t response
*
* @param ctx the context in which the packet is allocated. May be NULL if
* the packet is not associated with a request_t.
* @param packet The request packet.
* @return
- * - New RADIUS_PACKET.
+ * - New fr_radius_packet_t.
* - NULL on error.
*/
-RADIUS_PACKET *fr_radius_alloc_reply(TALLOC_CTX *ctx, RADIUS_PACKET *packet)
+fr_radius_packet_t *fr_radius_alloc_reply(TALLOC_CTX *ctx, fr_radius_packet_t *packet)
{
- RADIUS_PACKET *reply;
+ fr_radius_packet_t *reply;
if (!packet) return NULL;
}
-/** Free a RADIUS_PACKET
+/** Free a fr_radius_packet_t
*
*/
-void fr_radius_packet_free(RADIUS_PACKET **packet_p)
+void fr_radius_packet_free(fr_radius_packet_t **packet_p)
{
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
if (!packet_p || !*packet_p) return;
packet = *packet_p;
#include <freeradius-devel/util/time.h>
#ifdef WITH_VERIFY_PTR
-# define PACKET_VERIFY(_x) (void) talloc_get_type_abort_const(_x, RADIUS_PACKET)
+# define PACKET_VERIFY(_x) (void) talloc_get_type_abort_const(_x, fr_radius_packet_t)
#else
# define PACKET_VERIFY(_x) fr_cond_assert(_x)
#endif
/*
* vector: Request authenticator from access-request packet
* Put in there by rad_decode, and must be put in the
- * response RADIUS_PACKET as well before calling fr_radius_packet_send
+ * response fr_radius_packet_t as well before calling fr_radius_packet_send
*
* verified: Filled in by rad_decode for accounting-request packets
*
uint32_t rounds; //!< for State[0]
size_t partial;
-} RADIUS_PACKET;
+} fr_radius_packet_t;
-RADIUS_PACKET *fr_radius_alloc(TALLOC_CTX *ctx, bool new_vector);
-RADIUS_PACKET *fr_radius_alloc_reply(TALLOC_CTX *ctx, RADIUS_PACKET *);
-void fr_radius_packet_free(RADIUS_PACKET **);
+fr_radius_packet_t *fr_radius_alloc(TALLOC_CTX *ctx, bool new_vector);
+fr_radius_packet_t *fr_radius_alloc_reply(TALLOC_CTX *ctx, fr_radius_packet_t *);
+void fr_radius_packet_free(fr_radius_packet_t **);
#ifdef __cplusplus
}
*
* @note Doesn't require qualification with a dictionary as fr_dict_attr_t are unique.
*
- * @param[in] ctx for allocated memory, usually a pointer to a #RADIUS_PACKET
+ * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t
* @param[in] da Specifies the dictionary attribute to build the #fr_pair_t from.
* @return
* - A new #fr_pair_t.
* Which type of #fr_dict_attr_t the #fr_pair_t was created with can be determined by
* checking @verbatim vp->da->flags.is_unknown @endverbatim.
*
- * @param[in] ctx for allocated memory, usually a pointer to a #RADIUS_PACKET.
+ * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t.
* @param[in] parent of the attribute being allocated (usually a dictionary or vendor).
* @param[in] attr number.
* @return
* Which type of #fr_dict_attr_t the #fr_pair_t was created with can be determined by
* checking @verbatim vp->da->flags.is_unknown @endverbatim.
*
- * @param[in] ctx for allocated memory, usually a pointer to a #RADIUS_PACKET.
+ * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t.
* @param[in] attr number.
* @param[in] vendor number.
* @return
};
-static void bfd_request(bfd_state_t *session, request_t *request, RADIUS_PACKET *packet)
+static void bfd_request(bfd_state_t *session, request_t *request, fr_radius_packet_t *packet)
{
memset(request, 0, sizeof(*request));
memset(packet, 0, sizeof(*packet));
static void bfd_trigger(bfd_state_t *session)
{
- RADIUS_PACKET packet;
+ fr_radius_packet_t packet;
request_t request;
char buffer[256];
* Warn about it.
*/
if ((session->detect_multi >= 2) && (session->last_recv > session->next_recv)) {
- RADIUS_PACKET packet;
+ fr_radius_packet_t packet;
request_t request;
bfd_request(session, &request, &packet);
if (session->server_cs) {
request_t *request;
- RADIUS_PACKET *packet, *reply;
+ fr_radius_packet_t *packet, *reply;
request = request_alloc(session);
packet = fr_radius_alloc(request, 0);
/*
* Initialize the request.
*/
-static RADIUS_PACKET *request_init(char const *filename)
+static fr_radius_packet_t *request_init(char const *filename)
{
FILE *fp;
fr_cursor_t cursor;
fr_pair_t *vp;
bool filedone = false;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
/*
* Determine where to read the VP's from.
return packet;
}
-static void print_hex(RADIUS_PACKET *packet)
+static void print_hex(fr_radius_packet_t *packet)
{
int i, j;
uint8_t const *p, *a;
* We'll just return the first eligible reply, and display the others.
*/
#if defined(HAVE_LINUX_IF_PACKET_H) || defined (HAVE_LIBPCAP)
-static RADIUS_PACKET *fr_dhcpv4_recv_raw_loop(int lsockfd,
+static fr_radius_packet_t *fr_dhcpv4_recv_raw_loop(int lsockfd,
#ifdef HAVE_LINUX_IF_PACKET_H
struct sockaddr_ll *p_ll,
#endif
- RADIUS_PACKET *packet_p)
+ fr_radius_packet_t *packet_p)
{
fr_time_delta_t our_timeout;
- RADIUS_PACKET *found = NULL;
- RADIUS_PACKET *reply = NULL;
+ fr_radius_packet_t *found = NULL;
+ fr_radius_packet_t *reply = NULL;
int nb_reply = 0;
int nb_offer = 0;
dc_offer_t *offer_list = NULL;
}
#endif /* <if/packet.h> or <pcap.h> */
-static int send_with_socket(RADIUS_PACKET **reply, RADIUS_PACKET *packet)
+static int send_with_socket(fr_radius_packet_t **reply, fr_radius_packet_t *packet)
{
int on = 1;
}
#ifdef HAVE_LIBPCAP
-static int send_with_pcap(RADIUS_PACKET **reply, RADIUS_PACKET *packet)
+static int send_with_pcap(fr_radius_packet_t **reply, fr_radius_packet_t *packet)
{
char ip[16];
char pcap_filter[255];
}
#endif /* HAVE_LIBPCAP */
-static void dhcp_packet_debug(RADIUS_PACKET *packet, bool received)
+static void dhcp_packet_debug(fr_radius_packet_t *packet, bool received)
{
fr_cursor_t cursor;
char buffer[2048];
char const *dict_dir = DICTDIR;
char const *filename = NULL;
- RADIUS_PACKET *packet = NULL;
- RADIUS_PACKET *reply = NULL;
+ fr_radius_packet_t *packet = NULL;
+ fr_radius_packet_t *reply = NULL;
TALLOC_CTX *autofree;
fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
RADCLIENT const *client;
- RADIUS_PACKET *packet = request->packet;
+ fr_radius_packet_t *packet = request->packet;
fr_cursor_t cursor;
/*
/*
* Debug the packet if requested.
*/
-static void dhcpv4_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received)
+static void dhcpv4_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received)
{
int i;
#if defined(WITH_UDPFROMTO) && defined(WITH_IFINDEX_NAME_RESOLUTION)
fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
RADCLIENT const *client;
- RADIUS_PACKET *packet = request->packet;
+ fr_radius_packet_t *packet = request->packet;
fr_cursor_t cursor;
/*
/*
* Debug the packet if requested.
*/
-static void dhcpv6_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received)
+static void dhcpv6_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received)
{
#if defined(WITH_UDPFROMTO) && defined(WITH_IFINDEX_NAME_RESOLUTION)
char if_name[IFNAMSIZ];
{ NULL }
};
-static request_t *request_setup(UNUSED TALLOC_CTX *ctx, UNUSED rad_listen_t *listener, UNUSED RADIUS_PACKET *packet,
+static request_t *request_setup(UNUSED TALLOC_CTX *ctx, UNUSED rad_listen_t *listener, UNUSED fr_radius_packet_t *packet,
UNUSED RADCLIENT *client, UNUSED RAD_REQUEST_FUNP fun)
{
fr_assert(0 == 1);
* @param[in] packet containing attributes from the entry we received.
* @param[in] received Should always be true.
*/
-static void proto_ldap_packet_debug(request_t *request, RADIUS_PACKET *packet, bool received)
+static void proto_ldap_packet_debug(request_t *request, fr_radius_packet_t *packet, bool received)
{
if (!packet) return;
if (!RDEBUG_ENABLED) return;
static request_t *proto_ldap_request_setup(rad_listen_t *listen, proto_ldap_inst_t *inst, int sync_id)
{
TALLOC_CTX *ctx;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
request_t *request;
ctx = talloc_pool(NULL, main_config->talloc_pool_size);
fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t);
fr_io_address_t const *address = track->address;
RADCLIENT const *client;
- RADIUS_PACKET *packet = request->packet;
+ fr_radius_packet_t *packet = request->packet;
fr_cursor_t cursor;
fr_assert(data[0] < FR_RADIUS_MAX_PACKET_CODE);
* Common attr_filter checks
*/
static rlm_rcode_t CC_HINT(nonnull(1,2)) attr_filter_common(void const *instance, request_t *request,
- RADIUS_PACKET *packet)
+ fr_radius_packet_t *packet)
{
rlm_attr_filter_t const *inst = talloc_get_type_abort_const(instance, rlm_attr_filter_t);
fr_pair_t *vp;
* @param[in] packet associated with the request (request, reply...).
* @param[in] compat Write out entry in compatibility mode.
*/
-static int detail_write(FILE *out, rlm_detail_t const *inst, request_t *request, RADIUS_PACKET *packet, bool compat)
+static int detail_write(FILE *out, rlm_detail_t const *inst, request_t *request, fr_radius_packet_t *packet, bool compat)
{
fr_pair_t *vp;
char timestamp[256];
* Do detail, compatible with old accounting
*/
static rlm_rcode_t CC_HINT(nonnull) detail_do(void const *instance, request_t *request,
- RADIUS_PACKET *packet, bool compat)
+ fr_radius_packet_t *packet, bool compat)
{
int outfd, dupfd;
char buffer[DIRLEN];
*/
static rlm_rcode_t CC_HINT(nonnull) process_reply(UNUSED eap_session_t *eap_session,
fr_tls_session_t *tls_session,
- request_t *request, RADIUS_PACKET *reply)
+ request_t *request, fr_radius_packet_t *reply)
{
rlm_rcode_t rcode = RLM_MODULE_REJECT;
fr_pair_t *vp;
return 1;
}
-static void eap_peap_soh_verify(request_t *request, RADIUS_PACKET *packet,
+static void eap_peap_soh_verify(request_t *request, fr_radius_packet_t *packet,
uint8_t const *data, unsigned int data_len) {
fr_pair_t *vp;
/*
* Convert a pseudo-EAP packet to a list of fr_pair_t's.
*/
-static fr_pair_t *eap_peap_inner_to_pairs(UNUSED request_t *request, RADIUS_PACKET *packet,
+static fr_pair_t *eap_peap_inner_to_pairs(UNUSED request_t *request, fr_radius_packet_t *packet,
eap_round_t *eap_round,
uint8_t const *data, size_t data_len)
{
* Use a reply packet to determine what to do.
*/
static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_session_t *eap_session, fr_tls_session_t *tls_session,
- request_t *request, RADIUS_PACKET *reply)
+ request_t *request, fr_radius_packet_t *reply)
{
rlm_rcode_t rcode = RLM_MODULE_REJECT;
fr_pair_t *vp;
* Use a reply packet to determine what to do.
*/
static rlm_rcode_t CC_HINT(nonnull) process_reply(NDEBUG_UNUSED eap_session_t *eap_session, fr_tls_session_t *tls_session,
- request_t *request, RADIUS_PACKET *reply)
+ request_t *request, fr_radius_packet_t *reply)
{
rlm_rcode_t rcode = RLM_MODULE_REJECT;
fr_pair_t *vp, *tunnel_vps = NULL;
* Common code called by everything below.
*/
static rlm_rcode_t file_common(rlm_files_t const *inst, request_t *request, char const *filename, rbtree_t *tree,
- RADIUS_PACKET *packet, RADIUS_PACKET *reply)
+ fr_radius_packet_t *packet, fr_radius_packet_t *reply)
{
char const *name;
fr_pair_t *check_tmp = NULL;
/*
* A lie! It always returns!
*/
-static rlm_rcode_t sometimes_return(void const *instance, request_t *request, RADIUS_PACKET *packet, RADIUS_PACKET *reply)
+static rlm_rcode_t sometimes_return(void const *instance, request_t *request, fr_radius_packet_t *packet, fr_radius_packet_t *reply)
{
uint32_t hash;
rlm_sometimes_t const *inst = talloc_get_type_abort_const(instance, rlm_sometimes_t);
return fr_pair_cmp_by_parent_num(my_a, my_b);
}
-/** Check received DHCP request is valid and build RADIUS_PACKET structure if it is
+/** Check received DHCP request is valid and build fr_radius_packet_t structure if it is
*
* @param data pointer to received packet.
* @param data_len length of received data, and then length of the actual DHCP data.
int8_t fr_dhcpv4_attr_cmp(void const *a, void const *b);
bool fr_dhcpv4_ok(uint8_t const *data, ssize_t data_len, uint8_t *message_type, uint32_t *xid);
-RADIUS_PACKET *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len);
+fr_radius_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len);
bool fr_dhcpv4_is_encodable(void *item, UNUSED void *uctx);
ssize_t fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps);
ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps);
int fr_dhcpv4_decode(TALLOC_CTX *ctx, uint8_t const *data, size_t data_len, fr_cursor_t *cursor, unsigned int *code);
-int fr_dhcpv4_packet_encode(RADIUS_PACKET *packet);
+int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet);
#ifdef HAVE_LINUX_IF_PACKET_H
/*
#include <linux/if_packet.h>
int fr_dhcpv4_raw_socket_open(struct sockaddr_ll *p_ll, int iface_index);
-int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *p_ll, RADIUS_PACKET *packet);
+int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *p_ll, fr_radius_packet_t *packet);
-RADIUS_PACKET *fr_dhcv4_raw_packet_recv(int sockfd, struct sockaddr_ll *p_ll, RADIUS_PACKET *request);
+fr_radius_packet_t *fr_dhcv4_raw_packet_recv(int sockfd, struct sockaddr_ll *p_ll, fr_radius_packet_t *request);
#endif
/*
/*
* Use fr_pcap_init and fr_pcap_open to create/open handles.
*/
-RADIUS_PACKET *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap);
+fr_radius_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap);
-int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, RADIUS_PACKET *packet);
+int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_radius_packet_t *packet);
#endif
/*
* udp.c
*/
-RADIUS_PACKET *fr_dhcpv4_udp_packet_recv(int sockfd);
-int fr_dhcpv4_udp_packet_send(RADIUS_PACKET *packet);
+fr_radius_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd);
+int fr_dhcpv4_udp_packet_send(fr_radius_packet_t *packet);
#ifdef __cplusplus
}
return 0;
}
-int fr_dhcpv4_packet_encode(RADIUS_PACKET *packet)
+int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet)
{
ssize_t len;
fr_pair_t *vp;
return 0;
}
-RADIUS_PACKET *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len)
+fr_radius_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len)
{
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
uint32_t magic;
uint8_t const *code;
* - -1 on failure.
* - 0 on success.
*/
-int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, RADIUS_PACKET *packet)
+int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_radius_packet_t *packet)
{
int ret;
uint8_t dhcp_packet[1518] = { 0 };
*
* @param pcap handle
* @return
- * - pointer to RADIUS_PACKET if successful.
+ * - pointer to fr_radius_packet_t if successful.
* - NULL if failed.
*/
-RADIUS_PACKET *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap)
+fr_radius_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap)
{
int ret;
uint16_t src_port, dst_port;
struct pcap_pkthdr *header;
ssize_t link_len, len;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
/*
* Pointers into the packet data we just received
* - 0 on success.
* - -1 on failure.
*/
-int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *link_layer, RADIUS_PACKET *packet)
+int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *link_layer, fr_radius_packet_t *packet)
{
uint8_t dhcp_packet[1518] = { 0 };
ethernet_header_t *eth_hdr = (ethernet_header_t *)dhcp_packet;
*
* FIXME: split this into two, recv_raw_packet, and verify(packet, original)
*/
-RADIUS_PACKET *fr_dhcv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_layer, RADIUS_PACKET *request)
+fr_radius_packet_t *fr_dhcv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_layer, fr_radius_packet_t *request)
{
fr_pair_t *vp;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
uint8_t const *code;
uint32_t magic, xid;
ssize_t data_len;
* - >= 0 if successful.
* - < 0 if failed.
*/
-int fr_dhcpv4_udp_packet_send(RADIUS_PACKET *packet)
+int fr_dhcpv4_udp_packet_send(fr_radius_packet_t *packet)
{
int ret;
struct sockaddr_storage dst;
*
* @param sockfd handle.
* @return
- * - pointer to RADIUS_PACKET if successful.
+ * - pointer to fr_radius_packet_t if successful.
* - NULL if failed.
*/
-RADIUS_PACKET *fr_dhcpv4_udp_packet_recv(int sockfd)
+fr_radius_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd)
{
struct sockaddr_storage src;
struct sockaddr_storage dst;
socklen_t sizeof_src;
socklen_t sizeof_dst;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
uint8_t *data;
ssize_t data_len;
fr_ipaddr_t src_ipaddr, dst_ipaddr;
* @param[in] password_len Length of input password.
*/
void fr_radius_encode_chap_password(uint8_t out[static 1 + RADIUS_CHAP_CHALLENGE_LENGTH],
- RADIUS_PACKET *packet, uint8_t id, char const *password, size_t password_len)
+ fr_radius_packet_t *packet, uint8_t id, char const *password, size_t password_len)
{
fr_pair_t *challenge;
fr_md5_ctx_t *md5_ctx;
* That's because if the authentication vector is different,
* it means that the NAS has given up on the earlier request.
*/
-int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b)
+int fr_packet_cmp(fr_radius_packet_t const *a, fr_radius_packet_t const *b)
{
int rcode;
/*
* Create a fake "request" from a reply, for later lookup.
*/
-void fr_request_from_reply(RADIUS_PACKET *request,
- RADIUS_PACKET const *reply)
+void fr_request_from_reply(fr_radius_packet_t *request,
+ fr_radius_packet_t const *reply)
{
fr_socket_addr_swap(&request->socket, &reply->socket);
request->id = reply->id;
static int packet_entry_cmp(void const *one, void const *two)
{
- RADIUS_PACKET const * const *a = one;
- RADIUS_PACKET const * const *b = two;
+ fr_radius_packet_t const * const *a = one;
+ fr_radius_packet_t const * const *b = two;
return fr_packet_cmp(*a, *b);
}
* be called before inserting the packet into the list!
*/
bool fr_packet_list_insert(fr_packet_list_t *pl,
- RADIUS_PACKET **request_p)
+ fr_radius_packet_t **request_p)
{
if (!pl || !request_p || !*request_p) return 0;
return rbtree_insert(pl->tree, request_p);
}
-RADIUS_PACKET **fr_packet_list_find(fr_packet_list_t *pl, RADIUS_PACKET *request)
+fr_radius_packet_t **fr_packet_list_find(fr_packet_list_t *pl, fr_radius_packet_t *request)
{
if (!pl || !request) return 0;
* This presumes that the reply has dst_ipaddr && dst_port set up
* correctly (i.e. real IP, or "*").
*/
-RADIUS_PACKET **fr_packet_list_find_byreply(fr_packet_list_t *pl, RADIUS_PACKET *reply)
+fr_radius_packet_t **fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_radius_packet_t *reply)
{
- RADIUS_PACKET my_request, *request;
+ fr_radius_packet_t my_request, *request;
fr_packet_socket_t *ps;
if (!pl || !reply) return NULL;
}
-bool fr_packet_list_yank(fr_packet_list_t *pl, RADIUS_PACKET *request)
+bool fr_packet_list_yank(fr_packet_list_t *pl, fr_radius_packet_t *request)
{
rbnode_t *node;
* should be used.
*/
bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto,
- RADIUS_PACKET **request_p, void **pctx)
+ fr_radius_packet_t **request_p, void **pctx)
{
int i, j, k, fd, id, start_i, start_j, start_k;
int src_any = 0;
fr_packet_socket_t *ps= NULL;
- RADIUS_PACKET *request = *request_p;
+ fr_radius_packet_t *request = *request_p;
if ((request->socket.inet.dst_ipaddr.af == AF_UNSPEC) ||
(request->socket.inet.dst_port == 0)) {
* any newly inserted entries don't collide with this one.
*/
bool fr_packet_list_id_free(fr_packet_list_t *pl,
- RADIUS_PACKET *request, bool yank)
+ fr_radius_packet_t *request, bool yank)
{
fr_packet_socket_t *ps;
* FIXME: Add socket.fd, if -1, do round-robin, else do socket.fd
* IF in fdset.
*/
-RADIUS_PACKET *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma)
+fr_radius_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma)
{
int start;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
if (!pl || !set) return NULL;
/*
* Debug the packet if requested.
*/
-void fr_packet_header_log(fr_log_t const *log, RADIUS_PACKET *packet, bool received)
+void fr_packet_header_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received)
{
char src_ipaddr[FR_IPADDR_STRLEN];
char dst_ipaddr[FR_IPADDR_STRLEN];
/*
* Debug the packet header and all attributes
*/
-void fr_packet_log(fr_log_t const *log, RADIUS_PACKET *packet, bool received)
+void fr_packet_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received)
{
fr_packet_header_log(log, packet, received);
if (fr_debug_lvl >= L_DBG_LVL_1) fr_pair_list_log(log, packet->vps);
#include <stdbool.h>
#include <stdint.h>
-int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b);
-void fr_request_from_reply(RADIUS_PACKET *request,
- RADIUS_PACKET const *reply);
+int fr_packet_cmp(fr_radius_packet_t const *a, fr_radius_packet_t const *b);
+void fr_request_from_reply(fr_radius_packet_t *request,
+ fr_radius_packet_t const *reply);
typedef struct fr_packet_list_s fr_packet_list_t;
fr_packet_list_t *fr_packet_list_create(int alloc_id);
void fr_packet_list_free(fr_packet_list_t *pl);
bool fr_packet_list_insert(fr_packet_list_t *pl,
- RADIUS_PACKET **request_p);
+ fr_radius_packet_t **request_p);
-RADIUS_PACKET **fr_packet_list_find(fr_packet_list_t *pl,
- RADIUS_PACKET *request);
-RADIUS_PACKET **fr_packet_list_find_byreply(fr_packet_list_t *pl,
- RADIUS_PACKET *reply);
+fr_radius_packet_t **fr_packet_list_find(fr_packet_list_t *pl,
+ fr_radius_packet_t *request);
+fr_radius_packet_t **fr_packet_list_find_byreply(fr_packet_list_t *pl,
+ fr_radius_packet_t *reply);
bool fr_packet_list_yank(fr_packet_list_t *pl,
- RADIUS_PACKET *request);
+ fr_radius_packet_t *request);
uint32_t fr_packet_list_num_elements(fr_packet_list_t *pl);
bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto,
- RADIUS_PACKET **request_p, void **pctx);
+ fr_radius_packet_t **request_p, void **pctx);
bool fr_packet_list_id_free(fr_packet_list_t *pl,
- RADIUS_PACKET *request, bool yank);
+ fr_radius_packet_t *request, bool yank);
bool fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd, int proto,
fr_ipaddr_t *dst_ipaddr, uint16_t dst_port,
void *ctx);
bool fr_packet_list_socket_thaw(fr_packet_list_t *pl, int sockfd);
int fr_packet_list_walk(fr_packet_list_t *pl, rb_walker_t callback, void *uctx);
int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set);
-RADIUS_PACKET *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma);
+fr_radius_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma);
uint32_t fr_packet_list_num_incoming(fr_packet_list_t *pl);
uint32_t fr_packet_list_num_outgoing(fr_packet_list_t *pl);
-void fr_packet_header_log(fr_log_t const *log, RADIUS_PACKET *packet, bool received);
-void fr_packet_log(fr_log_t const *log, RADIUS_PACKET *packet, bool received);
+void fr_packet_header_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received);
+void fr_packet_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received);
/*
- * "find" returns a pointer to the RADIUS_PACKET* member in the
+ * "find" returns a pointer to the fr_radius_packet_t* member in the
* caller's structure. In order to get the pointer to the *top*
* of the caller's structure, you have to subtract the offset to
* the member from the returned pointer, and cast it to the
* $Id$
*
* @file protocols/radius/packet.c
- * @brief Functions to deal with RADIUS_PACKET data structures.
+ * @brief Functions to deal with fr_radius_packet_t data structures.
*
* @copyright 2000-2017 The FreeRADIUS server project
*/
/** Encode a packet
*
*/
-ssize_t fr_radius_packet_encode(RADIUS_PACKET *packet, RADIUS_PACKET const *original, char const *secret)
+ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_radius_packet_t const *original, char const *secret)
{
uint8_t const *original_data;
ssize_t slen;
* - 0 on success
* - -1 on decoding error.
*/
-int fr_radius_packet_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
+int fr_radius_packet_decode(fr_radius_packet_t *packet, fr_radius_packet_t *original,
uint32_t max_attributes, bool tunnel_password_zeros, char const *secret)
{
int packet_length;
* - True on success.
* - False on failure.
*/
-bool fr_radius_packet_ok(RADIUS_PACKET *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason)
+bool fr_radius_packet_ok(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason)
{
char host_ipaddr[INET6_ADDRSTRLEN];
/** Verify the Request/Response Authenticator (and Message-Authenticator if present) of a packet
*
*/
-int fr_radius_packet_verify(RADIUS_PACKET *packet, RADIUS_PACKET *original, char const *secret)
+int fr_radius_packet_verify(fr_radius_packet_t *packet, fr_radius_packet_t *original, char const *secret)
{
uint8_t const *original_data;
char buffer[INET6_ADDRSTRLEN];
/** Sign a previously encoded packet
*
*/
-int fr_radius_packet_sign(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
+int fr_radius_packet_sign(fr_radius_packet_t *packet, fr_radius_packet_t const *original,
char const *secret)
{
int rcode;
/** Wrapper for recvfrom, which handles recvfromto, IPv6, and all possible combinations
*
*/
-static ssize_t rad_recvfrom(int sockfd, RADIUS_PACKET *packet, int flags)
+static ssize_t rad_recvfrom(int sockfd, fr_radius_packet_t *packet, int flags)
{
ssize_t data_len;
}
-/** Receive UDP client requests, and fill in the basics of a RADIUS_PACKET structure
+/** Receive UDP client requests, and fill in the basics of a fr_radius_packet_t structure
*
*/
-RADIUS_PACKET *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma)
+fr_radius_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma)
{
ssize_t data_len;
- RADIUS_PACKET *packet;
+ fr_radius_packet_t *packet;
/*
* Allocate the new request data structure
*
* Also attach reply attribute value pairs and any user message provided.
*/
-int fr_radius_packet_send(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
+int fr_radius_packet_send(fr_radius_packet_t *packet, fr_radius_packet_t const *original,
char const *secret)
{
/*
&packet->socket.inet.dst_ipaddr, packet->socket.inet.dst_port);
}
-void _fr_radius_packet_log_hex(fr_log_t const *log, RADIUS_PACKET const *packet, char const *file, int line)
+void _fr_radius_packet_log_hex(fr_log_t const *log, fr_radius_packet_t const *packet, char const *file, int line)
{
uint8_t const *attr, *end;
char buffer[256];
/*
* protocols/radius/packet.c
*/
-ssize_t fr_radius_packet_encode(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
+ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_radius_packet_t const *original,
char const *secret) CC_HINT(nonnull (1,3));
-int fr_radius_packet_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
+int fr_radius_packet_decode(fr_radius_packet_t *packet, fr_radius_packet_t *original,
uint32_t max_attributes, bool tunnel_password_zeros,
char const *secret) CC_HINT(nonnull (1,5));
-bool fr_radius_packet_ok(RADIUS_PACKET *packet, uint32_t max_attributes, bool require_ma,
+bool fr_radius_packet_ok(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma,
decode_fail_t *reason) CC_HINT(nonnull (1));
-int fr_radius_packet_verify(RADIUS_PACKET *packet, RADIUS_PACKET *original,
+int fr_radius_packet_verify(fr_radius_packet_t *packet, fr_radius_packet_t *original,
char const *secret) CC_HINT(nonnull (1,3));
-int fr_radius_packet_sign(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
+int fr_radius_packet_sign(fr_radius_packet_t *packet, fr_radius_packet_t const *original,
char const *secret) CC_HINT(nonnull (1,3));
-RADIUS_PACKET *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma);
-int fr_radius_packet_send(RADIUS_PACKET *packet, RADIUS_PACKET const *original,
+fr_radius_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma);
+int fr_radius_packet_send(fr_radius_packet_t *packet, fr_radius_packet_t const *original,
char const *secret) CC_HINT(nonnull (1,3));
#define fr_radius_packet_log_hex(_log, _packet) _fr_radius_packet_log_hex(_log, _packet, __FILE__, __LINE__);
-void _fr_radius_packet_log_hex(fr_log_t const *log, RADIUS_PACKET const *packet, char const *file, int line) CC_HINT(nonnull);
+void _fr_radius_packet_log_hex(fr_log_t const *log, fr_radius_packet_t const *packet, char const *file, int line) CC_HINT(nonnull);
typedef struct {
fr_pair_t *parent;
* protocols/radius/encode.c
*/
void fr_radius_encode_chap_password(uint8_t out[static 1 + RADIUS_CHAP_CHALLENGE_LENGTH],
- RADIUS_PACKET *packet, uint8_t id,
+ fr_radius_packet_t *packet, uint8_t id,
char const *password, size_t password_len) CC_HINT(nonnull(1,2,4));
ssize_t fr_radius_encode_pair(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *encoder_ctx);
#include <freeradius-devel/radius/radius.h>
#include <freeradius-devel/server/tcp.h>
-RADIUS_PACKET *fr_tcp_recv(int sockfd, int flags)
+fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags)
{
- RADIUS_PACKET *packet = fr_radius_alloc(NULL, false);
+ fr_radius_packet_t *packet = fr_radius_alloc(NULL, false);
if (!packet) return NULL;
}
/*
- * Receives a packet, assuming that the RADIUS_PACKET structure
+ * Receives a packet, assuming that the fr_radius_packet_t structure
* has been filled out already.
*
* This ASSUMES that the packet is allocated && fields
* Calling this function MAY change sockfd,
* if src_ipaddr.af == AF_UNSPEC.
*/
-int fr_tcp_read_packet(RADIUS_PACKET *packet, uint32_t max_attributes, bool require_ma)
+int fr_tcp_read_packet(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma)
{
ssize_t len;