Squid Web Cache master
Loading...
Searching...
No Matches
comm.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_COMM_H
10#define SQUID_SRC_COMM_H
11
12#include "comm/IoCallback.h"
13#include "CommCalls.h"
14#include "StoreIOBuffer.h"
15
16namespace Ip
17{
18class Address;
19}
20
21bool comm_iocallbackpending(void); /* inline candidate */
22
23int commSetNonBlocking(int fd);
24int commUnsetNonBlocking(int fd);
25
33void commSetCloseOnExec(int fd);
34
35void _comm_close(int fd, char const *file, int line);
36#define comm_close(x) (_comm_close((x), __FILE__, __LINE__))
37void old_comm_reset_close(int fd);
39
40int comm_connect_addr(int sock, const Ip::Address &addr);
41void comm_init(void);
42void comm_exit(void);
43
44int comm_open(int, int, Ip::Address &, int, const char *note);
45int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags);
47void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI);
48
63int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note);
64void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note);
65
66unsigned short comm_local_port(int fd);
67
68int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen);
69void commCallCloseHandlers(int fd);
70
72void commUnsetFdTimeout(int fd);
73
80
81int ignoreErrno(int);
82void commCloseAllSockets(void);
83void checkTimeouts(void);
84
87void comm_remove_close_handler(int fd, CLCB *, void *);
89
90int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from);
91int comm_udp_recv(int fd, void *buf, size_t len, int flags);
92ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags);
94
100void commStartHalfClosedMonitor(int fd);
101bool commHasHalfClosedMonitor(int fd);
102// XXX: remove these wrappers which minimize client_side.cc changes in a commit
104inline bool commIsHalfClosed(int fd) { return commHasHalfClosedMonitor(fd); }
105
106/* A comm engine that calls comm_select */
107
109{
110
111public:
112 int checkEvents(int timeout) override;
113};
114
115#endif /* SQUID_SRC_COMM_H */
116
void CLCB(const CommCloseCbParams &params)
Definition CommCalls.h:40
int checkEvents(int timeout) override
Definition comm.cc:1644
void commCallCloseHandlers(int fd)
Definition comm.cc:744
bool comm_iocallbackpending(void)
int commSetNonBlocking(int fd)
Definition comm.cc:1044
int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note)
Definition comm.cc:272
void _comm_close(int fd, char const *file, int line)
Definition comm.cc:839
unsigned short comm_local_port(int fd)
Definition comm.cc:167
void old_comm_reset_close(int fd)
Definition comm.cc:798
void commSetConnTimeout(const Comm::ConnectionPointer &, time_t seconds, AsyncCall::Pointer &)
Definition comm.cc:594
void commUnsetConnTimeout(const Comm::ConnectionPointer &)
Definition comm.cc:618
void commSetCloseOnExec(int fd)
Definition comm.cc:1105
void commUnsetFdTimeout(int fd)
clear a timeout handler by FD number
Definition comm.cc:581
void comm_init(void)
Definition comm.cc:1141
int commUnsetNonBlocking(int fd)
Definition comm.cc:1077
int comm_open_uds(int sock_type, int proto, struct sockaddr_un *addr, int flags)
Create a unix-domain socket (UDS) that only supports FD_MSGHDR I/O.
Definition comm.cc:1677
void checkTimeouts(void)
Definition comm.cc:1494
void comm_exit(void)
Definition comm.cc:1158
int comm_open(int, int, Ip::Address &, int, const char *note)
Definition comm.cc:245
void commMarkHalfClosed(int fd)
Definition comm.h:103
bool commHasHalfClosedMonitor(int fd)
checks whether we are waiting for possibly half-closed connection to close
Definition comm.cc:1597
void commCloseAllSockets(void)
Definition comm.cc:1437
bool comm_has_incomplete_write(int)
Definition comm.cc:154
int ignoreErrno(int)
Definition comm.cc:1407
int comm_udp_recv(int fd, void *buf, size_t len, int flags)
Definition comm.cc:141
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *)
Definition comm.cc:942
void comm_remove_close_handler(int fd, CLCB *, void *)
Definition comm.cc:971
ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags)
Definition comm.cc:148
void commStartHalfClosedMonitor(int fd)
Start waiting for a possibly half-closed connection to close.
Definition comm.cc:1547
int comm_connect_addr(int sock, const Ip::Address &addr)
Definition comm.cc:631
bool commIsHalfClosed(int fd)
Definition comm.h:104
int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen)
Definition comm.cc:911
void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI)
update Comm state after getting a comm_open() FD from another process
Definition comm.cc:551
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
Definition comm.cc:128
void comm_reset_close(const Comm::ConnectionPointer &conn)
Definition comm.cc:787
Definition Xaction.cc:137