Data Structures | Defines | Functions | Variables

RemapConfig.cc File Reference

Remap configuration file parsing. More...

#include "RemapConfig.h"
#include "UrlRewrite.h"
#include "ReverseProxy.h"
#include "I_Layout.h"
#include "HTTP.h"
#include "libts.h"
#include "ink_cap.h"
Include dependency graph for RemapConfig.cc:

Go to the source code of this file.

Data Structures

struct  remap_directive

Defines

#define modulePrefix   "[ReverseProxy]"

Functions

static bool remap_parse_config_bti (const char *path, BUILD_TABLE_INFO *bti)
static int UrlWhack (char *toWhack, int *origLength)
 Returns the length of the URL.
static void clear_xstr_array (char *v[], size_t vsize)
 Cleanup *char[] array - each item in array must be allocated via ats_malloc or similar "x..." function.
static const char * process_filter_opt (url_mapping *mp, const BUILD_TABLE_INFO *bti, char *errStrBuf, int errStrBufSize)
static bool is_inkeylist (const char *key,...)
static const char * parse_define_directive (const char *directive, BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
static const char * parse_delete_directive (const char *directive, BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
static const char * parse_activate_directive (const char *directive, BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
static const char * parse_deactivate_directive (const char *directive, BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
static const char * parse_include_directive (const char *directive, BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
const char * remap_parse_directive (BUILD_TABLE_INFO *bti, char *errbuf, size_t errbufsize)
const char * remap_validate_filter_args (acl_filter_rule **rule_pp, const char **argv, int argc, char *errStrBuf, size_t errStrBufSize)
unsigned long remap_check_option (const char **argv, int argc, unsigned long findmode, int *_ret_idx, const char **argptr)
int remap_load_plugin (const char **argv, int argc, url_mapping *mp, char *errbuf, int errbufsize, int jump_to_argc, int *plugin_found_at)
static bool process_regex_mapping_config (const char *from_host_lower, url_mapping *new_mapping, UrlRewrite::RegexMapping *reg_map)
 will process the regex mapping configuration and create objects in output argument reg_map.
bool remap_parse_config (const char *path, UrlRewrite *rewrite)

Variables

static const remap_directive directives []

Detailed Description

Remap configuration file parsing.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file RemapConfig.cc.


Define Documentation

#define modulePrefix   "[ReverseProxy]"

Definition at line 32 of file RemapConfig.cc.

Referenced by remap_parse_config_bti().


Function Documentation

static void clear_xstr_array ( char *  v[],
size_t  vsize 
) [static]

Cleanup *char[] array - each item in array must be allocated via ats_malloc or similar "x..." function.

Definition at line 68 of file RemapConfig.cc.

References ats_free_null().

Referenced by BUILD_TABLE_INFO::reset().

static bool is_inkeylist ( const char *  key,
  ... 
) [static]

Definition at line 123 of file RemapConfig.cc.

References unlikely.

Referenced by remap_validate_filter_args().

static const char* parse_activate_directive ( const char *  directive,
BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
) [static]
static const char* parse_deactivate_directive ( const char *  directive,
BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
) [static]
static const char* parse_define_directive ( const char *  directive,
BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
) [static]
static const char* parse_delete_directive ( const char *  directive,
BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
) [static]
static const char* parse_include_directive ( const char *  directive,
BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
) [static]
static const char* process_filter_opt ( url_mapping mp,
const BUILD_TABLE_INFO bti,
char *  errStrBuf,
int  errStrBufSize 
) [static]
static bool process_regex_mapping_config ( const char *  from_host_lower,
url_mapping new_mapping,
UrlRewrite::RegexMapping reg_map 
) [static]
unsigned long remap_check_option ( const char **  argv,
int  argc,
unsigned long  findmode,
int *  _ret_idx,
const char **  argptr 
)
int remap_load_plugin ( const char **  argv,
int  argc,
url_mapping mp,
char *  errbuf,
int  errbufsize,
int  jump_to_argc,
int *  plugin_found_at 
)
bool remap_parse_config ( const char *  path,
UrlRewrite rewrite 
)

Definition at line 1260 of file RemapConfig.cc.

References remap_parse_config_bti(), and BUILD_TABLE_INFO::rewrite.

Referenced by UrlRewrite::BuildTable().

static bool remap_parse_config_bti ( const char *  path,
BUILD_TABLE_INFO bti 
) [static]

Definition at line 852 of file RemapConfig.cc.

References referer_info::any, BUILD_TABLE_INFO::argc, BUILD_TABLE_INFO::argv, ats_free_null(), ats_ip_ntop(), ats_is_ip(), ats_is_ip_any(), ats_malloc(), ats_strdup, BUILD_TABLE_MAX_ARGS, URL::copy(), URL::create(), Debug, url_mapping::default_redirect_url, url_mapping::filter_redirect_url, FORWARD_MAP, FORWARD_MAP_REFERER, FORWARD_MAP_WITH_RECV_PORT, url_mapping::fromURL, URL::host_get(), URL::host_set(), Tokenizer::Initialize(), UrlRewrite::InsertForwardMapping(), UrlRewrite::InsertMapping(), isascii, LowerCaseStr(), url_mapping::map_id, memcpy, modulePrefix, referer_info::negative, url_mapping::negative_referer, referer_info::next, url_mapping::optional_referer, BUILD_TABLE_INFO::paramc, BUILD_TABLE_INFO::paramv, PARSE_DONE, redirect_tag_str::parse_format_redirect_url(), URL::parse_no_path_component_breakdown(), process_filter_opt(), process_regex_mapping_config(), readIntoBuffer(), url_mapping::redir_chunk_list, url_mapping::referer_list, remap_check_option(), remap_load_plugin(), BUILD_TABLE_INFO::remap_optflg, REMAP_OPTFLG_MAP_ID, REMAP_OPTFLG_MAP_WITH_REFERER, REMAP_OPTFLG_PLUGIN, remap_parse_directive(), BUILD_TABLE_INFO::reset(), BUILD_TABLE_INFO::rewrite, URL::scheme_get(), URL::scheme_set(), SHARE_TOKS, SignalError, url_mapping::tag, tokLine(), url_mapping::toUrl, url_mapping::unique, unlikely, URL_LEN_HTTP, URL_SCHEME_FILE, URL_SCHEME_HTTP, URL_SCHEME_HTTPS, URL_SCHEME_TUNNEL, URL_SCHEME_WS, URL_SCHEME_WSS, UrlWhack(), Warning, and url_mapping::wildcard_from_scheme.

Referenced by parse_include_directive(), and remap_parse_config().

const char* remap_parse_directive ( BUILD_TABLE_INFO bti,
char *  errbuf,
size_t  errbufsize 
)

Definition at line 316 of file RemapConfig.cc.

References countof, Debug, BUILD_TABLE_INFO::paramv, remap_directive::parser, and unlikely.

Referenced by remap_parse_config_bti().

const char* remap_validate_filter_args ( acl_filter_rule **  rule_pp,
const char **  argv,
int  argc,
char *  errStrBuf,
size_t  errStrBufSize 
)
static int UrlWhack ( char *  toWhack,
int *  origLength 
) [static]

Returns the length of the URL.

Will replace the terminator with a '/' if this is a full URL and there are no '/' in it after the the host. This ensures that class URL parses the URL correctly.

Definition at line 45 of file RemapConfig.cc.

Referenced by remap_parse_config_bti().


Variable Documentation

const remap_directive directives[] [static]
Initial value:
 {

  { ".definefilter", parse_define_directive},
  { ".deffilter", parse_define_directive},
  { ".defflt", parse_define_directive},

  { ".deletefilter", parse_delete_directive},
  { ".delfilter", parse_delete_directive},
  { ".delflt", parse_delete_directive},

  { ".usefilter", parse_activate_directive},
  { ".activefilter", parse_activate_directive},
  { ".activatefilter", parse_activate_directive},
  { ".useflt", parse_activate_directive},

  { ".unusefilter", parse_deactivate_directive},
  { ".deactivatefilter", parse_deactivate_directive},
  { ".unactivefilter", parse_deactivate_directive},
  { ".deuseflt", parse_deactivate_directive},
  { ".unuseflt", parse_deactivate_directive},

  { ".include", parse_include_directive },
}

Definition at line 291 of file RemapConfig.cc.