Commit 58db1e65 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Isolate VTCP in its own include file

parent 71408867
......@@ -33,6 +33,7 @@
#include "cache.h"
#include "vcli.h"
#include "vtcp.h"
#include "cli_priv.h"
static pthread_t VCA_thread;
......
......@@ -39,6 +39,7 @@
#include "cache_backend.h"
#include "vrt.h"
#include "vtcp.h"
/*--------------------------------------------------------------------
* The "simple" director really isn't, since thats where all the actual
......
......@@ -45,6 +45,7 @@
#include "cli_priv.h"
#include "cache.h"
#include "vrt.h"
#include "vtcp.h"
#include "cache_backend.h"
/* Default averaging rate, we want something pretty responsive */
......
......@@ -70,6 +70,7 @@ DOT acceptor -> start [style=bold,color=green]
#include "cache.h"
#include "vcl.h"
#include "vtcp.h"
#include "cli_priv.h"
#include "hash_slinger.h"
#include "stevedore.h"
......
......@@ -34,6 +34,7 @@
#include "cache.h"
#include "cache_backend.h"
#include "vtcp.h"
/* Close a connection ------------------------------------------------*/
......
......@@ -38,6 +38,7 @@
#include "stevedore.h"
#include "cli_priv.h"
#include "vct.h"
#include "vtcp.h"
static unsigned fetchfrag;
......
......@@ -35,6 +35,7 @@
#include <poll.h>
#include "cache.h"
#include "vtcp.h"
static int
rdf(int fd0, int fd1)
......
......@@ -50,6 +50,7 @@
#include "cache_waiter.h"
#include "hash_slinger.h"
#include "vtcp.h"
/*--------------------------------------------------------------------
* MAC OS/X is incredibly moronic when it comes to time and such...
......
......@@ -36,6 +36,7 @@
#include "cache.h"
#include "vrt.h"
#include "vtcp.h"
#include "vrt_obj.h"
#include "cache_backend.h"
#include "hash_slinger.h"
......
......@@ -52,6 +52,7 @@
#include "vlu.h"
#include "vss.h"
#include "vbm.h"
#include "vtcp.h"
pid_t child_pid = -1;
......
......@@ -51,6 +51,7 @@
#include "vev.h"
#include "vlu.h"
#include "vss.h"
#include "vtcp.h"
#include "mgt.h"
......
......@@ -38,6 +38,7 @@
#include "vtc.h"
#include "vss.h"
#include "vtcp.h"
#include "libvarnish.h"
struct client {
......
......@@ -41,6 +41,7 @@
#include "libvarnish.h"
#include "vtc.h"
#include "vtcp.h"
#include "vgz.h"
......
......@@ -37,6 +37,7 @@
#include <sys/socket.h>
#include "vtc.h"
#include "vtcp.h"
#include "libvarnish.h"
#include "vss.h"
......
......@@ -46,6 +46,7 @@
#include <sys/socket.h>
#include "vtc.h"
#include "vtcp.h"
#include "libvarnish.h"
......
......@@ -55,7 +55,8 @@ nobase_noinst_HEADERS = \
vrt_obj.h \
vsb.h \
vsha256.h \
vss.h
vss.h \
vtcp.h
tbl/vrt_stv_var.h tbl/vcl_returns.h vcl.h vrt_obj.h: $(top_srcdir)/lib/libvcl/generate.py $(top_srcdir)/include/vrt.h
mkdir -p tbl
......
......@@ -48,40 +48,6 @@ typedef void sub_func_f(void*);
int SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name,
int maxlines);
/* from libvarnish/tcp.c */
/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */
#define VTCP_ADDRBUFSIZE 64
#define VTCP_PORTBUFSIZE 16
#if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
/*
* Solaris returns EINVAL if the other end unexepectedly reset the
* connection. This is a bug in Solaris and documented behaviour on NetBSD.
*/
#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN \
|| errno == EINVAL)
#else
#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN)
#endif
#define VTCP_Assert(a) assert(VTCP_Check(a))
void VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
void VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
int VTCP_filter_http(int sock);
int VTCP_blocking(int sock);
int VTCP_nonblocking(int sock);
int VTCP_linger(int sock, int linger);
#ifdef SOL_SOCKET
int VTCP_port(const struct sockaddr_storage *addr);
void VTCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf,
unsigned alen, char *pbuf, unsigned plen);
int VTCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen,
int msec);
void VTCP_close(int *s);
void VTCP_set_read_timeout(int s, double seconds);
#endif
/* from libvarnish/time.c */
#define TIM_FORMAT_SIZE 30
void TIM_format(double t, char *p);
......
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* from libvarnish/tcp.c */
/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */
#define VTCP_ADDRBUFSIZE 64
#define VTCP_PORTBUFSIZE 16
#if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
/*
* Solaris returns EINVAL if the other end unexepectedly reset the
* connection. This is a bug in Solaris and documented behaviour on NetBSD.
*/
#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN \
|| errno == EINVAL)
#else
#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN)
#endif
#define VTCP_Assert(a) assert(VTCP_Check(a))
void VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
void VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
int VTCP_filter_http(int sock);
int VTCP_blocking(int sock);
int VTCP_nonblocking(int sock);
int VTCP_linger(int sock, int linger);
#ifdef SOL_SOCKET
int VTCP_port(const struct sockaddr_storage *addr);
void VTCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf,
unsigned alen, char *pbuf, unsigned plen);
int VTCP_connect(int s, const struct sockaddr_storage *name, socklen_t namelen,
int msec);
void VTCP_close(int *s);
void VTCP_set_read_timeout(int s, double seconds);
#endif
......@@ -51,8 +51,7 @@
#include <unistd.h>
#include <math.h>
#include "config.h"
#include "vtcp.h"
#include "libvarnish.h"
/*--------------------------------------------------------------------*/
......
......@@ -44,6 +44,7 @@
#include <unistd.h>
#include "libvarnish.h"
#include "vtcp.h"
#include "vss.h"
/* lightweight addrinfo */
......
......@@ -32,6 +32,7 @@
#include <syslog.h>
#include <netinet/in.h>
#include "vrt.h"
#include "vtcp.h"
#include "../../bin/varnishd/cache.h"
#include "vcc_if.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment