Request.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_HELPER_REQUEST_H
10 #define SQUID_SRC_HELPER_REQUEST_H
11 
12 #include "cbdata.h"
13 #include "helper/forward.h"
14 #include "mem/AllocatorProxy.h"
15 #include "time/gadgets.h"
16 
17 namespace Helper
18 {
19 
20 class Request
21 {
23 
24 public:
25  Request(HLPCB *c, void *d, const char *b) :
26  buf(b ? xstrdup(b) : nullptr),
27  callback(c),
29  placeholder(b == nullptr),
30  Id(0),
31  retries(0)
32  {
33  memset(&dispatch_time, 0, sizeof(dispatch_time));
34  }
35 
38  xfree(buf);
39  }
40 
41  char *buf;
43  void *data;
44 
45  int placeholder; /* if 1, this is a dummy request waiting for a stateful helper to become available */
46  struct timeval dispatch_time;
47  uint64_t Id;
54  int retries;
55  bool timedOut(time_t timeout) {return (squid_curtime - dispatch_time.tv_sec) > timeout;}
56 };
57 
58 } // namespace Helper
59 
60 #endif /* SQUID_SRC_HELPER_REQUEST_H */
61 
uint64_t Id
Definition: Request.h:47
#define xstrdup
char * buf
Definition: Request.h:41
MEMPROXY_CLASS(Helper::Request)
#define cbdataReference(var)
Definition: cbdata.h:348
HLPCB * callback
Definition: Request.h:42
int placeholder
Definition: Request.h:45
bool timedOut(time_t timeout)
Definition: Request.h:55
struct timeval dispatch_time
Definition: Request.h:46
helper protocol primitives
Definition: ChildConfig.h:12
void * data
Definition: Request.h:43
#define cbdataReferenceDone(var)
Definition: cbdata.h:357
Request(HLPCB *c, void *d, const char *b)
Definition: Request.h:25
time_t squid_curtime
Definition: stub_libtime.cc:20
#define xfree
void HLPCB(void *, const Helper::Reply &)
Definition: forward.h:33

 

Introduction

Documentation

Support

Miscellaneous