comm.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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, int 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 virtual int checkEvents(int timeout);
104};
105
106#endif
107
void CLCB(const CommCloseCbParams &params)
Definition: CommCalls.h:42
int conn
the current server connection FD
Definition: Transport.cc:26
virtual int checkEvents(int timeout)
Definition: comm.cc:1675
void commCallCloseHandlers(int fd)
Definition: comm.cc:753
bool comm_iocallbackpending(void)
int commSetNonBlocking(int fd)
Definition: comm.cc:1064
int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note)
Definition: comm.cc:268
void _comm_close(int fd, char const *file, int line)
Definition: comm.cc:840
unsigned short comm_local_port(int fd)
Definition: comm.cc:163
void old_comm_reset_close(int fd)
Definition: comm.cc:794
void commSetCloseOnExec(int fd)
Definition: comm.cc:1125
void commUnsetFdTimeout(int fd)
clear a timeout handler by FD number
Definition: comm.cc:576
void comm_init(void)
Definition: comm.cc:1164
int commUnsetNonBlocking(int fd)
Definition: comm.cc:1097
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:1708
void checkTimeouts(void)
Definition: comm.cc:1525
void comm_exit(void)
Definition: comm.cc:1187
int comm_open(int, int, Ip::Address &, int, const char *note)
Definition: comm.cc:241
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:1628
void commCloseAllSockets(void)
Definition: comm.cc:1468
bool comm_has_incomplete_write(int)
Definition: comm.cc:150
int ignoreErrno(int)
Definition: comm.cc:1438
int comm_udp_recv(int fd, void *buf, size_t len, int flags)
Definition: comm.cc:137
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:947
void comm_remove_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:976
ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags)
Definition: comm.cc:144
void commStartHalfClosedMonitor(int fd)
Start waiting for a possibly half-closed connection to close.
Definition: comm.cc:1578
int commUnsetConnTimeout(const Comm::ConnectionPointer &conn)
Definition: comm.cc:615
int comm_connect_addr(int sock, const Ip::Address &addr)
Definition: comm.cc:628
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:916
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:536
int commSetConnTimeout(const Comm::ConnectionPointer &conn, int seconds, AsyncCall::Pointer &callback)
Definition: comm.cc:589
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
Definition: comm.cc:124
void comm_reset_close(const Comm::ConnectionPointer &conn)
Definition: comm.cc:779
Definition: client_db.h:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors