summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-01-29 14:37:19 -0500
committerSimo Sorce <simo@redhat.com>2012-01-29 18:01:27 -0500
commit858ffae8c72d9cb617534728e0d3ce4cacb4535c (patch)
treea68f58e1415789b19d34438266542d9287cba1b1
parent41b087961ebe72c64255ceeddc82759773a827c0 (diff)
downloadgss-proxy-858ffae8c72d9cb617534728e0d3ce4cacb4535c.tar.gz
gss-proxy-858ffae8c72d9cb617534728e0d3ce4cacb4535c.tar.xz
gss-proxy-858ffae8c72d9cb617534728e0d3ce4cacb4535c.zip
Split gp_utils.h into proxy headers and commonly useful headers
-rw-r--r--proxy/src/gp_common.h57
-rw-r--r--proxy/src/gp_config.c2
-rw-r--r--proxy/src/gp_init.c2
-rw-r--r--proxy/src/gp_proxy.h (renamed from proxy/src/gp_utils.h)35
-rw-r--r--proxy/src/gp_rpc_process.h5
-rw-r--r--proxy/src/gp_socket.c2
-rw-r--r--proxy/src/gp_workers.c2
-rw-r--r--proxy/src/gssproxy.c2
-rw-r--r--proxy/tests/accept_context.c2
9 files changed, 71 insertions, 38 deletions
diff --git a/proxy/src/gp_common.h b/proxy/src/gp_common.h
new file mode 100644
index 0000000..2052e94
--- /dev/null
+++ b/proxy/src/gp_common.h
@@ -0,0 +1,57 @@
+/*
+ GSS-PROXY
+
+ Copyright (C) 2011 Red Hat, Inc.
+ Copyright (C) 2011 Simo Sorce <simo.sorce@redhat.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _GP_COMMON_H_
+#define _GP_COMMON_H_
+
+/* add element to list head */
+#define LIST_ADD(list, elem) do { \
+ elem->prev = NULL; \
+ elem->next = list; \
+ if (list) { \
+ list->prev = elem; \
+ } \
+ list = elem; \
+} while (0)
+
+/* remove element from list */
+#define LIST_DEL(list, elem) do { \
+ if (elem->next) { \
+ elem->next->prev = elem->prev; \
+ } \
+ if (elem->prev) { \
+ elem->prev->next = elem->next; \
+ } \
+ if (list == elem) { \
+ list = elem->next; \
+ } \
+ elem->prev = NULL; \
+ elem->next = NULL; \
+} while (0)
+
+/* max out at 1MB for now */
+#define MAX_RPC_SIZE 1024*1024
+
+#endif /* _GP_COMMON_H_ */
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
index c0b4b47..8b86a5b 100644
--- a/proxy/src/gp_config.c
+++ b/proxy/src/gp_config.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <syslog.h>
#include <errno.h>
-#include "gp_utils.h"
+#include "gp_proxy.h"
#include "iniparser.h"
#define GP_SOCKET_NAME "gssproxy.socket"
diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c
index 04eb0e0..6c9c5ef 100644
--- a/proxy/src/gp_init.c
+++ b/proxy/src/gp_init.c
@@ -29,7 +29,7 @@
#include <locale.h>
#include <syslog.h>
#include <signal.h>
-#include "gp_utils.h"
+#include "gp_proxy.h"
void init_server(bool daemonize)
{
diff --git a/proxy/src/gp_utils.h b/proxy/src/gp_proxy.h
index 37ad602..0cf24bb 100644
--- a/proxy/src/gp_utils.h
+++ b/proxy/src/gp_proxy.h
@@ -23,41 +23,17 @@
DEALINGS IN THE SOFTWARE.
*/
-#ifndef _SRV_UTILS_H_
-#define _SRV_UTILS_H_
+#ifndef _GP_PROXY_H_
+#define _GP_PROXY_H_
#include <libintl.h>
#include <stdbool.h>
#include <stdint.h>
#include "verto.h"
+#include "gp_common.h"
#define _(STRING) gettext(STRING)
-/* add element to list head */
-#define LIST_ADD(list, elem) do { \
- elem->prev = NULL; \
- elem->next = list; \
- if (list) { \
- list->prev = elem; \
- } \
- list = elem; \
-} while (0)
-
-/* remove element from list */
-#define LIST_DEL(list, elem) do { \
- if (elem->next) { \
- elem->next->prev = elem->prev; \
- } \
- if (elem->prev) { \
- elem->prev->next = elem->next; \
- } \
- if (list == elem) { \
- list = elem->next; \
- } \
- elem->prev = NULL; \
- elem->next = NULL; \
-} while (0)
-
struct gp_config {
char *config_file; /* gssproxy configuration file */
bool daemonize; /* let gssproxy daemonize */
@@ -96,12 +72,9 @@ void gp_workers_free(struct gp_workers *w);
int gp_query_new(struct gp_workers *w, struct gp_conn *conn,
uint8_t *buffer, size_t buflen);
-/* max out at 1MB for now */
-#define MAX_RPC_SIZE 1024*1024
-
/* from gp_rpc.c */
int gp_rpc_process_call(struct gssproxy_ctx *gpctx,
uint8_t *inbuf, size_t inlen,
uint8_t **outbuf, size_t *outlen);
-#endif /* _SRV_UTILS_H_ */
+#endif /* _GP_PROXY_H_ */
diff --git a/proxy/src/gp_rpc_process.h b/proxy/src/gp_rpc_process.h
index bb1077c..cf90de3 100644
--- a/proxy/src/gp_rpc_process.h
+++ b/proxy/src/gp_rpc_process.h
@@ -28,14 +28,17 @@
#include "config.h"
#include <stdint.h>
+#include <stdbool.h>
#include <errno.h>
#include <gssapi/gssapi.h>
-#include "gp_utils.h"
+#include "gp_common.h"
#include "gp_conv.h"
#include "gp_export.h"
#include "rpcgen/gss_proxy.h"
#include "rpcgen/gp_rpc.h"
+struct gssproxy_ctx;
+
union gp_rpc_arg {
gssx_arg_release_handle release_handle;
gssx_arg_indicate_mechs indicate_mechs;
diff --git a/proxy/src/gp_socket.c b/proxy/src/gp_socket.c
index 664d6f4..e727715 100644
--- a/proxy/src/gp_socket.c
+++ b/proxy/src/gp_socket.c
@@ -34,7 +34,7 @@
#include <syslog.h>
#include <errno.h>
#include <netinet/in.h>
-#include "gp_utils.h"
+#include "gp_proxy.h"
#define CRED_TYPE_NONE 0x00
#define CRED_TYPE_UNIX 0x01
diff --git a/proxy/src/gp_workers.c b/proxy/src/gp_workers.c
index 47cab34..1191221 100644
--- a/proxy/src/gp_workers.c
+++ b/proxy/src/gp_workers.c
@@ -32,7 +32,7 @@
#include <fcntl.h>
#include <syslog.h>
#include <errno.h>
-#include "gp_utils.h"
+#include "gp_proxy.h"
#define DEFAULT_WORKER_THREADS_NUM 5
diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c
index 2f25899..311cc52 100644
--- a/proxy/src/gssproxy.c
+++ b/proxy/src/gssproxy.c
@@ -26,7 +26,7 @@
#include "config.h"
#include <stdlib.h>
#include "popt.h"
-#include "gp_utils.h"
+#include "gp_proxy.h"
int main(int argc, const char *argv[])
{
diff --git a/proxy/tests/accept_context.c b/proxy/tests/accept_context.c
index e493272..73d6033 100644
--- a/proxy/tests/accept_context.c
+++ b/proxy/tests/accept_context.c
@@ -35,7 +35,7 @@
#include <netinet/in.h>
#include <pthread.h>
#include <gssapi/gssapi.h>
-#include "src/gp_utils.h"
+#include "src/gp_proxy.h"
#include "src/gp_rpc_process.h"
#include "src/gp_conv.h"
#include "popt.h"