From ca222673287b8a97f6112987019d2771ce7c474b Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 26 Aug 2008 07:47:23 +0000 Subject: [PATCH] Move the tcp.c file to libvarnish, we need the primitives in varnishtest also. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3126 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/Makefile.am | 1 - varnish-cache/bin/varnishd/common.h | 15 --------------- varnish-cache/include/libvarnish.h | 15 +++++++++++++++ varnish-cache/lib/libvarnish/Makefile.am | 1 + .../{bin/varnishd => lib/libvarnish}/tcp.c | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) rename varnish-cache/{bin/varnishd => lib/libvarnish}/tcp.c (99%) diff --git a/varnish-cache/bin/varnishd/Makefile.am b/varnish-cache/bin/varnishd/Makefile.am index e487812d..81f0e8e8 100644 --- a/varnish-cache/bin/varnishd/Makefile.am +++ b/varnish-cache/bin/varnishd/Makefile.am @@ -53,7 +53,6 @@ varnishd_SOURCES = \ storage_malloc.c \ storage_synth.c \ storage_umem.c \ - tcp.c \ varnishd.c noinst_HEADERS = \ diff --git a/varnish-cache/bin/varnishd/common.h b/varnish-cache/bin/varnishd/common.h index 280486a4..82913efd 100644 --- a/varnish-cache/bin/varnishd/common.h +++ b/varnish-cache/bin/varnishd/common.h @@ -42,21 +42,6 @@ void VSL_Panic(int *len, char **ptr); void VSL_MgtInit(const char *fn, unsigned size); extern struct varnish_stats *VSL_stats; -/* tcp.c */ -/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */ -#define TCP_ADDRBUFSIZE 64 -#define TCP_PORTBUFSIZE 16 - -void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen); -void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen); -int TCP_filter_http(int sock); -void TCP_blocking(int sock); -void TCP_nonblocking(int sock); -#ifdef SOL_SOCKET -int TCP_connect(int s, const struct sockaddr *name, socklen_t namelen, int msec); -void TCP_close(int *s); -#endif - #define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr)) /* Really belongs in mgt.h, but storage_file chokes on both */ diff --git a/varnish-cache/include/libvarnish.h b/varnish-cache/include/libvarnish.h index 8f74f839..e250c33b 100644 --- a/varnish-cache/include/libvarnish.h +++ b/varnish-cache/include/libvarnish.h @@ -50,6 +50,21 @@ uint32_t crc32_l(const void *p1, unsigned l); /* from libvarnish/num.c */ const char *str2bytes(const char *p, uintmax_t *r, uintmax_t rel); +/* from libvarnish/tcp.c */ +/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */ +#define TCP_ADDRBUFSIZE 64 +#define TCP_PORTBUFSIZE 16 + +void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen); +int TCP_filter_http(int sock); +void TCP_blocking(int sock); +void TCP_nonblocking(int sock); +#ifdef SOL_SOCKET +void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen); +int TCP_connect(int s, const struct sockaddr *name, socklen_t namelen, int msec); +void TCP_close(int *s); +#endif + /* from libvarnish/time.c */ void TIM_format(double t, char *p); time_t TIM_parse(const char *p); diff --git a/varnish-cache/lib/libvarnish/Makefile.am b/varnish-cache/lib/libvarnish/Makefile.am index 00a01bf6..800704a6 100644 --- a/varnish-cache/lib/libvarnish/Makefile.am +++ b/varnish-cache/lib/libvarnish/Makefile.am @@ -14,6 +14,7 @@ libvarnish_la_SOURCES = \ flopen.c \ num.c \ time.c \ + tcp.c \ vct.c \ version.c \ vev.c \ diff --git a/varnish-cache/bin/varnishd/tcp.c b/varnish-cache/lib/libvarnish/tcp.c similarity index 99% rename from varnish-cache/bin/varnishd/tcp.c rename to varnish-cache/lib/libvarnish/tcp.c index af54042a..159098d6 100644 --- a/varnish-cache/bin/varnishd/tcp.c +++ b/varnish-cache/lib/libvarnish/tcp.c @@ -53,7 +53,7 @@ #include "compat/strlcpy.h" #endif -#include "mgt.h" +#include "libvarnish.h" /*--------------------------------------------------------------------*/ -- 2.39.5