]> err.no Git - sope/blob - sope-appserver/mod_ngobjweb/common.h
added strict OSX bundle dependencies
[sope] / sope-appserver / mod_ngobjweb / common.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __NGObjWeb_Adaptors_apache_H__
23 #define __NGObjWeb_Adaptors_apache_H__
24
25 /* System includes */
26
27 #include <strings.h>
28 #include <netdb.h>
29 #include <sys/types.h>
30 #include <netinet/in.h>
31 #include <sys/un.h>
32 #include <arpa/inet.h>
33 #include <unistd.h>
34
35 /* Apache includes */
36
37 #include <httpd.h>
38 #include <http_core.h>
39 #include <http_config.h>
40 #include <http_log.h>
41 #include <http_protocol.h>
42
43 #if MODULE_MAGIC_NUMBER_MAJOR >= 20010224
44 /* apache ap version 2 */
45 #include "apr.h"
46 #include "apr_buckets.h"
47 #include "apr_strings.h"
48 #include "apr_portable.h"
49 #include "apr_optional.h"
50 #include "apr_lib.h"
51 #include "ap_config.h"
52 #include "ap_listen.h"
53 #else
54 /* for compatibility */
55 #define AP_VERSION_1
56
57 #define apr_array_header_t array_header
58 #define apr_inet_addr      inet_addr
59 #define apr_isalnum        isalnum
60 #define apr_isspace        isspace
61 #define apr_palloc         ap_palloc
62 #define apr_pcalloc        ap_pcalloc
63 #define apr_pool_t         pool
64 #define apr_table_elts     ap_table_elts
65 #define apr_table_entry_t  table_entry
66 #define apr_table_get      ap_table_get
67 #define apr_table_make     ap_make_table
68 #define apr_table_set      ap_table_set
69 #define apr_table_t        table
70 #define apr_sleep          sleep
71 #define apr_snprintf       snprintf
72
73 #define ap_log_error(file, line, level, status, vars...) \
74         ap_log_error(file, line, level, ## vars)
75 #endif
76
77 #include "NGBufferedDescriptor.h"
78
79 module ngobjweb_module;
80
81 typedef struct {
82   char *snsPort;  /* the port of the SNS daemon                */
83   int  snsPortDomain;
84   
85   char *appPort; /* a single pass-through port of an instance */
86   int  appPortDomain;
87   
88   char *appPrefix;
89   int  useHTTP;
90 } ngobjweb_dir_config;
91
92 #define MAX_PORTNAME_SIZE   140
93 #define MAX_SNS_PATH_SIZE   MAX_PORTNAME_SIZE
94 #define MAX_APP_PREFIX_SIZE 256
95
96 /* SNS */
97
98 extern void *
99 _sendSNSQuery(request_rec *_rq, const char *_line, const char *_cookie,
100               int *_domain, size_t *_len,
101               const char *_appName,
102               ngobjweb_dir_config *_cfg);
103
104 /* HTTP */
105
106 extern unsigned char
107 NGScanResponseLine(NGBufferedDescriptor *_in,
108                    unsigned char *_version, int *_status, 
109                    unsigned char *_text);
110 extern apr_table_t *NGScanHeaders(apr_pool_t *_pool, NGBufferedDescriptor *_in);
111
112 /* handlers */
113
114 extern int ngobjweb_handler(request_rec *r);
115
116 /* commands */
117
118 extern const char *ngobjweb_set_sns_port(cmd_parms *cmd,
119                                          ngobjweb_dir_config *cfg,
120                                          char *arg);
121 extern const char *ngobjweb_set_app_port(cmd_parms *cmd,
122                                          ngobjweb_dir_config *cfg,
123                                          char *arg);
124 extern const char *ngobjweb_set_app_prefix(cmd_parms *cmd,
125                                            ngobjweb_dir_config *cfg,
126                                            char *arg);
127 extern const char *ngobjweb_set_use_http(cmd_parms *cmd,
128                                          ngobjweb_dir_config *cfg);
129
130 /* configuration */
131
132 extern void *ngobjweb_create_dir_config(apr_pool_t *p, char *dummy);
133 extern void *ngobjweb_merge_dir_configs(apr_pool_t *p, void *basev, void *addv);
134
135 #endif /* __NGObjWeb_Adaptors_apache_H__ */