tcp-banger2.c File Reference
#include "squid.h"
Include dependency graph for tcp-banger2.c:

Go to the source code of this file.

Classes

struct  _f
 
struct  _request
 

Macros

#define CHANGE_FD_SETSIZE   1
 
#define PROXY_PORT   3128
 
#define PROXY_ADDR   "127.0.0.1"
 
#define READ_BUF_SZ   4096
 
#define RFC1123_STRFTIME   "%a, %d %b %Y %H:%M:%S GMT"
 

Typedefs

typedef void() CB(int, void *)
 

Functions

static void free_request (struct _request *r)
 
char * mkrfc1123 (time_t *t)
 
void fd_close (int fd)
 
void fd_open (int fd, CB *cb, void *data, CB *ccb)
 
void sig_intr (int sig)
 
void read_reply (int fd, void *data)
 
void reply_done (int fd, void *data)
 
struct _requestrequest (char *urlin)
 
void read_url (int fd, void *junk)
 
void usage (void)
 
int main (int argc, argv)
 

Variables

static int proxy_port = PROXY_PORT
 
static char * proxy_addr = PROXY_ADDR
 
static char * progname
 
static int reqpersec
 
static int nrequests
 
static int opt_ims = 0
 
static int opt_range = 0
 
static int opt_accel = 0
 
static int max_connections = 64
 
static time_t lifetime = 60
 
static time_t process_lifetime = 86400
 
static struct timeval now
 
static long long total_bytes_written = 0
 
static long long total_bytes_read = 0
 
static int opt_checksum = 0
 
static char * custom_header = NULL
 
FILE * trace_file = NULL
 
struct _f FD [SQUID_MAXFD]
 
int nfds = 0
 
int maxfd = 0
 

Macro Definition Documentation

◆ CHANGE_FD_SETSIZE

#define CHANGE_FD_SETSIZE   1

Definition at line 17 of file tcp-banger2.c.

◆ PROXY_ADDR

#define PROXY_ADDR   "127.0.0.1"

Definition at line 83 of file tcp-banger2.c.

◆ PROXY_PORT

#define PROXY_PORT   3128

Definition at line 82 of file tcp-banger2.c.

◆ READ_BUF_SZ

#define READ_BUF_SZ   4096

Definition at line 84 of file tcp-banger2.c.

Referenced by read_reply().

◆ RFC1123_STRFTIME

#define RFC1123_STRFTIME   "%a, %d %b %Y %H:%M:%S GMT"

Definition at line 140 of file tcp-banger2.c.

Referenced by mkrfc1123().

Typedef Documentation

◆ CB

typedef void() CB(int, void *)

Definition at line 104 of file tcp-banger2.c.

Function Documentation

◆ fd_close()

void fd_close ( int  fd)

Definition at line 153 of file tcp-banger2.c.

References _f::cb, _f::ccb, _f::data, FD, maxfd, nfds, and NULL.

Referenced by main(), read_reply(), read_url(), and sig_intr().

◆ fd_open()

void fd_open ( int  fd,
CB cb,
void *  data,
CB ccb 
)

Definition at line 170 of file tcp-banger2.c.

References assert, _f::cb, _f::ccb, _f::data, FD, maxfd, nfds, now, and _f::start.

Referenced by main(), and read_url().

◆ free_request()

static void free_request ( struct _request r)
static

Definition at line 133 of file tcp-banger2.c.

References free, and _request::url.

Referenced by reply_done(), and request().

◆ main()

◆ mkrfc1123()

char* mkrfc1123 ( time_t *  t)

Definition at line 142 of file tcp-banger2.c.

References buf, and RFC1123_STRFTIME.

◆ read_reply()

◆ read_url()

void read_url ( int  fd,
void *  junk 
)

Definition at line 436 of file tcp-banger2.c.

References buf, _request::fd, fd_close(), fd_open(), max_connections, nfds, NULL, read_reply(), reply_done(), and request().

Referenced by main().

◆ reply_done()

◆ request()

struct _request* request ( char *  urlin)

Definition at line 291 of file tcp-banger2.c.

References assert, buf, _request::content_length, custom_header, _request::fd, free_request(), int, len, method, _request::method, mkrfc850(), NULL, opt_accel, opt_ims, opt_range, proxy_addr, proxy_port, _request::requestbodyfile, size, _request::status, total_bytes_written, _request::url, _request::validsize, _request::validstatus, _request::validsum, and xstrdup.

