All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 #ifndef _FR_PACKET_H
17 #define _FR_PACKET_H
18 /**
19  * $Id: 5fb7226db232b84b356c5539b485df035bdd224b $
20  *
21  * @file include/packet.h
22  * @brief Structures and functions for packet manipulation
23  *
24  * @copyright 2001, 2002, 2003, 2004, 2005, 2006 The FreeRADIUS server project
25  */
26 RCSIDH(packet_h, "$Id: 5fb7226db232b84b356c5539b485df035bdd224b $")
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b);
33 int fr_is_inaddr_any(fr_ipaddr_t *ipaddr);
35  RADIUS_PACKET const *reply);
36 int fr_socket(fr_ipaddr_t *ipaddr, uint16_t port);
43  RADIUS_PACKET **request_p);
46  RADIUS_PACKET *request);
48  RADIUS_PACKET *reply);
50  RADIUS_PACKET *request);
53  RADIUS_PACKET **request_p, void **pctx);
55  RADIUS_PACKET *request, bool yank);
57  fr_ipaddr_t *dst_ipaddr, uint16_t dst_port,
58  void *ctx);
62 int fr_packet_list_walk(fr_packet_list_t *pl, void *ctx, rb_walker_t callback);
63 int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set);
68 void fr_packet_header_print(FILE *fp, RADIUS_PACKET *packet, bool received);
70 /*
71  * "find" returns a pointer to the RADIUS_PACKET* member in the
72  * caller's structure. In order to get the pointer to the *top*
73  * of the caller's structure, you have to subtract the offset to
74  * the member from the returned pointer, and cast it to the
75  * required type.
76  */
77 # define fr_packet2myptr(TYPE, MEMBER, PTR) (TYPE *) (((char *)PTR) - offsetof(TYPE, MEMBER))
79 #ifdef __cplusplus
80 }
81 #endif
82 #endif /* _FR_PACKET_H */
static int sockfd
Definition: radclient.c:59
#define RCSIDH(h, id)
Definition: build.h:136
bool fr_packet_list_id_free(fr_packet_list_t *pl, RADIUS_PACKET *request, bool yank)
Definition: packet.c:830
RADIUS_PACKET ** fr_packet_list_find_byreply(fr_packet_list_t *pl, RADIUS_PACKET *reply)
Definition: packet.c:514
int fr_is_inaddr_any(fr_ipaddr_t *ipaddr)
Determine if an address is the INADDR_ANY address for its address family.
Definition: packet.c:91
bool fr_packet_list_socket_del(fr_packet_list_t *pl, int sockfd)
Definition: packet.c:338
void fr_request_from_reply(RADIUS_PACKET *request, RADIUS_PACKET const *reply)
Definition: packet.c:118
bool fr_packet_list_socket_thaw(fr_packet_list_t *pl, int sockfd)
Definition: packet.c:324
static char const * proto
Definition: radclient.c:63
int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set)
Definition: packet.c:874
void fr_packet_header_print(FILE *fp, RADIUS_PACKET *packet, bool received)
Definition: packet.c:962
int fr_packet_list_walk(fr_packet_list_t *pl, void *ctx, rb_walker_t callback)
Definition: packet.c:867
fr_packet_list_t * fr_packet_list_create(int alloc_id)
Definition: packet.c:464
int(* rb_walker_t)(void *ctx, void *data)
Definition: libradius.h:530
uint32_t fr_packet_list_num_elements(fr_packet_list_t *pl)
Definition: packet.c:584
RADIUS_PACKET ** fr_packet_list_find(fr_packet_list_t *pl, RADIUS_PACKET *request)
Definition: packet.c:501
bool fr_packet_list_yank(fr_packet_list_t *pl, RADIUS_PACKET *request)
Definition: packet.c:571
void fr_packet_list_free(fr_packet_list_t *pl)
Definition: packet.c:452
int fr_socket(fr_ipaddr_t *ipaddr, uint16_t port)
Definition: packet.c:136
bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto, RADIUS_PACKET **request_p, void **pctx)
Definition: packet.c:611
bool fr_packet_list_socket_freeze(fr_packet_list_t *pl, int sockfd)
Definition: packet.c:305
uint32_t fr_packet_list_num_incoming(fr_packet_list_t *pl)
Definition: packet.c:940
static rbtree_t * pl
Definition: process.c:53
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)
Definition: packet.c:356
IPv4/6 prefix.
Definition: inet.h:41
uint32_t fr_packet_list_num_outgoing(fr_packet_list_t *pl)
Definition: packet.c:952
bool fr_packet_list_insert(fr_packet_list_t *pl, RADIUS_PACKET **request_p)
Definition: packet.c:493
RADIUS_PACKET * fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set)
Definition: packet.c:901
int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b)
Definition: packet.c:40