Integrate more into the server. Dp4
[freeradius.git] / src / main / listen.c
index 003752b..d990b0a 100644 (file)
@@ -29,6 +29,7 @@ RCSID("$Id$")
 #include <freeradius-devel/modules.h>
 #include <freeradius-devel/rad_assert.h>
 #include <freeradius-devel/vqp.h>
+#include <freeradius-devel/dhcp.h>
 
 #include <freeradius-devel/vmps.h>
 #include <freeradius-devel/detail.h>
@@ -84,7 +85,8 @@ RADCLIENT *client_listener_find(const rad_listen_t *listener,
 
        rad_assert((listener->type == RAD_LISTEN_AUTH) ||
                   (listener->type == RAD_LISTEN_ACCT) ||
-                  (listener->type == RAD_LISTEN_VQP));
+                  (listener->type == RAD_LISTEN_VQP) ||
+                  (listener->type == RAD_LISTEN_DHCP));
 
        clients = ((listen_socket_t *)listener->data)->clients;
 
@@ -196,6 +198,12 @@ static int socket_print(rad_listen_t *this, char *buffer, size_t bufsize)
                break;
 #endif
 
+#ifdef WITH_DHCP
+       case RAD_LISTEN_DHCP:
+               name = "dhcp";
+               break;
+#endif
+
        default:
                name = "??";
                break;
@@ -734,7 +742,6 @@ static int proxy_socket_decode(UNUSED rad_listen_t *listener, REQUEST *request)
                           request->home_server->secret);
 }
 
-
 #ifdef WITH_SNMP
 static int radius_snmp_recv(rad_listen_t *listener,
                            UNUSED RAD_REQUEST_FUNP *pfun,
@@ -770,6 +777,8 @@ static int radius_snmp_print(UNUSED rad_listen_t *this, char *buffer, size_t buf
 
 #endif
 
+#include "dhcpd.c"
+
 static const rad_listen_master_t master_listen[RAD_LISTEN_MAX] = {
        { NULL, NULL, NULL, NULL, NULL, NULL, NULL},    /* RAD_LISTEN_NONE */
 
@@ -802,6 +811,15 @@ static const rad_listen_master_t master_listen[RAD_LISTEN_MAX] = {
        { NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 #endif
 
+#ifdef WITH_DHCP
+       /* dhcp query protocol */
+       { dhcp_socket_parse, NULL,
+         dhcp_socket_recv, dhcp_socket_send,
+         socket_print, dhcp_socket_encode, dhcp_socket_decode },
+#else
+       { NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+#endif
+
        { NULL, NULL, NULL, NULL, NULL, NULL, NULL}     /* RAD_LISTEN_SNMP */
 };
 
@@ -946,6 +964,7 @@ static rad_listen_t *listen_alloc(RAD_LISTEN_TYPE type)
        case RAD_LISTEN_ACCT:
        case RAD_LISTEN_PROXY:
        case RAD_LISTEN_VQP:
+       case RAD_LISTEN_DHCP:
                this->data = rad_malloc(sizeof(listen_socket_t));
                memset(this->data, 0, sizeof(listen_socket_t));
                break;
@@ -1041,6 +1060,11 @@ static const FR_NAME_NUMBER listen_compare[] = {
 #ifdef WITH_VMPS
        { "vmps",       RAD_LISTEN_VQP },
 #endif
+#ifdef WITH_DHCP
+       { "dhcp",       RAD_LISTEN_DHCP },
+#else
+       { "dhcp",       RAD_LISTEN_NONE },
+#endif
        { NULL, 0 },
 };