Referenced by StoreEntry::adjustVary(), AuthenticateAcl(), Ssl::ErrorDetail::buildDetail(), ConnStateData::buildFakeRequest(), Http::One::Server::buildHttpRequest(), Http::Stream::buildRangeHeader(), clientReplyContext::buildReplyHeader(), Downloader::buildRequest(), carpSelectParent(), htcpSpecifier::checkHit(), PeerSelector::checkNetdbDirect(), Adaptation::Icap::ModXact::clearError(), Adaptation::Ecap::XactionRep::clientIpValue(), clientProcessRequest(), clientSetKeepaliveFlag(), Adaptation::Icap::ModXact::detailError(), ConnStateData::doneAll(), Adaptation::Icap::ModXact::doneWriting(), Ftp::Server::doProcessRequest(), ConnStateData::fakeAConnectRequest(), htcpSpecifier::fillChecklist(), FindListeningPortAddress(), get_url(), getDefaultParent(), getFirstUpParent(), getRoundRobinParent(), getWeightedRoundRobinParent(), Ssl::HandleGeneratorReply(), PeerSelector::handleHtcpParentMiss(), PeerSelector::handleIcpParentMiss(), PeerSelector::handleIcpReply(), Ftp::Server::handleUploadRequest(), htcpClrStore(), httpHeaderInitModule(), httpRequestPack(), ConnStateData::initiateTunneledRequest(), StoreEntry::lastModified(), TemplateFile::loaded(), ClientHttpRequest::logRequest(), main(), Adaptation::Icap::ModXact::makeRequestHeaders(), Adaptation::Ecap::XactionRep::masterxSharedValue(), ACLAnnotateTransactionStrategy::match(), ACLAdaptationServiceStrategy::match(), ACLAnnotateClientStrategy::match(), ACLNoteStrategy::match(), CacheManager::menu(), Adaptation::Ecap::XactionRep::metaValue(), ClientHttpRequest::mRangeCLen(), ClientHttpRequest::multipartRangeRequest(), neighborsDigestSelect(), netdbClosestParent(), Note::Note(), PeerSelector::noteIp(), PeerSelector::noteIps(), PeerSelector::noteLookup(), Ftp::Server::notePeerConnection(), IpcIoFile::open(), operator<<(), Adaptation::Icap::ModXact::parseIcapHead(), Http::One::Server::parseOneRequest(), Ftp::Server::parseOneRequest(), ConnStateData::parseTlsHandshake(), CacheManager::ParseUrl(), peerAllowedToUse(), peerDigestLookup(), peerSelect(), peerSelectIcpPing(), peerSourceHashSelectParent(), peerUserHashSelectParent(), peerWouldBePinged(), ConnStateData::postHttpsAccept(), read_url(), Rock::SwapDir::readCompleted(), ConnStateData::requestTimeout(), PeerSelector::resolveSelected(), PeerSelector::selectAllParents(), PeerSelector::selectMore(), PeerSelector::selectPinned(), PeerSelector::selectSomeDirect(), PeerSelector::selectSomeNeighbor(), PeerSelector::selectSomeParent(), SendSharedListenRequest(), ConnStateData::serveDelayedError(), Ftp::Server::setDataCommand(), ConnStateData::splice(), squidaio_cancel(), squidaio_poll_done(), squidaio_queue_request(), squidaio_thread_loop(), Adaptation::Iterator::start(), Adaptation::Ecap::XactionRep::start(), ConnStateData::startPeekAndSplice(), Adaptation::Iterator::step(), Ssl::Helper::Submit(), Adaptation::Ecap::XactionRep::swanSong(), ClientHttpRequest::updateCounters(), Adaptation::Ecap::XactionRep::updateHistory(), Adaptation::Ecap::XactionRep::updateSources(), Auth::UserRequest::user(), Adaptation::Ecap::XactionRep::usernameValue(), Adaptation::Icap::ModXact::virginRequest(), Adaptation::Ecap::XactionRep::visitEachMetaHeader(), Rock::SwapDir::writeCompleted(), Ftp::Server::writeErrorReply(), PeerSelector::~PeerSelector(), and Http::One::Server::~Server().

◆ sig_intr()

void sig_intr ( int  sig)

Definition at line 183 of file tcp-banger2.c.

References fd_close(), and nfds.

Referenced by main().

◆ usage()

void usage ( void  )

Definition at line 462 of file tcp-banger2.c.

References progname.

Referenced by main().

Variable Documentation

◆ custom_header

char* custom_header = NULL
static

Definition at line 101 of file tcp-banger2.c.

Referenced by main(), and request().

◆ FD

struct _f FD[SQUID_MAXFD]

Definition at line 128 of file tcp-banger2.c.

Referenced by fd_close(), fd_open(), and main().

◆ lifetime

time_t lifetime = 60
static

Definition at line 95 of file tcp-banger2.c.

Referenced by main().

◆ max_connections

int max_connections = 64
static

Definition at line 94 of file tcp-banger2.c.

Referenced by main(), and read_url().

◆ maxfd

int maxfd = 0

◆ nfds

◆ now

struct timeval now
static

Definition at line 97 of file tcp-banger2.c.

Referenced by fd_open(), and main().

◆ nrequests

int nrequests
static

Definition at line 90 of file tcp-banger2.c.

Referenced by main(), main_loop(), and read_reply().

◆ opt_accel

int opt_accel = 0
static

Definition at line 93 of file tcp-banger2.c.

Referenced by main(), and request().

◆ opt_checksum

int opt_checksum = 0
static

Definition at line 100 of file tcp-banger2.c.

Referenced by main(), read_reply(), and reply_done().

◆ opt_ims

int opt_ims = 0
static

Definition at line 91 of file tcp-banger2.c.

Referenced by main(), and request().

◆ opt_range

int opt_range = 0
static

Definition at line 92 of file tcp-banger2.c.

Referenced by main(), reply_done(), and request().

◆ process_lifetime

time_t process_lifetime = 86400
static

Definition at line 96 of file tcp-banger2.c.

Referenced by main().

◆ progname

char* progname
static

Definition at line 88 of file tcp-banger2.c.

Referenced by main(), and usage().

◆ proxy_addr

char* proxy_addr = PROXY_ADDR
static

Definition at line 87 of file tcp-banger2.c.

Referenced by main(), and request().

◆ proxy_port

int proxy_port = PROXY_PORT
static

Definition at line 86 of file tcp-banger2.c.

Referenced by main(), and request().

◆ reqpersec

int reqpersec
static

Definition at line 89 of file tcp-banger2.c.

Referenced by main(), main_loop(), and read_reply().

◆ total_bytes_read

long long total_bytes_read = 0
static

Definition at line 99 of file tcp-banger2.c.

Referenced by main(), and read_reply().

◆ total_bytes_written

long long total_bytes_written = 0
static

Definition at line 98 of file tcp-banger2.c.

Referenced by request().

◆ trace_file

FILE* trace_file = NULL

Definition at line 102 of file tcp-banger2.c.

Referenced by main(), and reply_done().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors