Skip to content

Commit

Permalink
Reorganise some libraries under src/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Apr 11, 2017
1 parent 0de635e commit dd50a33
Show file tree
Hide file tree
Showing 143 changed files with 317 additions and 1,568 deletions.
11 changes: 9 additions & 2 deletions configure
Expand Up @@ -682,6 +682,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
TARGET_SYSTEM
target_os
target_vendor
target_cpu
Expand Down Expand Up @@ -2720,6 +2721,8 @@ test -n "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
TARGET_SYSTEM="$target"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
Expand Down Expand Up @@ -9562,7 +9565,7 @@ $as_echo "$as_me: WARNING: kqueue headers not found. Use --with-kqueue-include-d
fi
fi
case "$host" in
case "$target" in
*-interix*)
CFLAGS="$CFLAGS -D_ALL_SOURCE"
;;
Expand Down Expand Up @@ -14293,7 +14296,7 @@ $as_echo "#define BSDSTYLE 3" >>confdefs.h
gethostbyaddrrstyle=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gethostbyaddr_r() syntax" >&5
$as_echo_n "checking gethostbyaddr_r() syntax... " >&6; }
case "$host" in
case "$target" in
*-freebsd*)
ac_fn_c_check_decl "$LINENO" "gethostbyaddr_r" "ac_cv_have_decl_gethostbyaddr_r" "
#ifdef HAVE_NETDB_H
Expand Down Expand Up @@ -14698,6 +14701,10 @@ for bar in $MODULES; do
fi
done
for foo in `find "${srcdir}"/src/lib/ -type f -name configure`; do
mysubdirs="$mysubdirs $(dirname $foo)"
done
subdirs="$subdirs $mysubdirs"
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Expand Up @@ -2115,6 +2115,13 @@ for bar in $MODULES; do
fi
done

dnl ############################################################
dnl # Find any support libraries we need to build
dnl #############################################################
for foo in `find "${srcdir}"/src/lib/ -type f -name configure`; do
mysubdirs="$mysubdirs $(dirname $foo)"
done

dnl #
dnl # Don't change the variable name here. Autoconf goes bonkers
dnl # if you do.
Expand Down
4 changes: 2 additions & 2 deletions debian/control.in
Expand Up @@ -93,15 +93,15 @@ Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${dist:Depends}
Conflicts: libfreeradius3
Description: FreeRADIUS shared library
The FreeRADIUS projects' libfreeradius-radius and libfreeradius-eap, used by
The FreeRADIUS projects' libfreeradius-util and libfreeradius-eap, used by
the FreeRADIUS server and some of the utilities.

Package: libfreeradius-dev
Architecture: any
Section: libdevel
Depends: ${shlibs:Depends}, ${misc:Depends}, ${dist:Depends}, libfreeradius4 (= ${binary:Version})
Description: FreeRADIUS shared library development files
The FreeRADIUS projects' libfreeradius-radius and libfreeradius-eap, used by
The FreeRADIUS projects' libfreeradius-util and libfreeradius-eap, used by
the FreeRADIUS server and some of the utilities.
.
This package contains the development headers and static library version.
Expand Down
2 changes: 1 addition & 1 deletion debian/libfreeradius-dev.install
@@ -1,3 +1,3 @@
usr/lib/freeradius/libfreeradius-radius.a
usr/lib/freeradius/libfreeradius-util.a
usr/lib/freeradius/libfreeradius-eap.a
usr/include/freeradius/*.h
2 changes: 1 addition & 1 deletion debian/libfreeradius4.install
@@ -1,3 +1,3 @@
usr/lib/freeradius/libfreeradius-server.so
usr/lib/freeradius/libfreeradius-radius.so
usr/lib/freeradius/libfreeradius-util.so
usr/lib/freeradius/libfreeradius-eap.so
2 changes: 1 addition & 1 deletion src/all.mk
@@ -1,4 +1,4 @@
# add this dependency BEFORE including the other submakefiles.
all:

SUBMAKEFILES := include/all.mk lib/all.mk modules/all.mk main/all.mk util/all.mk tests/all.mk
SUBMAKEFILES := include/all.mk lib/all.mk modules/all.mk main/all.mk tests/all.mk
1 change: 1 addition & 0 deletions src/include/io
1 change: 1 addition & 0 deletions src/include/ldap
1 change: 1 addition & 0 deletions src/include/protocol.h
Expand Up @@ -74,6 +74,7 @@ typedef struct rad_protocol_t {
rad_listen_decode_t decode; //!< Decode an incoming packet.
} rad_protocol_t;

#define TRANSPORT_NONE 0
#define TRANSPORT_TCP (1 << IPPROTO_TCP)
#define TRANSPORT_UDP (1 << IPPROTO_UDP)
#define TRANSPORT_DUAL (TRANSPORT_UDP | TRANSPORT_TCP)
Expand Down
8 changes: 4 additions & 4 deletions src/include/rad_assert.h
Expand Up @@ -31,16 +31,16 @@ extern "C" {
#endif

#ifndef NDEBUG
bool rad_assert_fail(char const *file, unsigned int line, char const *expr) CC_HINT(noreturn);
bool fr_assert_fail(char const *file, unsigned int line, char const *expr) CC_HINT(noreturn);
#else
bool rad_assert_fail(char const *file, unsigned int line, char const *expr);
bool fr_assert_fail(char const *file, unsigned int line, char const *expr);
#endif


#ifdef NDEBUG
# define rad_assert(_expr)
#elif !defined(__clang_analyzer__)
# define rad_assert(_expr) ((void) ((_expr) ? (void) 0 : (void) rad_assert_fail(__FILE__, __LINE__, #_expr)))
# define rad_assert(_expr) ((void) ((_expr) ? (void) 0 : (void) fr_assert_fail(__FILE__, __LINE__, #_expr)))
#else
# include <assert.h>
# define rad_assert assert
Expand All @@ -58,7 +58,7 @@ bool rad_assert_fail(char const *file, unsigned int line, char const *expr);
/** Use for conditions that should result in an assert in dev builds, and return in non-dev builds
*
*/
#define rad_cond_assert(_x) (bool)((_x) ? true : (rad_assert_fail(__FILE__, __LINE__, #_x) && false))
#define rad_cond_assert(_x) (bool)((_x) ? true : (fr_assert_fail(__FILE__, __LINE__, #_x) && false))

#ifdef __cplusplus
}
Expand Down
60 changes: 1 addition & 59 deletions src/lib/all.mk
@@ -1,59 +1 @@
#
# Makefile
#
# Version: $Id$
#
TARGET := libfreeradius-radius.a

SOURCES := cbuff.c \
cursor.c \
debug.c \
dict.c \
filters.c \
hash.c \
hmacmd5.c \
hmacsha1.c \
inet.c \
isaac.c \
log.c \
misc.c \
missing.c \
md4.c \
md5.c \
net.c \
pair.c \
pair_cursor.c \
pcap.c \
print.c \
proto.c \
radius.c \
radius_encode.c \
radius_decode.c \
rbtree.c \
regex.c \
sha1.c \
snprintf.c \
strerror.c \
strlcat.c \
strlcpy.c \
syserror.c \
socket.c \
token.c \
udpfromto.c \
value.c \
fifo.c \
packet.c \
event.c \
getaddrinfo.c \
heap.c \
tcp.c \
udp.c \
base64.c \
version.c

SRC_CFLAGS := -D_LIBRADIUS -I$(top_builddir)/src

# System libraries discovered by our top level configure script, links things
# like pthread and the regexp libraries.
TGT_LDLIBS := $(LIBS) $(PCAP_LIBS)
TGT_LDFLAGS := $(LDFLAGS) $(PCAP_LDFLAGS)
SUBMAKEFILES := io/all.mk ldap/all.mk util/all.mk
8 changes: 4 additions & 4 deletions src/util/all.mk → src/lib/io/all.mk
@@ -1,9 +1,9 @@
TARGET := libfreeradius-util.a
TARGET := libfreeradius-io.a

SOURCES := ring_buffer.c message.c atomic_queue.c queue.c time.c channel.c track.c worker.c \
schedule.c receiver.c control.c

TGT_PREREQS := libfreeradius-radius.la
TGT_PREREQS := libfreeradius-util.la
TGT_LDLIBS := $(LIBS)
TGT_LDFLAGS := $(LDFLAGS)

Expand All @@ -14,9 +14,9 @@ TGT_LDFLAGS := $(LDFLAGS)
HEADERS := $(SOURCES:.c=.h)

define ADD_UTIL_HEADER
${SRC_INCLUDE_DIR}/util/${1}: src/include/util/${1}
${SRC_INCLUDE_DIR}/io/${1}: src/include/io/${1}

install.src.include: ${SRC_INCLUDE_DIR}/util/${1}
install.src.include: ${SRC_INCLUDE_DIR}/io/${1}
endef

$(foreach x,$(HEADERS),$(eval $(call ADD_UTIL_HEADER,$x)))
4 changes: 2 additions & 2 deletions src/util/atomic_queue.c → src/lib/io/atomic_queue.c
Expand Up @@ -18,7 +18,7 @@
* $Id$
*
* @brief Thread-safe queues.
* @file util/atomic_queue.c
* @file io/atomic_queue.c
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
* @copyright 2016 Alister Winfield
Expand All @@ -36,7 +36,7 @@ RCSID("$Id$")
# include <freeradius-devel/stdatomic.h>
#endif

#include <freeradius-devel/util/atomic_queue.h>
#include <freeradius-devel/io/atomic_queue.h>

/*
* Some macros to make our life easier.
Expand Down
2 changes: 1 addition & 1 deletion src/util/atomic_queue.h → src/lib/io/atomic_queue.h
Expand Up @@ -18,7 +18,7 @@
/**
* $Id$
*
* @file util/atomic_queue.h
* @file io/atomic_queue.h
* @brief Thread-safe queues.
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
Expand Down
6 changes: 3 additions & 3 deletions src/util/channel.c → src/lib/io/channel.c
Expand Up @@ -18,14 +18,14 @@
* $Id$
*
* @brief Two-way thread-safe channels
* @file util/channel.c
* @file io/channel.c
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSID("$Id$")

#include <freeradius-devel/util/channel.h>
#include <freeradius-devel/util/control.h>
#include <freeradius-devel/io/channel.h>
#include <freeradius-devel/io/control.h>
#include <freeradius-devel/fr_log.h>
#include <freeradius-devel/rad_assert.h>

Expand Down
6 changes: 3 additions & 3 deletions src/util/channel.h → src/lib/io/channel.h
Expand Up @@ -18,15 +18,15 @@
/**
* $Id$
*
* @file util/channel.h
* @file io/channel.h
* @brief 2-way channels based on kqueue and atomic queues.
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSIDH(channel_h, "$Id$")

#include <freeradius-devel/util/message.h>
#include <freeradius-devel/util/control.h>
#include <freeradius-devel/io/message.h>
#include <freeradius-devel/io/control.h>

#include <sys/types.h>
#include <sys/event.h>
Expand Down
6 changes: 3 additions & 3 deletions src/util/control.c → src/lib/io/control.c
Expand Up @@ -18,14 +18,14 @@
* $Id$
*
* @brief Control-plane signaling
* @file util/control.c
* @file io/control.c
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSID("$Id$")

#include <freeradius-devel/util/control.h>
#include <freeradius-devel/util/ring_buffer.h>
#include <freeradius-devel/io/control.h>
#include <freeradius-devel/io/ring_buffer.h>
#include <freeradius-devel/fr_log.h>
#include <freeradius-devel/rad_assert.h>

Expand Down
8 changes: 4 additions & 4 deletions src/util/control.h → src/lib/io/control.h
Expand Up @@ -18,16 +18,16 @@
/**
* $Id$
*
* @file util/control.h
* @file io/control.h
* @brief control-plane signaling
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSIDH(control_h, "$Id$")

#include <freeradius-devel/util/atomic_queue.h>
#include <freeradius-devel/util/ring_buffer.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/io/atomic_queue.h>
#include <freeradius-devel/io/ring_buffer.h>
#include <freeradius-devel/io/time.h>

#include <sys/types.h>
#include <sys/event.h>
Expand Down
4 changes: 2 additions & 2 deletions src/util/message.c → src/lib/io/message.c
Expand Up @@ -18,13 +18,13 @@
* $Id$
*
* @brief Messages for inter-thread communication
* @file util/message.c
* @file io/message.c
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSID("$Id$")

#include <freeradius-devel/util/message.h>
#include <freeradius-devel/io/message.h>
#include <freeradius-devel/fr_log.h>
#include <freeradius-devel/rad_assert.h>

Expand Down
6 changes: 3 additions & 3 deletions src/util/message.h → src/lib/io/message.h
Expand Up @@ -18,15 +18,15 @@
/**
* $Id$
*
* @file util/message.h
* @file io/message.h
* @brief Inter-thread messaging
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
RCSIDH(message_h, "$Id$")

#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/ring_buffer.h>
#include <freeradius-devel/io/time.h>
#include <freeradius-devel/io/ring_buffer.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions src/util/queue.c → src/lib/io/queue.c
Expand Up @@ -18,7 +18,7 @@
* $Id$
*
* @brief Thread-unsafe queues
* @file util/queue.c
* @file io/queue.c
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
*/
Expand All @@ -28,7 +28,7 @@ RCSID("$Id$")
#include <string.h>

#include <freeradius-devel/rad_assert.h>
#include <freeradius-devel/util/queue.h>
#include <freeradius-devel/io/queue.h>

struct fr_queue_t {
int head; //!< head of the queue
Expand Down
4 changes: 2 additions & 2 deletions src/util/queue.h → src/lib/io/queue.h
Expand Up @@ -18,7 +18,7 @@
/**
* $Id$
*
* @file util/queue.h
* @file io/queue.h
* @brief Thread-unsafe queues.
*
* @copyright 2016 Alan DeKok <aland@freeradius.org>
Expand All @@ -27,7 +27,7 @@ RCSIDH(queue_h, "$Id$")

#include <talloc.h>
#include <stdbool.h>
#include <freeradius-devel/util/atomic_queue.h>
#include <freeradius-devel/io/atomic_queue.h>

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit dd50a33

Please sign in to comment.