Add "extern C {...} to header files for C++ builds.
[freeradius.git] / src / include / packet.h
index f49d5cb..4b455db 100644 (file)
 #include <freeradius-devel/ident.h>
 RCSIDH(packet_h, "$Id$")
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 uint32_t fr_request_packet_hash(const RADIUS_PACKET *packet);
 uint32_t fr_reply_packet_hash(const RADIUS_PACKET *packet);
 int fr_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b);
+int fr_inaddr_any(fr_ipaddr_t *ipaddr);
 void fr_request_from_reply(RADIUS_PACKET *request,
                             const RADIUS_PACKET *reply);
 int fr_socket(fr_ipaddr_t *ipaddr, int port);
+int fr_nonblock(int fd);
 
 typedef struct fr_packet_list_t fr_packet_list_t;
 
@@ -48,12 +54,16 @@ RADIUS_PACKET **fr_packet_list_find_byreply(fr_packet_list_t *pl,
 RADIUS_PACKET **fr_packet_list_yank(fr_packet_list_t *pl,
                                      RADIUS_PACKET *request);
 int fr_packet_list_num_elements(fr_packet_list_t *pl);
-int fr_packet_list_id_alloc(fr_packet_list_t *pl,
-                             RADIUS_PACKET *request);
+int fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto,
+                           RADIUS_PACKET *request, void **pctx);
 int fr_packet_list_id_free(fr_packet_list_t *pl,
                             RADIUS_PACKET *request);
-int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd);
-int fr_packet_list_socket_remove(fr_packet_list_t *pl, int sockfd);
+int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd, int proto,
+                             fr_ipaddr_t *dst_ipaddr, int dst_port,
+                             void *ctx);
+int fr_packet_list_socket_remove(fr_packet_list_t *pl, int sockfd,
+                                void **pctx);
+int fr_packet_list_socket_freeze(fr_packet_list_t *pl, int sockfd);
 int fr_packet_list_walk(fr_packet_list_t *pl, void *ctx,
                          fr_hash_table_walk_t callback);
 int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set);
@@ -62,11 +72,6 @@ RADIUS_PACKET *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set);
 int fr_packet_list_num_incoming(fr_packet_list_t *pl);
 int fr_packet_list_num_outgoing(fr_packet_list_t *pl);
 
-
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
 /*
  *     "find" returns a pointer to the RADIUS_PACKET* member in the
  *     caller's structure.  In order to get the pointer to the *top*
@@ -75,4 +80,9 @@ int fr_packet_list_num_outgoing(fr_packet_list_t *pl);
  *     required type.
  */
 # define fr_packet2myptr(TYPE, MEMBER, PTR) (TYPE *) (((char *)PTR) - offsetof(TYPE, MEMBER))
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* FR_PACKET_H */