IoCallback.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_COMM_IOCALLBACK_H
10#define _SQUID_COMM_IOCALLBACK_H
11
12#include "base/AsyncCall.h"
13#include "comm/Flag.h"
14#include "comm/forward.h"
15#include "mem/forward.h"
16#include "sbuf/forward.h"
17
18namespace Comm
19{
20
22typedef enum {
27
30{
31public:
35 char *buf;
37 int size;
38 int offset;
40 int xerrno;
41#if USE_DELAY_POOLS
42 unsigned int quotaQueueReserv;
43#endif
44
45 bool active() const { return callback != nullptr; }
46 void setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz);
47
49 void selectOrQueueWrite();
50
52 void cancel(const char *reason);
53
55 void finish(Comm::Flag code, int xerrn);
56
57private:
58 void reset();
59};
60
64{
65public:
66 int fd;
69};
70
73extern CbEntry *iocb_table;
74
77
78#define COMMIO_FD_READCB(fd) (&Comm::iocb_table[(fd)].readcb)
79#define COMMIO_FD_WRITECB(fd) (&Comm::iocb_table[(fd)].writecb)
80
81} // namespace Comm
82
83#endif /* _SQUID_COMM_IOCALLBACK_H */
84
IoCallback writecb
Definition: IoCallback.h:68
IoCallback readcb
Definition: IoCallback.h:67
Details about a particular Comm IO callback event.
Definition: IoCallback.h:30
void setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz)
Definition: IoCallback.cc:55
bool active() const
Definition: IoCallback.h:45
void selectOrQueueWrite()
called when fd needs to write but may need to wait in line for its quota
Definition: IoCallback.cc:69
AsyncCall::Pointer callback
Definition: IoCallback.h:34
void finish(Comm::Flag code, int xerrn)
finish the IO operation immediately and schedule the callback with the current state.
Definition: IoCallback.cc:110
void cancel(const char *reason)
Actively cancel the given callback.
Definition: IoCallback.cc:82
iocb_type type
Definition: IoCallback.h:32
Comm::ConnectionPointer conn
Definition: IoCallback.h:33
Comm::Flag errcode
Definition: IoCallback.h:39
unsigned int quotaQueueReserv
reservation ID from CommQuotaQueue
Definition: IoCallback.h:42
void FREE(void *)
Definition: forward.h:37
Abstraction layer for TCP, UDP, TLS, UDS and filedescriptor sockets.
Definition: AcceptLimiter.h:17
void CallbackTableDestruct()
Definition: IoCallback.cc:34
iocb_type
Type of IO callbacks the Comm layer deals with.
Definition: IoCallback.h:22
@ IOCB_NONE
Definition: IoCallback.h:23
@ IOCB_WRITE
Definition: IoCallback.h:25
@ IOCB_READ
Definition: IoCallback.h:24
CbEntry * iocb_table
Definition: IoCallback.cc:19
Flag
Definition: Flag.h:15
void CallbackTableInit()
Definition: IoCallback.cc:22
int code
Definition: smb-errors.c:145

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors