Defines | Typedefs | Enumerations | Functions | Variables

ParentSelection.cc File Reference

Implementation of Parent Proxy routing. More...

#include "libts.h"
#include "P_EventSystem.h"
#include "ParentSelection.h"
#include "ControlMatcher.h"
#include "Main.h"
#include "Error.h"
#include "ProxyConfig.h"
#include "HTTP.h"
#include "HttpTransact.h"
Include dependency graph for ParentSelection.cc:

Go to the source code of this file.

Defines

#define PARENT_RegisterConfigUpdateFunc   REC_RegisterConfigUpdateFunc
#define PARENT_ReadConfigInteger   REC_ReadConfigInteger
#define PARENT_ReadConfigStringAlloc   REC_ReadConfigStringAlloc
#define TEST_FAIL(str)
#define T(x)   ink_strlcat(tbl,x, sizeof(tbl));
#define REBUILD   params->ParentTable = new P_table("", "ParentSelection Unit Test Table", &http_dest_tags, ALLOW_HOST_TABLE | ALLOW_REGEX_TABLE | ALLOW_URL_TABLE | ALLOW_IP_TABLE | DONT_BUILD_TABLE); params->ParentTable->BuildTableFromString(tbl);
#define REINIT   delete request; delete result; request = new HttpRequestData(); result = new ParentResult(); if (!result || !request) { (void)printf("Allocation failed\n"); return; }
#define ST(x)   printf ("*** TEST %d *** STARTING ***\n", x);
#define RE(x, y)   if (x) { printf("*** TEST %d *** PASSED ***\n", y); passes ++; } else { printf("*** TEST %d *** FAILED *** FAILED *** FAILED ***\n", y); fails++; }
#define FP   params->findParent(request, result);
#define TEST_IP4_ADDR   "209.131.62.14"
#define TEST_IP6_ADDR   "BEEF:DEAD:ABBA:CAFE:1337:1E1F:5EED:C0FF"

Typedefs

typedef ControlMatcher
< ParentRecord, ParentResult
P_table

Enumerations

enum  ParentCB_t {
  PARENT_FILE_CB, PARENT_DEFAULT_CB, PARENT_RETRY_CB, PARENT_ENABLE_CB,
  PARENT_THRESHOLD_CB, PARENT_DNS_ONLY_CB
}

Functions

ParentRecordcreateDefaultParent (char *val)
static int setup_socks_servers (ParentRecord *rec_arr, int len)
void request_to_data (HttpRequestData *req, sockaddr const *srcip, sockaddr const *dstip, const char *str)
EXCLUSIVE_REGRESSION_TEST() PARENTSELECTION (RegressionTest *, int, int *pstatus)
int verify (ParentResult *r, ParentResultType e, const char *h, int p)
void br (HttpRequestData *h, const char *os_hostname, sockaddr const *dest_ip)
void show_result (ParentResult *p)

Variables

static const char modulePrefix [] = "[ParentSelection]"
static ConfigUpdateHandler
< ParentConfig > * 
parentConfigUpdate = NULL
static const char * file_var = "proxy.config.http.parent_proxy.file"
static const char * default_var = "proxy.config.http.parent_proxies"
static const char * retry_var = "proxy.config.http.parent_proxy.retry_time"
static const char * enable_var = "proxy.config.http.parent_proxy_routing_enable"
static const char * threshold_var = "proxy.config.http.parent_proxy.fail_threshold"
static const char * dns_parent_only_var = "proxy.config.http.no_dns_just_forward_to_parent"
static const char * ParentResultStr []
static const char * ParentRRStr []
ParentRecord *const extApiRecord = (ParentRecord *) 0xeeeeffff
static Ptr< ProxyMutexsocks_server_reconfig_mutex
static int passes
static int fails

Detailed Description

Implementation of Parent Proxy routing.

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 ParentSelection.cc.


Define Documentation

#define FP   params->findParent(request, result);

Referenced by PARENTSELECTION().

#define PARENT_ReadConfigInteger   REC_ReadConfigInteger

Definition at line 34 of file ParentSelection.cc.

Referenced by SocksServerConfig::reconfigure(), and ParentConfig::reconfigure().

#define PARENT_ReadConfigStringAlloc   REC_ReadConfigStringAlloc

Definition at line 35 of file ParentSelection.cc.

Referenced by SocksServerConfig::reconfigure(), and ParentConfig::reconfigure().

#define PARENT_RegisterConfigUpdateFunc   REC_RegisterConfigUpdateFunc

Definition at line 33 of file ParentSelection.cc.

#define RE (   x,
  y 
)    if (x) { printf("*** TEST %d *** PASSED ***\n", y); passes ++; } else { printf("*** TEST %d *** FAILED *** FAILED *** FAILED ***\n", y); fails++; }

Referenced by PARENTSELECTION().

#define REBUILD   params->ParentTable = new P_table("", "ParentSelection Unit Test Table", &http_dest_tags, ALLOW_HOST_TABLE | ALLOW_REGEX_TABLE | ALLOW_URL_TABLE | ALLOW_IP_TABLE | DONT_BUILD_TABLE); params->ParentTable->BuildTableFromString(tbl);

Referenced by PARENTSELECTION().

#define REINIT   delete request; delete result; request = new HttpRequestData(); result = new ParentResult(); if (!result || !request) { (void)printf("Allocation failed\n"); return; }

Referenced by PARENTSELECTION().

#define ST (   x  )     printf ("*** TEST %d *** STARTING ***\n", x);

Referenced by PARENTSELECTION().

#define T (   x  )     ink_strlcat(tbl,x, sizeof(tbl));
#define TEST_FAIL (   str  ) 
Value:
{ \
  printf("%d: %s\n", test_id,str);\
  err= REGRESSION_TEST_FAILED;\
}

Definition at line 1096 of file ParentSelection.cc.

#define TEST_IP4_ADDR   "209.131.62.14"

Referenced by PARENTSELECTION().

#define TEST_IP6_ADDR   "BEEF:DEAD:ABBA:CAFE:1337:1E1F:5EED:C0FF"

Referenced by PARENTSELECTION().


Typedef Documentation

Definition at line 37 of file ParentSelection.cc.


Enumeration Type Documentation

enum ParentCB_t
Enumerator:
PARENT_FILE_CB 
PARENT_DEFAULT_CB 
PARENT_RETRY_CB 
PARENT_ENABLE_CB 
PARENT_THRESHOLD_CB 
PARENT_DNS_ONLY_CB 

Definition at line 67 of file ParentSelection.cc.


Function Documentation

void br ( HttpRequestData h,
const char *  os_hostname,
sockaddr const *  dest_ip 
)
ParentRecord* createDefaultParent ( char *  val  ) 
EXCLUSIVE_REGRESSION_TEST() PARENTSELECTION ( RegressionTest ,
int  ,
int *  pstatus 
)
void request_to_data ( HttpRequestData req,
sockaddr const *  srcip,
sockaddr const *  dstip,
const char *  str 
)
static int setup_socks_servers ( ParentRecord rec_arr,
int  len 
) [static]
void show_result ( ParentResult p  ) 
int verify ( ParentResult r,
ParentResultType  e,
const char *  h,
int  p 
)

Variable Documentation

const char* default_var = "proxy.config.http.parent_proxies" [static]

Definition at line 45 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().

const char* dns_parent_only_var = "proxy.config.http.no_dns_just_forward_to_parent" [static]

Definition at line 49 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().

const char* enable_var = "proxy.config.http.parent_proxy_routing_enable" [static]

Definition at line 47 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().

ParentRecord* const extApiRecord = (ParentRecord *) 0xeeeeffff

Definition at line 78 of file ParentSelection.cc.

int fails [static]

Definition at line 1122 of file ParentSelection.cc.

Referenced by PARENTSELECTION().

const char* file_var = "proxy.config.http.parent_proxy.file" [static]

Definition at line 44 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().

const char modulePrefix[] = "[ParentSelection]" [static]
ConfigUpdateHandler<ParentConfig>* parentConfigUpdate = NULL [static]

Definition at line 41 of file ParentSelection.cc.

Referenced by ParentConfig::startup().

const char* ParentResultStr[] [static]
Initial value:
 {
  "Parent_Undefined",
  "Parent_Direct",
  "Parent_Specified",
  "Parent_Failed"
}

Definition at line 51 of file ParentSelection.cc.

Referenced by ParentConfigParams::findParent(), and ParentConfigParams::nextParent().

const char* ParentRRStr[] [static]
Initial value:
 {
  "false",
  "strict",
  "true"
}

Definition at line 58 of file ParentSelection.cc.

Referenced by ParentRecord::Print().

int passes [static]

Definition at line 1121 of file ParentSelection.cc.

Referenced by PARENTSELECTION().

const char* retry_var = "proxy.config.http.parent_proxy.retry_time" [static]

Definition at line 46 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().

Definition at line 991 of file ParentSelection.cc.

const char* threshold_var = "proxy.config.http.parent_proxy.fail_threshold" [static]

Definition at line 48 of file ParentSelection.cc.

Referenced by ParentConfig::reconfigure(), and ParentConfig::startup().