purge.cc File Reference
#include "squid.h"
#include "util.h"
#include <cerrno>
#include <climits>
#include <csignal>
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "conffile.hh"
#include "convert.hh"
#include "copyout.hh"
#include "signal.hh"
#include "socket.hh"
#include "squid-tlv.hh"
Include dependency graph for purge.cc:

Go to the source code of this file.

Classes

struct  REList
 

Macros

#define DEFAULTHOST   "localhost"
 
#define DEFAULTPORT   3128
 
#define LINESIZE   512
 

Functions

char * concat (const char *start,...)
 
bool isxstring (const char *s, size_t testlen)
 
int log_output (const char *fn, int code, long size, const char *url)
 
static int log_extended (const char *fn, int code, long size, const SquidMetaList *meta)
 
bool action (int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
 
bool match (const char *fn, const REList *list)
 
bool filelevel (const char *directory, const REList *list)
 
bool dirlevel (const char *dirname, const REList *list, bool level=false)
 
int checkForPortOnly (const char *arg)
 
void helpMe (void)
 
void parseCommandline (int argc, char *argv[], REList *&head, char *&conffile, char *&copyDirPath, struct in_addr &serverHostIp, unsigned short &serverHostPort)
 
static void exiter (void)
 
static void handler (int signo)
 
static int makelinebuffered (FILE *fp, const char *fn=0)
 
int main (int argc, char *argv[])
 

Variables

volatile sig_atomic_t term_flag = 0
 
char * linebuffer = 0
 
size_t buffersize = 128*1024
 
static char * copydir = 0
 
static uint32_t debugFlag = 0
 
static unsigned purgeMode = 0
 
static bool iamalive = false
 
static bool reminder = false
 
static bool verbose = false
 
static bool envelope = false
 
static bool no_fork = false
 
static const char * programname = 0
 
static struct in_addr serverHost
 
static unsigned short serverPort
 

Macro Definition Documentation

#define DEFAULTHOST   "localhost"

Definition at line 133 of file purge.cc.

Referenced by helpMe(), and main().

#define DEFAULTPORT   3128

Definition at line 137 of file purge.cc.

Referenced by helpMe(), and main().

#define LINESIZE   512

Referenced by parseCommandline().

Function Documentation

int checkForPortOnly ( const char *  arg)

Definition at line 569 of file purge.cc.

References errstr, getservbyname(), and servent::s_port.

Referenced by parseCommandline().

char* concat ( const char *  start,
  ... 
)

Definition at line 202 of file purge.cc.

References NULL, and size.

Referenced by dirlevel(), and filelevel().

bool dirlevel ( const char *  dirname,
const REList list,
bool  level = false 
)

Definition at line 532 of file purge.cc.

References concat(), debugFlag, dirent_t, filelevel(), NULL, and strerror().

Referenced by main().

static void exiter ( void  )
static

Definition at line 847 of file purge.cc.

References linebuffer, psignal(), reminder, and term_flag.

Referenced by main().

bool filelevel ( const char *  directory,
const REList list 
)

Definition at line 492 of file purge.cc.

References assert, concat(), debugFlag, dirent_t, iamalive, isxstring(), match(), NULL, and strerror().

Referenced by dirlevel().

void helpMe ( void  )

Definition at line 593 of file purge.cc.

References DEFAULTHOST, DEFAULTPORT, and programname.

Referenced by parseCommandline().

bool isxstring ( const char *  s,
size_t  testlen 
)

Definition at line 235 of file purge.cc.

References i.

Referenced by filelevel().

static int log_extended ( const char *  fn,
int  code,
long  size,
const SquidMetaList *  meta 
)
static

Definition at line 258 of file purge.cc.

References STORE_META_KEY_MD5, STORE_META_STD, STORE_META_STD_LFS, and STORE_META_URL.

Referenced by action(), and match().

int log_output ( const char *  fn,
int  code,
long  size,
const char *  url 
)
inline

Definition at line 251 of file purge.cc.

Referenced by action(), and match().

static int makelinebuffered ( FILE *  fp,
const char *  fn = 0 
)
static

Definition at line 870 of file purge.cc.

References fn, and strerror().

Referenced by main().

void parseCommandline ( int  argc,
char *  argv[],
REList *&  head,
char *&  conffile,
char *&  copyDirPath,
struct in_addr &  serverHostIp,
unsigned short &  serverHostPort 
)

Variable Documentation

size_t buffersize = 128*1024

Definition at line 142 of file purge.cc.

Referenced by copy_out(), main(), and match().

char* copydir = 0
static

Definition at line 143 of file purge.cc.

Referenced by action(), and main().

uint32_t debugFlag = 0
static

Definition at line 144 of file purge.cc.

Referenced by action(), dirlevel(), filelevel(), main(), match(), and parseCommandline().

bool envelope = false
static

Definition at line 149 of file purge.cc.

Referenced by action(), and parseCommandline().

bool iamalive = false
static

Definition at line 146 of file purge.cc.

Referenced by filelevel(), main(), and parseCommandline().

char* linebuffer = 0

Definition at line 141 of file purge.cc.

Referenced by copy_out(), exiter(), main(), and match().

bool no_fork = false
static

Definition at line 150 of file purge.cc.

Referenced by main(), and parseCommandline().

const char* programname = 0
static

Definition at line 151 of file purge.cc.

Referenced by helpMe(), and parseCommandline().

unsigned purgeMode = 0
static

Definition at line 145 of file purge.cc.

Referenced by action(), match(), and parseCommandline().

bool reminder = false
static

Definition at line 147 of file purge.cc.

Referenced by action(), exiter(), and match().

struct in_addr serverHost
static

Definition at line 307 of file purge.cc.

Referenced by action(), and main().

unsigned short serverPort
static

Definition at line 308 of file purge.cc.

Referenced by action(), and main().

volatile sig_atomic_t term_flag = 0

Definition at line 140 of file purge.cc.

Referenced by exiter(), and handler().

bool verbose = false
static

Definition at line 148 of file purge.cc.

Referenced by action(), match(), and parseCommandline().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors