comm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 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 
16 namespace Ip
17 {
18 class Address;
19 }
20 
21 bool comm_iocallbackpending(void); /* inline candidate */
22 
23 int commSetNonBlocking(int fd);
24 int commUnsetNonBlocking(int fd);
25 void commSetCloseOnExec(int fd);
26 void commSetTcpKeepalive(int fd, int idle, int interval, int timeout);
27 void _comm_close(int fd, char const *file, int line);
28 #define comm_close(x) (_comm_close((x), __FILE__, __LINE__))
29 void old_comm_reset_close(int fd);
31 
32 int comm_connect_addr(int sock, const Ip::Address &addr);
33 void comm_init(void);
34 void comm_exit(void);
35 
36 int comm_open(int, int, Ip::Address &, int, const char *note);
37 int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags);
39 void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI);
40 
56 int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note);
57 void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note);
58 
59 int comm_openex(int, int, Ip::Address &, int, const char *);
60 unsigned short comm_local_port(int fd);
61 
62 int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen);
63 void commCallCloseHandlers(int fd);
64 
66 void commUnsetFdTimeout(int fd);
67 
74 
75 int ignoreErrno(int);
76 void commCloseAllSockets(void);
77 void checkTimeouts(void);
78 
81 void comm_remove_close_handler(int fd, CLCB *, void *);
83 
84 int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from);
85 int comm_udp_recv(int fd, void *buf, size_t len, int flags);
86 ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags);
88 
94 void commStartHalfClosedMonitor(int fd);
95 bool commHasHalfClosedMonitor(int fd);
96 // XXX: remove these wrappers which minimize client_side.cc changes in a commit
97 inline void commMarkHalfClosed(int fd) { commStartHalfClosedMonitor(fd); }
98 inline bool commIsHalfClosed(int fd) { return commHasHalfClosedMonitor(fd); }
99 
100 /* A comm engine that calls comm_select */
101 
103 {
104 
105 public:
106  virtual int checkEvents(int timeout);
107 };
108 
109 #endif
110 
int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note)
Definition: comm.cc:246
void comm_init(void)
Definition: comm.cc:1181
int comm_openex(int, int, Ip::Address &, int, const char *)
Definition: comm.cc:331
void _comm_close(int fd, char const *file, int line)
Definition: comm.cc:817
void checkTimeouts(void)
Definition: comm.cc:1542
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:1859
void commCloseAllSockets(void)
Definition: comm.cc:1485
bool commIsHalfClosed(int fd)
Definition: comm.h:98
void CLCB(const CommCloseCbParams &params)
Definition: CommCalls.h:42
void old_comm_reset_close(int fd)
Definition: comm.cc:771
bool comm_iocallbackpending(void)
void commStartHalfClosedMonitor(int fd)
Start waiting for a possibly half-closed connection to close.
Definition: comm.cc:1595
void commSetTcpKeepalive(int fd, int idle, int interval, int timeout)
Definition: comm.cc:1146
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:931
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
Definition: comm.cc:122
void comm_reset_close(const Comm::ConnectionPointer &conn)
Definition: comm.cc:756
int commSetConnTimeout(const Comm::ConnectionPointer &conn, int seconds, AsyncCall::Pointer &callback)
Definition: comm.cc:567
int comm_open(int, int, Ip::Address &, int, const char *note)
Definition: comm.cc:223
void commUnsetFdTimeout(int fd)
clear a timeout handler by FD number
Definition: comm.cc:554
unsigned short comm_local_port(int fd)
Definition: comm.cc:161
int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen)
Definition: comm.cc:897
int conn
the current server connection FD
Definition: Transport.cc:26
int comm_connect_addr(int sock, const Ip::Address &addr)
Definition: comm.cc:606
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:514
void comm_remove_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:958
int ignoreErrno(int)
Definition: comm.cc:1455
virtual int checkEvents(int timeout)
Definition: comm.cc:1826
Definition: client_db.h:23
void commSetCloseOnExec(int fd)
Definition: comm.cc:1107
int commUnsetConnTimeout(const Comm::ConnectionPointer &conn)
Definition: comm.cc:593
ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags)
Definition: comm.cc:142
void comm_exit(void)
Definition: comm.cc:1204
void commCallCloseHandlers(int fd)
Definition: comm.cc:734
void const char HLPCB * callback
Definition: stub_helper.cc:16
int commSetNonBlocking(int fd)
Definition: comm.cc:1046
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
int comm_udp_recv(int fd, void *buf, size_t len, int flags)
Definition: comm.cc:135
bool comm_has_incomplete_write(int)
Definition: comm.cc:148
int commUnsetNonBlocking(int fd)
Definition: comm.cc:1079
void const char * buf
Definition: stub_helper.cc:16
bool commHasHalfClosedMonitor(int fd)
checks whether we are waiting for possibly half-closed connection to close
Definition: comm.cc:1645
void commMarkHalfClosed(int fd)
Definition: comm.h:97

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors