]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/tests/stub_comm.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / stub_comm.cc
index 56a57ad7113a12bf818615729fb9ed02a40a6b02..55dda4dff8f44d35a5c177bdfe8cde1c54d97269 100644 (file)
 /*
- * $Id$
- *
- * DEBUG: section 84    Helper process maintenance
- * AUTHOR: Robert Collins
- *
- * SQUID Web Proxy Cache          http://www.squid-cache.org/
- * ----------------------------------------------------------
- *
- *  Squid is the result of efforts by numerous individuals from
- *  the Internet community; see the CONTRIBUTORS file for full
- *  details.   Many organizations have provided support for Squid's
- *  development; see the SPONSORS file for full details.  Squid is
- *  Copyrighted (C) 2001 by the Regents of the University of
- *  California; see the COPYRIGHT file for full details.  Squid
- *  incorporates software developed and/or copyrighted by other
- *  sources; see the CREDITS file for full details.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 #include "squid.h"
-#include "comm.h"
-#include "CommRead.h"
+#include "comm/Connection.h"
+#include "comm/Loops.h"
 #include "fde.h"
 
-DeferredReadManager::~DeferredReadManager()
-{
-    /* no networked tests yet */
-}
-
-DeferredRead::DeferredRead (DeferrableRead *, void *, CommRead const &)
-{
-    fatal ("Not implemented");
-}
-
-void
-DeferredReadManager::delayRead(DeferredRead const &aRead)
-{
-    fatal ("Not implemented");
-}
-
-void
-DeferredReadManager::kickReads(int const count)
-{
-    fatal ("Not implemented");
-}
-
-void
-comm_read(int fd, char *buf, int size, IOCB *handler, void *handler_data)
-{
-    fatal ("Not implemented");
-}
+#define STUB_API "comm.cc"
+#include "tests/STUB.h"
 
-void
-comm_read(int, char*, int, AsyncCall::Pointer &callback)
-{
-    fatal ("Not implemented");
-}
+void comm_read(const Comm::ConnectionPointer &conn, char *buf, int size, IOCB *handler, void *handler_data) STUB
+void comm_read(const Comm::ConnectionPointer &conn, char*, int, AsyncCall::Pointer &callback) STUB
 
 /* should be in stub_CommRead */
 #include "CommRead.h"
-CommRead::CommRead (int fd, char *buf, int len, AsyncCall::Pointer &callback)
-{
-    fatal ("Not implemented");
-}
+CommRead::CommRead(const Comm::ConnectionPointer &, char *, int, AsyncCall::Pointer &) STUB
+CommRead::CommRead() STUB
+DeferredReadManager::~DeferredReadManager() STUB
+DeferredRead::DeferredRead(DeferrableRead *, void *, CommRead const &) STUB
+void DeferredReadManager::delayRead(DeferredRead const &aRead) STUB
+void DeferredReadManager::kickReads(int const count) STUB
 
-CommRead::CommRead ()
-{
-    fatal ("Not implemented");
-}
-
-void
-commSetCloseOnExec(int fd)
-{
-    /* for tests... ignore */
-}
-
-void
-commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
-              time_t timeout)
-{
-    /* all test code runs synchronously at the moment */
-}
-
-void
-comm_quick_poll_required()
-{
-    /* for tests ... ignore */
-}
-
-int
-ignoreErrno(int ierrno)
-{
-    fatal ("Not implemented");
-    return -1;
-}
-
-int
-commSetTimeout(int fd, int timeout, PF * handler, void *data)
-{
-    fatal ("Not implemented");
-    return -1;
-}
-
-int
-commSetNonBlocking(int fd)
-{
-    fatal ("Not implemented");
-    return COMM_ERROR;
-}
-
-int
-commUnsetNonBlocking(int fd)
-{
-    fatal ("Not implemented");
-    return -1;
-}
-
-/* bah, cheating on stub count */
-
-pid_t
-ipcCreate(int type, const char *prog, const char *const args[], const char *name, IpAddress &local_addr, int *rfd, int *wfd, void **hIpc)
-{
-    fatal ("Not implemented");
-    return -1;
-}
-
-void
-comm_init(void)
-{
-    fd_table =(fde *) xcalloc(Squid_MaxFD, sizeof(fde));
-
-    /* Keep a few file descriptors free so that we don't run out of FD's
-     * after accepting a client but before it opens a socket or a file.
-     * Since Squid_MaxFD can be as high as several thousand, don't waste them */
-    RESERVED_FD = min(100, Squid_MaxFD / 4);
-}
+#include "comm.h"
+bool comm_iocallbackpending(void) STUB_RETVAL(false)
+int commSetNonBlocking(int fd) STUB_RETVAL(Comm::COMM_ERROR)
+int commUnsetNonBlocking(int fd) STUB_RETVAL(-1)
+void commSetCloseOnExec(int fd) STUB_NOP
+void commSetTcpKeepalive(int fd, int idle, int interval, int timeout) STUB
+void _comm_close(int fd, char const *file, int line) STUB
+void old_comm_reset_close(int fd) STUB
+void comm_reset_close(const Comm::ConnectionPointer &conn) STUB
+#if LINGERING_CLOSE
+void comm_lingering_close(int fd) STUB
+#endif
+int comm_connect_addr(int sock, const Ip::Address &addr) STUB_RETVAL(-1)
+void comm_init(void) STUB
+void comm_exit(void) STUB
+int comm_open(int, int, Ip::Address &, int, const char *note) STUB_RETVAL(-1)
+int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags) STUB_RETVAL(-1)
+void comm_import_opened(const Comm::ConnectionPointer &, const char *note, struct addrinfo *AI) STUB
+int comm_open_listener(int sock_type, int proto, Ip::Address &addr, int flags, const char *note) STUB_RETVAL(-1)
+void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note) STUB
+int comm_openex(int, int, Ip::Address &, int, tos_t tos, nfmark_t nfmark, const char *) STUB_RETVAL(-1)
+unsigned short comm_local_port(int fd) STUB_RETVAL(0)
+int comm_udp_sendto(int sock, const Ip::Address &to, const void *buf, int buflen) STUB_RETVAL(-1)
+void commCallCloseHandlers(int fd) STUB
+void commUnsetFdTimeout(int fd) STUB
+int commSetTimeout(const Comm::ConnectionPointer &, int, AsyncCall::Pointer&) STUB_RETVAL(-1)
+int commSetConnTimeout(const Comm::ConnectionPointer &conn, int seconds, AsyncCall::Pointer &callback) STUB_RETVAL(-1)
+int commUnsetConnTimeout(const Comm::ConnectionPointer &conn) STUB_RETVAL(-1)
+int ignoreErrno(int ierrno) STUB_RETVAL(-1)
+void commCloseAllSockets(void) STUB
+void checkTimeouts(void) STUB
+AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *, void *) STUB
+void comm_add_close_handler(int fd, AsyncCall::Pointer &) STUB
+void comm_remove_close_handler(int fd, CLCB *, void *) STUB
+void comm_remove_close_handler(int fd, AsyncCall::Pointer &)STUB
+int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from) STUB_RETVAL(-1)
+int comm_udp_recv(int fd, void *buf, size_t len, int flags) STUB_RETVAL(-1)
+ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags) STUB_RETVAL(-1)
+bool comm_has_incomplete_write(int) STUB_RETVAL(false)
+void commStartHalfClosedMonitor(int fd) STUB
+bool commHasHalfClosedMonitor(int fd) STUB_RETVAL(false)
+int CommSelectEngine::checkEvents(int timeout) STUB_RETVAL(0)
 
-/* MinGW needs also a stub of _comm_close() */
-void
-_comm_close(int fd, char const *file, int line)
-{
-    fatal ("Not implemented");
-}