/*
* kadmin/server/network.c
*
- * Copyright 1990,2000,2007,2008 by the Massachusetts Institute of Technology.
+ * Copyright 1990,2000,2007,2008,2009 by the Massachusetts Institute of Technology.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
/* kadmin data. */
-enum kadm_conn_type { CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER,
- CONN_TCP, CONN_ROUTING, CONN_RPC_LISTENER, CONN_RPC };
+enum conn_type {
+ CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP,
+ CONN_RPC_LISTENER, CONN_RPC,
+ CONN_ROUTING
+};
/* Per-connection info. */
struct connection {
int fd;
- enum kadm_conn_type type;
+ enum conn_type type;
void (*service)(void *handle, struct connection *, const char *, int);
union {
/* Type-specific information. */
return 0;
}
-\f
-#define USE_AF AF_INET
-#define USE_TYPE SOCK_DGRAM
-
\f
#define USE_AF AF_INET
#define USE_TYPE SOCK_DGRAM
};
static struct connection *
-add_fd (struct socksetup *data, int sock, enum kadm_conn_type conntype,
+add_fd (struct socksetup *data, int sock, enum conn_type conntype,
void (*service)(void *handle, struct connection *, const char *, int))
{
struct connection *newconn;
/*
* kdc/network.c
*
- * Copyright 1990,2000,2007,2008 by the Massachusetts Institute of Technology.
+ * Copyright 1990,2000,2007,2008,2009 by the Massachusetts Institute of Technology.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
/* KDC data. */
-enum kdc_conn_type { CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP, CONN_ROUTING };
+enum conn_type {
+ CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP,
+ CONN_ROUTING
+};
/* Per-connection info. */
struct connection {
int fd;
- enum kdc_conn_type type;
+ enum conn_type type;
void (*service)(struct connection *, const char *, int);
union {
/* Type-specific information. */
-#if 0
- struct {
- int x;
- } udp;
- struct {
- int x;
- } udp_pktinfo;
- struct {
- int x;
- } tcp_listener;
-#endif
struct {
/* connection */
struct sockaddr_storage addr_s;
};
static struct connection *
-add_fd (struct socksetup *data, int sock, enum kdc_conn_type conntype,
+add_fd (struct socksetup *data, int sock, enum conn_type conntype,
void (*service)(struct connection *, const char *, int))
{
struct connection *newconn;
/* Sockets are created, prepare to listen on them. */
if (s4 >= 0) {
- if (add_tcp_listener_fd(data, s4) == 0)
+ if (add_tcp_listener_fd(data, s4) == NULL)
close(s4);
else {
FD_SET(s4, &sstate.rfds);
}
#ifdef KRB5_USE_INET6
if (s6 >= 0) {
- if (add_tcp_listener_fd(data, s6) == 0) {
+ if (add_tcp_listener_fd(data, s6) == NULL) {
close(s6);
s6 = -1;
} else {
sockdata.retval = 0;
newconn = add_tcp_data_fd(&sockdata, s);
- if (newconn == 0)
+ if (newconn == NULL)
return;
if (getnameinfo((struct sockaddr *)&addr_s, addrlen,