summaryrefslogtreecommitdiff
path: root/source4/include
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 22:48:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:11 -0500
commit284349482f5293a9a23d0f72d7c2aab46b55843b (patch)
tree6f96931afb18ea841983a2895b62c97fed9f77b7 /source4/include
parent9f14afa12c11d02a49f4f310c3f8d834ce8a835d (diff)
downloadsamba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.gz
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.bz2
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.zip
r3443: the next stage in the include files re-organisation.
I have created the include/system/ directory, which will contain the wrappers for the system includes for logical subsystems. So far I have created include/system/kerberos.h and include/system/network.h, which contain all the system includes for kerberos code and networking code. These are the included in subsystems that need kerberos or networking respectively. Note that this method avoids the mess of #ifdef HAVE_XXX_H in every C file, instead each C module includes the include/system/XXX.h file for the logical system support it needs, and the details are kept isolated in include/system/ This patch also creates a "struct ipv4_addr" which replaces "struct in_addr" in our code. That avoids every C file needing to import all the system networking headers. (This used to be commit 2e25c71853f8996f73755277e448e7d670810349)
Diffstat (limited to 'source4/include')
-rw-r--r--source4/include/ads.h2
-rw-r--r--source4/include/includes.h78
-rw-r--r--source4/include/interfaces.h12
-rw-r--r--source4/include/nameserv.h32
-rw-r--r--source4/include/structs.h1
-rw-r--r--source4/include/system/README4
-rw-r--r--source4/include/system/kerberos.h44
-rw-r--r--source4/include/system/network.h60
8 files changed, 135 insertions, 98 deletions
diff --git a/source4/include/ads.h b/source4/include/ads.h
index 71bca6eb71..8db0209573 100644
--- a/source4/include/ads.h
+++ b/source4/include/ads.h
@@ -22,7 +22,7 @@
typedef struct {
void *ld; /* the active ldap structure */
- struct in_addr ldap_ip; /* the ip of the active connection, if any */
+ struct ipv4_addr ldap_ip; /* the ip of the active connection, if any */
time_t last_attempt; /* last attempt to reconnect */
int ldap_port;
diff --git a/source4/include/includes.h b/source4/include/includes.h
index 374abc4c37..a9198dbc1d 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -83,6 +83,7 @@
#endif /* RELIANTUNIX */
#include <sys/types.h>
+#include <stdint.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
@@ -114,14 +115,6 @@
#include <stdlib.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_UNIXSOCKET
-#include <sys/un.h>
-#endif
-
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#elif HAVE_SYSCALL_H
@@ -213,10 +206,6 @@
#include <varargs.h>
#endif
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#else
@@ -227,27 +216,6 @@
#include <sys/file.h>
-#ifdef HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
-#endif
-
-/*
- * The next three defines are needed to access the IPTOS_* options
- * on some systems.
- */
-
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_IP_H
-#include <netinet/in_ip.h>
-#endif
-
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
#if defined(HAVE_TERMIOS_H)
/* POSIX terminal handling. */
#include <termios.h>
@@ -280,11 +248,6 @@
#include <sys/mman.h>
#endif
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
@@ -374,28 +337,6 @@
#endif
#endif
-#ifdef HAVE_KRB5_H
-#include <krb5.h>
-#else
-#undef HAVE_KRB5
-#endif
-
-#ifdef HAVE_GSSAPI_H
-#include <gssapi.h>
-#endif
-
-#ifdef HAVE_GSSAPI_GSSAPI_H
-#include <gssapi/gssapi.h>
-#endif
-
-#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
-#include <gssapi/gssapi_generic.h>
-#endif
-
-#ifdef HAVE_COM_ERR_H
-#include <com_err.h>
-#endif
-
/* we support ADS if we want it and have krb5 and ldap libs */
#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
#define HAVE_ADS
@@ -466,6 +407,14 @@ typedef int socklen_t;
#define uint64 uint64_t
#endif
+/*
+ we use struct ipv4_addr to avoid having to include all the
+ system networking headers everywhere
+*/
+struct ipv4_addr {
+ uint32_t s_addr;
+};
+
#ifndef UINT8_MAX
#define UINT8_MAX 255
#endif
@@ -518,7 +467,6 @@ extern int errno;
#include "talloc.h"
#include "db_wrap.h"
#include "nt_status.h"
-#include "interfaces.h"
#include "trans2.h"
#include "ioctl.h"
#include "nterr.h"
@@ -557,7 +505,6 @@ extern int errno;
#include "libcli/auth/ntlmssp.h"
#include "libcli/auth/credentials.h"
-#include "libcli/auth/kerberos.h"
#include "libcli/auth/gensec.h"
#include "libcli/auth/spnego.h"
#include "auth/auth.h"
@@ -721,13 +668,6 @@ unsigned long strtoul(const char *nptr, char **endptr, int base);
int setenv(const char *name, const char *value, int overwrite);
#endif
-#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
-/* stupid glibc */
-int setresuid(uid_t ruid, uid_t euid, uid_t suid);
-#endif
-#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
-int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
-#endif
#ifndef HAVE_VASPRINTF_DECL
int vasprintf(char **ptr, const char *format, va_list ap);
#endif
diff --git a/source4/include/interfaces.h b/source4/include/interfaces.h
index 3b786f1ebc..e69de29bb2 100644
--- a/source4/include/interfaces.h
+++ b/source4/include/interfaces.h
@@ -1,12 +0,0 @@
-/*
- This structure is used by lib/interfaces.c to return the list of network
- interfaces on the machine
-*/
-
-#define MAX_INTERFACES 128
-
-struct iface_struct {
- char name[16];
- struct in_addr ip;
- struct in_addr netmask;
-};
diff --git a/source4/include/nameserv.h b/source4/include/nameserv.h
index 33ee8f99e6..9efee46466 100644
--- a/source4/include/nameserv.h
+++ b/source4/include/nameserv.h
@@ -206,7 +206,7 @@ struct nmb_data
{
uint16_t nb_flags; /* Netbios flags. */
int num_ips; /* Number of ip entries. */
- struct in_addr *ip; /* The ip list for this name. */
+ struct ipv4_addr *ip; /* The ip list for this name. */
enum name_source source; /* Where the name came from. */
@@ -214,7 +214,7 @@ struct nmb_data
time_t refresh_time; /* The time the record should be refreshed. */
uint64_t id; /* unique id */
- struct in_addr wins_ip; /* the adress of the wins server this record comes from */
+ struct ipv4_addr wins_ip; /* the adress of the wins server this record comes from */
int wins_flags; /* similar to the netbios flags but different ! */
};
@@ -238,7 +238,7 @@ struct browse_cache_record
#endif
pstring lmb_name;
pstring work_group;
- struct in_addr ip;
+ struct ipv4_addr ip;
time_t sync_time;
time_t death_time; /* The time the record must be removed. */
};
@@ -307,7 +307,7 @@ struct work_record
/* Domain master browser info. Used for efficient syncs. */
struct nmb_name dmb_name;
- struct in_addr dmb_addr;
+ struct ipv4_addr dmb_addr;
};
/* typedefs needed to define copy & free functions for userdata. */
@@ -353,7 +353,7 @@ typedef void (*register_name_success_function)( struct subnet_record *,
struct nmb_name *,
uint16_t,
int,
- struct in_addr);
+ struct ipv4_addr);
typedef void (*register_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
@@ -361,7 +361,7 @@ typedef void (*register_name_fail_function)( struct subnet_record *,
typedef void (*release_name_success_function)( struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
- struct in_addr);
+ struct ipv4_addr);
typedef void (*release_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
@@ -371,7 +371,7 @@ typedef void (*refresh_name_success_function)( struct subnet_record *,
struct nmb_name *,
uint16_t,
int,
- struct in_addr);
+ struct ipv4_addr);
typedef void (*refresh_name_fail_function)( struct subnet_record *,
struct response_record *,
struct nmb_name *);
@@ -379,7 +379,7 @@ typedef void (*refresh_name_fail_function)( struct subnet_record *,
typedef void (*query_name_success_function)( struct subnet_record *,
struct userdata_struct *,
struct nmb_name *,
- struct in_addr,
+ struct ipv4_addr,
struct res_rec *answers);
typedef void (*query_name_fail_function)( struct subnet_record *,
@@ -390,7 +390,7 @@ typedef void (*query_name_fail_function)( struct subnet_record *,
typedef void (*node_status_success_function)( struct subnet_record *,
struct userdata_struct *,
struct res_rec *,
- struct in_addr);
+ struct ipv4_addr);
typedef void (*node_status_fail_function)( struct subnet_record *,
struct response_record *);
@@ -457,9 +457,9 @@ struct subnet_record
BOOL namelist_changed;
BOOL work_changed;
- struct in_addr bcast_ip;
- struct in_addr mask_ip;
- struct in_addr myip;
+ struct ipv4_addr bcast_ip;
+ struct ipv4_addr mask_ip;
+ struct ipv4_addr myip;
int nmb_sock; /* socket to listen for unicast 137. */
int dgram_sock; /* socket to listen for unicast 138. */
};
@@ -535,7 +535,7 @@ struct dgram_packet {
BOOL more;
} flags;
int dgm_id;
- struct in_addr source_ip;
+ struct ipv4_addr source_ip;
int source_port;
int dgm_length;
int packet_offset;
@@ -554,7 +554,7 @@ struct packet_struct
struct packet_struct *next;
struct packet_struct *prev;
BOOL locked;
- struct in_addr ip;
+ struct ipv4_addr ip;
int port;
int fd;
time_t timestamp;
@@ -642,8 +642,8 @@ typedef struct _WINS_RECORD {
int wins_flags;
uint64_t id;
int num_ips;
- struct in_addr ip[25];
- struct in_addr wins_ip;
+ struct ipv4_addr ip[25];
+ struct ipv4_addr wins_ip;
} WINS_RECORD;
/* To be removed. */
diff --git a/source4/include/structs.h b/source4/include/structs.h
index 2757e6df57..e1e6de5d77 100644
--- a/source4/include/structs.h
+++ b/source4/include/structs.h
@@ -48,3 +48,4 @@ struct samr_CryptPasswordEx;
struct netr_SamInfo3;
struct netr_Authenticator;
+struct iface_struct;
diff --git a/source4/include/system/README b/source4/include/system/README
new file mode 100644
index 0000000000..69a2b80b56
--- /dev/null
+++ b/source4/include/system/README
@@ -0,0 +1,4 @@
+This directory contains wrappers around logical groups of system
+include files. The idea is to avoid #ifdef blocks in the main code,
+and instead put all the necessary conditional includes in subsystem
+specific header files in this directory.
diff --git a/source4/include/system/kerberos.h b/source4/include/system/kerberos.h
new file mode 100644
index 0000000000..85c635e223
--- /dev/null
+++ b/source4/include/system/kerberos.h
@@ -0,0 +1,44 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ kerberos system include wrappers
+
+ Copyright (C) Andrew Tridgell 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+
+#ifdef HAVE_KRB5_H
+#include <krb5.h>
+#else
+#undef HAVE_KRB5
+#endif
+
+#ifdef HAVE_GSSAPI_H
+#include <gssapi.h>
+#endif
+
+#ifdef HAVE_GSSAPI_GSSAPI_H
+#include <gssapi/gssapi.h>
+#endif
+
+#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
+#include <gssapi/gssapi_generic.h>
+#endif
+
+#ifdef HAVE_COM_ERR_H
+#include <com_err.h>
+#endif
diff --git a/source4/include/system/network.h b/source4/include/system/network.h
new file mode 100644
index 0000000000..fcee0f7c24
--- /dev/null
+++ b/source4/include/system/network.h
@@ -0,0 +1,60 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ networking system include wrappers
+
+ Copyright (C) Andrew Tridgell 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef HAVE_UNIXSOCKET
+#include <sys/un.h>
+#endif
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+/*
+ * The next three defines are needed to access the IPTOS_* options
+ * on some systems.
+ */
+
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_IP_H
+#include <netinet/in_ip.h>
+#endif
+
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+