summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_conf_file.c2
-rw-r--r--src/core/ngx_config.h5
-rw-r--r--src/core/ngx_connection.h8
-rw-r--r--src/core/ngx_core.h1
-rw-r--r--src/core/ngx_file.h2
-rw-r--r--src/core/ngx_inet.c26
-rw-r--r--src/core/ngx_inet.h1
-rw-r--r--src/core/ngx_listen.h1
-rw-r--r--src/core/ngx_log.h2
9 files changed, 40 insertions, 8 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index e11200114..8497e2d02 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -1,6 +1,8 @@
#include <ngx_config.h>
+
#include <ngx_core.h>
+#include <ngx_files.h>
#include <ngx_conf_file.h>
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 2797a8df3..a90a1dc4b 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -21,6 +21,11 @@
#define ngx_align(p) (char *) (((NGX_ALIGN_TYPE) p + NGX_ALIGN) & ~NGX_ALIGN)
+
+/* Platform specific: array[NGX_INVALID_ARRAY_INDEX] should cause SIGSEGV */
+#define NGX_INVALID_ARRAY_INDEX 0x80000000
+
+
#ifdef _WIN32
#define WIN32 1
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index a94640d74..93f6cbdc3 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -19,10 +19,6 @@ struct ngx_connection_s {
ngx_socket_t fd;
void *data;
- /* STUB */
- ngx_array_t *requests;
- int requests_len;
-
#ifdef NGX_EVENT
ngx_event_t *read;
ngx_event_t *write;
@@ -34,9 +30,11 @@ struct ngx_connection_s {
void *ctx;
ngx_server_t *servers;
- ngx_pool_t *pool;
ngx_log_t *log;
+ ngx_pool_t *pool;
+ int pool_size;
+
int family;
struct sockaddr *sockaddr;
socklen_t socklen;
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index adab5018c..8170f858d 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -8,6 +8,7 @@
#define NGX_AGAIN -2
#define NGX_WAITING -3
#define NGX_DECLINED -4
+#define NGX_ALERT -5
#define NGX_MAXHOSTNAMELEN 32
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index e827aff0e..c1bb3c2f3 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -2,7 +2,7 @@
#define _NGX_FILE_H_INCLUDED_
-#include <ngx_files.h>
+#include <ngx_file.h>
#include <ngx_log.h>
#include <ngx_string.h>
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index aba990b41..b566e1a25 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -4,10 +4,34 @@
#include <ngx_inet.h>
+/* AF_INET only */
+
+size_t ngx_sock_ntop(int family, struct sockaddr *addr, char *text, size_t len)
+{
+ char *p;
+ struct sockaddr_in *addr_in;
+
+ if (family != AF_INET) {
+ return 0;
+ }
+
+ addr_in = (struct sockaddr_in *) addr;
+ p = (char *) &addr_in->sin_addr;
+
+ return ngx_snprintf(text, len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
+ "%u.%u.%u.%u",
+ (unsigned char) p[0],
+ (unsigned char) p[1],
+ (unsigned char) p[2],
+ (unsigned char) p[3]);
+}
+
+
size_t ngx_inet_ntop(int family, char *addr, char *text, size_t len)
{
- if (family != AF_INET)
+ if (family != AF_INET) {
return 0;
+ }
return ngx_snprintf(text, len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
"%u.%u.%u.%u",
diff --git a/src/core/ngx_inet.h b/src/core/ngx_inet.h
index 0766d1fac..9f714441f 100644
--- a/src/core/ngx_inet.h
+++ b/src/core/ngx_inet.h
@@ -2,6 +2,7 @@
#define _NGX_INET_H_INCLUDED_
+size_t ngx_sock_ntop(int family, struct sockaddr *addr, char *text, size_t len);
size_t ngx_inet_ntop(int family, char *addr, char *text, size_t len);
diff --git a/src/core/ngx_listen.h b/src/core/ngx_listen.h
index 91f39ad74..61f08fdee 100644
--- a/src/core/ngx_listen.h
+++ b/src/core/ngx_listen.h
@@ -28,6 +28,7 @@ typedef struct {
void *servers; /* array of ngx_http_in_addr_t, for example */
ngx_log_t *log;
+ int pool_size;
int backlog;
time_t post_accept_timeout; /* should be here because
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index d79237ef0..c7b780fdd 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -2,8 +2,8 @@
#define _NGX_LOG_H_INCLUDED_
+#include <ngx_types.h>
#include <ngx_errno.h>
-#include <ngx_files.h>
typedef enum {
NGX_LOG_EMERG = 0,