Fixed the splitting from previous commit and splitted the ip parsers from condition handling

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent d64f5d4788
commit 40fbc9c8b7
  1. 2
      include/lighttpd/base.h
  2. 8
      include/lighttpd/condition.h
  3. 13
      include/lighttpd/ip_parsers.h
  4. 7
      src/CMakeLists.txt
  5. 1
      src/angel_fake.c
  6. 2
      src/ip_parsers.rl
  7. 1
      src/utils.c

@ -38,6 +38,7 @@
#include <lighttpd/worker.h>
#include <lighttpd/angel.h>
#include <lighttpd/condition.h>
#include <lighttpd/ip_parsers.h>
#include <lighttpd/options.h>
#include <lighttpd/value.h>
#include <lighttpd/actions.h>
@ -61,6 +62,7 @@
#include <lighttpd/encoding.h>
#include <lighttpd/etag.h>
#include <lighttpd/utils.h>
#include <lighttpd/lighttpd-glue.h>
#define SERVER_VERSION ((guint) 0x01FF0000)

@ -124,12 +124,4 @@ LI_API cond_lvalue_t cond_lvalue_from_string(const gchar *str, guint len);
struct vrequest;
LI_API handler_t condition_check(struct vrequest *vr, condition *cond, gboolean *result);
/* parser */
/** parse an IPv4 (if netmask is not NULL with optional cidr netmask, if port is not NULL with optional port) */
LI_API gboolean parse_ipv4(const char *str, guint32 *ip, guint32 *netmask, guint16 *port);
/** parse an IPv6 (if network is not NULL with optional cidr network, if port is not NULL with optional port if the ip/cidr part is in [...]) */
LI_API gboolean parse_ipv6(const char *str, guint8 *ip, guint *network, guint16 *port);
/** print the ip into dest, return dest */
LI_API GString* ipv6_tostring(GString *dest, const guint8 ip[16]);
#endif

@ -0,0 +1,13 @@
#ifndef _LIGHTTPD_IP_PARSERS_H_
#define _LIGHTTPD_IP_PARSERS_H_
#include <lighttpd/settings.h>
/** parse an IPv4 (if netmask is not NULL with optional cidr netmask, if port is not NULL with optional port) */
LI_API gboolean parse_ipv4(const char *str, guint32 *ip, guint32 *netmask, guint16 *port);
/** parse an IPv6 (if network is not NULL with optional cidr network, if port is not NULL with optional port if the ip/cidr part is in [...]) */
LI_API gboolean parse_ipv6(const char *str, guint8 *ip, guint *network, guint16 *port);
/** print the ip into dest, return dest */
LI_API GString* ipv6_tostring(GString *dest, const guint8 ip[16]);
#endif

@ -271,7 +271,6 @@ SET(COMMON_SRC
chunk_parser.c
collect.c
condition.c
condition_parsers.c
config_parser.c
connection.c
encoding.c
@ -281,6 +280,8 @@ SET(COMMON_SRC
http_headers.c
http_request_parser.c
http_response_parser.c
ip_parsers.c
lighttpd-glue.c
log.c
module.c
network.c
@ -317,10 +318,10 @@ SET(COMMON_SRC ${COMMON_SRC}
ENDIF(WITH_LUA)
## Build parsers by using ragel...
RAGEL_PARSER(condition_parsers.rl)
RAGEL_PARSER(config_parser.rl -T0)
RAGEL_PARSER(http_request_parser.rl)
RAGEL_PARSER(http_response_parser.rl)
RAGEL_PARSER(ip_parsers.rl)
RAGEL_PARSER(url_parser.rl)
RAGEL_PARSER(angel_config_parser.rl)
@ -366,7 +367,7 @@ ADD_EXECUTABLE(lighttpd-angel
angel_plugin_core.c
angel_server.c
angel_value.c
condition_parsers.c
ip_parsers.c
module.c
utils.c
)

@ -1,6 +1,7 @@
#include <lighttpd/base.h>
#include <lighttpd/angel.h>
#include <lighttpd/ip_parsers.h>
/* listen to a socket */
int angel_fake_listen(server *srv, GString *str) {

@ -1,5 +1,5 @@
#include <lighttpd/base.h>
#include <lighttpd/ip_parsers.h>
%%{
machine ipv4_parser;

@ -1,6 +1,7 @@
#include <lighttpd/utils.h>
#include <lighttpd/ip_parsers.h>
#include <stdio.h>
#include <fcntl.h>

Loading…
Cancel
Save