From: Arran Cudbard-Bell Date: Mon, 8 May 2017 19:38:45 +0000 (-0400) Subject: Move RADIUS_PACKET into packet.h X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91ecd2df6723aa1e73b33a526347010088514f80;p=thirdparty%2Ffreeradius-server.git Move RADIUS_PACKET into packet.h --- diff --git a/src/include/libradius.h b/src/include/libradius.h index 9cbd368ce56..38fec3b4dec 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -117,43 +117,6 @@ typedef void (*sig_t)(int); # define DEBUG if (fr_debug_lvl && fr_log_fp) fr_printf_log #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 - * - * verified: Filled in by rad_decode for accounting-request packets - * - * data,data_len: Used between fr_radius_recv and fr_radius_decode. - */ -typedef struct radius_packet { - int sockfd; //!< Socket this packet was read from. - int if_index; //!< Index of receiving interface. - fr_ipaddr_t src_ipaddr; //!< Src IP address of packet. - fr_ipaddr_t dst_ipaddr; //!< Dst IP address of packet. - uint16_t src_port; //!< Src port of packet. - uint16_t dst_port; //!< DST Port of packet. - - int id; //!< Packet ID (used to link requests/responses). - unsigned int code; //!< Packet code (type). - - uint8_t vector[AUTH_VECTOR_LEN];//!< RADIUS authentication vector. - - uint32_t count; //!< Number of times we've seen this packet - struct timeval timestamp; //!< When we received the packet. - uint8_t *data; //!< Packet data (body). - size_t data_len; //!< Length of packet data. - VALUE_PAIR *vps; //!< Result of decoding the packet into VALUE_PAIRs. - ssize_t offset; - - uint32_t rounds; //!< for State[0] - -#ifdef WITH_TCP - size_t partial; - int proto; -#endif -} RADIUS_PACKET; - typedef enum { DECODE_FAIL_NONE = 0, DECODE_FAIL_MIN_LENGTH_PACKET, diff --git a/src/include/packet.h b/src/include/packet.h index b587e76c50d..ccc68c9dfd4 100644 --- a/src/include/packet.h +++ b/src/include/packet.h @@ -29,6 +29,49 @@ RCSIDH(packet_h, "$Id$") extern "C" { #endif +#include +#include +#include + +#define AUTH_VECTOR_LEN 16 + +/* + * 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 + * + * verified: Filled in by rad_decode for accounting-request packets + * + * data,data_len: Used between fr_radius_recv and fr_radius_decode. + */ +typedef struct radius_packet { + int sockfd; //!< Socket this packet was read from. + int if_index; //!< Index of receiving interface. + fr_ipaddr_t src_ipaddr; //!< Src IP address of packet. + fr_ipaddr_t dst_ipaddr; //!< Dst IP address of packet. + uint16_t src_port; //!< Src port of packet. + uint16_t dst_port; //!< DST Port of packet. + + int id; //!< Packet ID (used to link requests/responses). + unsigned int code; //!< Packet code (type). + + uint8_t vector[AUTH_VECTOR_LEN];//!< RADIUS authentication vector. + + uint32_t count; //!< Number of times we've seen this packet + struct timeval timestamp; //!< When we received the packet. + uint8_t *data; //!< Packet data (body). + size_t data_len; //!< Length of packet data. + VALUE_PAIR *vps; //!< Result of decoding the packet into VALUE_PAIRs. + ssize_t offset; + + uint32_t rounds; //!< for State[0] + +#ifdef WITH_TCP + size_t partial; + int proto; +#endif +} RADIUS_PACKET; + int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b); void fr_request_from_reply(RADIUS_PACKET *request, RADIUS_PACKET const *reply);