comm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 #if LINGERING_CLOSE
32 void comm_lingering_close(int fd);
33 #endif
34 
35 int comm_connect_addr(int sock, const Ip::Address &addr);
36 void comm_init(void);
37 void comm_exit(void);
38 
39 int comm_open(int, int, Ip::Address &, int, const char *note);
40 int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags);
42 void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI);
43 
59 int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note);
60 void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note);
61 
62 int comm_openex(int, int, Ip::Address &, int, const char *);
63 unsigned short comm_local_port(int fd);
64 
65 int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen);
66 void commCallCloseHandlers(int fd);
67 
69 void commUnsetFdTimeout(int fd);
70 
77 
78 int ignoreErrno(int);
79 void commCloseAllSockets(void);
80 void checkTimeouts(void);
81 
84 void comm_remove_close_handler(int fd, CLCB *, void *);
86 
87 int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from);
88 int comm_udp_recv(int fd, void *buf, size_t len, int flags);
89 ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags);
91 
97 void commStartHalfClosedMonitor(int fd);
98 bool commHasHalfClosedMonitor(int fd);
99 // XXX: remove these wrappers which minimize client_side.cc changes in a commit
100 inline void commMarkHalfClosed(int fd) { commStartHalfClosedMonitor(fd); }
101 inline bool commIsHalfClosed(int fd) { return commHasHalfClosedMonitor(fd); }
102 
103 /* A comm engine that calls comm_select */
104 
106 {
107 
108 public:
109  virtual int checkEvents(int timeout);
110 };
111 
112 #endif
113 
void checkTimeouts(void)
Definition: comm.cc:1564
void const char HLPCB * callback
Definition: stub_helper.cc:16
void commMarkHalfClosed(int fd)
Definition: comm.h:100
void commCallCloseHandlers(int fd)
Definition: comm.cc:719
int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note)
Definition: comm.cc:245
bool commHasHalfClosedMonitor(int fd)
checks whether we are waiting for possibly half-closed connection to close
Definition: comm.cc:1655
int comm_openex(int, int, Ip::Address &, int, const char *)
Definition: comm.cc:330
int commUnsetNonBlocking(int fd)
Definition: comm.cc:1109
void _comm_close(int fd, char const *file, int line)
Definition: comm.cc:852
void old_comm_reset_close(int fd)
Definition: comm.cc:807
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:1869
int conn
the current server connection FD
Definition: Transport.cc:26
void commSetTcpKeepalive(int fd, int idle, int interval, int timeout)
Definition: comm.cc:1176
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
Definition: comm.cc:121
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:961
virtual int checkEvents(int timeout)
Definition: comm.cc:1836
void comm_init(void)
Definition: comm.cc:1211
int commSetConnTimeout(const Comm::ConnectionPointer &conn, int seconds, AsyncCall::Pointer &callback)
Definition: comm.cc:552
void commUnsetFdTimeout(int fd)
clear a timeout handler by FD number
Definition: comm.cc:539
unsigned short comm_local_port(int fd)
Definition: comm.cc:160
int comm_open(int, int, Ip::Address &, int, const char *note)
Definition: comm.cc:222
int commUnsetConnTimeout(const Comm::ConnectionPointer &conn)
Definition: comm.cc:578
ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags)
Definition: comm.cc:141
int comm_connect_addr(int sock, const Ip::Address &addr)
Definition: comm.cc:591
int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen)
Definition: comm.cc:927
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:499
int commSetNonBlocking(int fd)
Definition: comm.cc:1076
void * addr
Definition: membanger.c:46
int ignoreErrno(int)
Definition: comm.cc:1477
void commSetCloseOnExec(int fd)
Definition: comm.cc:1137
bool commIsHalfClosed(int fd)
Definition: comm.h:101
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
void CLCB(const CommCloseCbParams &params)
Definition: CommCalls.h:42
void const char * buf
Definition: stub_helper.cc:16
bool comm_iocallbackpending(void)
void comm_exit(void)
Definition: comm.cc:1234
void comm_remove_close_handler(int fd, CLCB *, void *)
Definition: comm.cc:988
void commStartHalfClosedMonitor(int fd)
Start waiting for a possibly half-closed connection to close.
Definition: comm.cc:1608
void comm_reset_close(const Comm::ConnectionPointer &conn)
Definition: comm.cc:792
void commCloseAllSockets(void)
Definition: comm.cc:1507
bool comm_has_incomplete_write(int)
Definition: comm.cc:147
int comm_udp_recv(int fd, void *buf, size_t len, int flags)
Definition: comm.cc:134
Definition: Address.cc:190

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors