comm.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 __COMM_H__
10#define __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);
25void commSetCloseOnExec(int fd);
26void _comm_close(int fd, char const *file, int line);
27#define comm_close(x) (_comm_close((x), __FILE__, __LINE__))
28void old_comm_reset_close(int fd);
30
31int comm_connect_addr(int sock, const Ip::Address &addr);
32void comm_init(void);
33void comm_exit(void);
34
35int comm_open(int, int, Ip::Address &, int, const char *note);
36int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags);
38void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI);
39
54int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note);
55void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note);
56
57unsigned short comm_local_port(int fd);
58
59int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen);
60void commCallCloseHandlers(int fd);
61
63void commUnsetFdTimeout(int fd);
64
69int commSetConnTimeout(const Comm::ConnectionPointer &conn, time_t seconds, AsyncCall::Pointer &callback);
71
72int ignoreErrno(int);
73void commCloseAllSockets(void);
74void checkTimeouts(void);
75
78void comm_remove_close_handler(int fd, CLCB *, void *);
80
81int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from);
82int comm_udp_recv(int fd, void *buf, size_t len, int flags);
83ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags);
85
92bool commHasHalfClosedMonitor(int fd);
93// XXX: remove these wrappers which minimize client_side.cc changes in a commit
95inline bool commIsHalfClosed(int fd) { return commHasHalfClosedMonitor(fd); }
96
97/* A comm engine that calls comm_select */
98
100{
101
102public:
103 int checkEvents(int timeout) override;
104};
105
106#endif
107
void CLCB(const CommCloseCbParams &params)
Definition: CommCalls.h:40
int conn
the current server connection FD
Definition: Transport.cc:26
int checkEvents(int timeout) override
Definition: comm.cc:1677
void commCallCloseHandlers(int fd)
Definition: comm.cc:759
bool comm_iocallbackpending(void)
int commSetNonBlocking(int fd)
Definition: comm.cc:1066
int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note)
Definition: comm.cc:269
void _comm_close(int fd, char const *file, int line)
Definition: comm.cc:846
unsigned short comm_local_port(int fd)
Definition: comm.cc:164
void old_comm_reset_close(int fd)
Definition: comm.cc:800
void commSetCloseOnExec(int fd)
Definition: comm.cc:1127
void commUnsetFdTimeout(int fd)
clear a timeout handler by FD number
Definition: comm.cc:582
int commSetConnTimeout(const Comm::ConnectionPointer &conn, time_t seconds, AsyncCall::Pointer &callback)
Definition: comm.cc:595
void comm_init(void)
Definition: comm.cc:1166
int commUnsetNonBlocking(int fd)
Definition: comm.cc:1099
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:1710
void checkTimeouts(void)
Definition: comm.cc:1527
void comm_exit(void)
Definition: comm.cc:1189
int comm_open(int, int, Ip::Address &, int, const char *note)
Definition: comm.cc:242
void commMarkHalfClosed(int fd)
Definition: comm.h:94
bool commHasHalfClosedMonitor(int fd)
checks whether we are waiting for possibly half-closed connection to close
Definition: comm.cc:1630
void commCloseAllSockets(void)
Definition: comm.cc:1470
bool comm_has_incomplete_write(int)
Definition: comm.cc:151
int ignoreErrno(int)
Definition: comm.cc:1440
int comm_udp_recv(int fd, void *buf, size_t len, int flags)
Definition: comm.cc:138
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:949
void comm_remove_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:978
ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags)
Definition: comm.cc:145
void commStartHalfClosedMonitor(int fd)
Start waiting for a possibly half-closed connection to close.
Definition: comm.cc:1580
int commUnsetConnTimeout(const Comm::ConnectionPointer &conn)
Definition: comm.cc:621
int comm_connect_addr(int sock, const Ip::Address &addr)
Definition: comm.cc:634
bool commIsHalfClosed(int fd)
Definition: comm.h:95
int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen)
Definition: comm.cc:918
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:542
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
Definition: comm.cc:125
void comm_reset_close(const Comm::ConnectionPointer &conn)
Definition: comm.cc:785
Definition: Xaction.cc:139

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors