File: common.h

package info (click to toggle)
sope 5.12.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 16,592 kB
  • sloc: objc: 169,229; sh: 3,823; ansic: 3,409; javascript: 446; python: 318; makefile: 185
file content (135 lines) | stat: -rw-r--r-- 4,014 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
  Copyright (C) 2000-2005 SKYRIX Software AG

  This file is part of SOPE.

  SOPE is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the
  Free Software Foundation; either version 2, or (at your option) any
  later version.

  SOPE 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 Lesser General Public
  License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with SOPE; see the file COPYING.  If not, write to the
  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.
*/

#ifndef __NGObjWeb_Adaptors_apache_H__
#define __NGObjWeb_Adaptors_apache_H__

/* System includes */

#include <strings.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <unistd.h>

/* Apache includes */

#include <httpd.h>
#include <http_core.h>
#include <http_config.h>
#include <http_log.h>
#include <http_protocol.h>

#if MODULE_MAGIC_NUMBER_MAJOR >= 20010224
/* apache ap version 2 */
#include "apr.h"
#include "apr_buckets.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_optional.h"
#include "apr_lib.h"
#include "ap_config.h"
#include "ap_listen.h"
#else
/* for compatibility */
#define AP_VERSION_1

#define apr_array_header_t array_header
#define apr_inet_addr      inet_addr
#define apr_isalnum        isalnum
#define apr_isspace        isspace
#define apr_palloc         ap_palloc
#define apr_pcalloc        ap_pcalloc
#define apr_pool_t         pool
#define apr_table_elts     ap_table_elts
#define apr_table_entry_t  table_entry
#define apr_table_get      ap_table_get
#define apr_table_make     ap_make_table
#define apr_table_set      ap_table_set
#define apr_table_t        table
#define apr_sleep          sleep
#define apr_snprintf       snprintf

#define ap_log_error(file, line, level, status, vars...) \
	ap_log_error(file, line, level, ## vars)
#endif

#include "NGBufferedDescriptor.h"

module ngobjweb_module;

typedef struct {
  char *snsPort;  /* the port of the SNS daemon                */
  int  snsPortDomain;
  
  char *appPort; /* a single pass-through port of an instance */
  int  appPortDomain;
  
  char *appPrefix;
  int  useHTTP;
} ngobjweb_dir_config;

#define MAX_PORTNAME_SIZE   140
#define MAX_SNS_PATH_SIZE   MAX_PORTNAME_SIZE
#define MAX_APP_PREFIX_SIZE 256

/* SNS */

extern void *
_sendSNSQuery(request_rec *_rq, const char *_line, const char *_cookie,
              int *_domain, size_t *_len,
              const char *_appName,
              ngobjweb_dir_config *_cfg);

/* HTTP */

extern unsigned char
NGScanResponseLine(NGBufferedDescriptor *_in,
                   unsigned char *_version, int *_status, 
                   unsigned char *_text);
extern apr_table_t *NGScanHeaders(apr_pool_t *_pool, NGBufferedDescriptor *_in);

/* handlers */

extern int ngobjweb_handler(request_rec *r);

/* commands */

extern const char *ngobjweb_set_sns_port(cmd_parms *cmd,
                                         ngobjweb_dir_config *cfg,
                                         char *arg);
extern const char *ngobjweb_set_app_port(cmd_parms *cmd,
                                         ngobjweb_dir_config *cfg,
                                         char *arg);
extern const char *ngobjweb_set_app_prefix(cmd_parms *cmd,
                                           ngobjweb_dir_config *cfg,
                                           char *arg);
extern const char *ngobjweb_set_use_http(cmd_parms *cmd,
                                         ngobjweb_dir_config *cfg);

/* configuration */

extern void *ngobjweb_create_dir_config(apr_pool_t *p, char *dummy);
extern void *ngobjweb_merge_dir_configs(apr_pool_t *p, void *basev, void *addv);

#endif /* __NGObjWeb_Adaptors_apache_H__ */