Commit d771942c authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Hide backends and directors implementation details

Don't install cache_backend.h and cache_director.h, they expose more
than what a VMOD needs to see.

The VRT API jumps directly from struct vrt_backend to struct director,
which makes struct backend more than simply opaque, it is completely
invisible. However struct director needs to be visible and has been
moved to cache.h along with its functions definitions.
parent 987ea3c1
......@@ -99,6 +99,8 @@ varnishd_SOURCES = \
noinst_HEADERS = \
builtin_vcl.h \
cache/cache_backend.h \
cache/cache_director.h \
cache/cache_esi.h \
cache/cache_pool.h \
common/heritage.h \
......@@ -116,8 +118,6 @@ noinst_HEADERS = \
nobase_pkginclude_HEADERS = \
cache/cache.h \
cache/cache_filter.h \
cache/cache_backend.h \
cache/cache_director.h \
common/common.h \
common/params.h \
waiter/waiter.h
......
......@@ -189,6 +189,47 @@ struct http {
uint8_t conds; /* If-* headers present */
};
/*--------------------------------------------------------------------
* Director public APIs
*/
typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *,
double *changed);
typedef const struct director *vdi_resolve_f(const struct director *,
struct worker *, struct busyobj *);
typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct busyobj *);
typedef int vdi_getbody_f(const struct director *, struct worker *,
struct busyobj *);
typedef const struct suckaddr *vdi_getip_f(const struct director *,
struct worker *, struct busyobj *);
typedef void vdi_finish_f(const struct director *, struct worker *,
struct busyobj *);
typedef void vdi_http1pipe_f(const struct director *, struct req *,
struct busyobj *);
typedef void vdi_panic_f(const struct director *, struct vsb *);
struct director {
unsigned magic;
#define DIRECTOR_MAGIC 0x3336351d
const char *name;
char *vcl_name;
vdi_http1pipe_f *http1pipe;
vdi_healthy_f *healthy;
vdi_resolve_f *resolve;
vdi_gethdrs_f *gethdrs;
vdi_getbody_f *getbody;
vdi_getip_f *getip;
vdi_finish_f *finish;
vdi_panic_f *panic;
void *priv;
const void *priv2;
};
/*--------------------------------------------------------------------
* VFP filter state
*/
......
......@@ -37,49 +37,6 @@
*
*/
/*--------------------------------------------------------------------
* A director is a piece of code which selects one of possibly multiple
* backends to use.
*/
typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *,
double *changed);
typedef const struct director *vdi_resolve_f(const struct director *,
struct worker *, struct busyobj *);
typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct busyobj *);
typedef int vdi_getbody_f(const struct director *, struct worker *,
struct busyobj *);
typedef const struct suckaddr *vdi_getip_f(const struct director *,
struct worker *, struct busyobj *);
typedef void vdi_finish_f(const struct director *, struct worker *,
struct busyobj *);
typedef void vdi_http1pipe_f(const struct director *, struct req *,
struct busyobj *);
typedef void vdi_panic_f(const struct director *, struct vsb *);
struct director {
unsigned magic;
#define DIRECTOR_MAGIC 0x3336351d
const char *name;
char *vcl_name;
vdi_http1pipe_f *http1pipe;
vdi_healthy_f *healthy;
vdi_resolve_f *resolve;
vdi_gethdrs_f *gethdrs;
vdi_getbody_f *getbody;
vdi_getip_f *getip;
vdi_finish_f *finish;
vdi_panic_f *panic;
void *priv;
const void *priv2;
};
/* cache_director.c */
int VDI_GetHdr(struct worker *, struct busyobj *);
......
......@@ -31,7 +31,6 @@
#include <stdlib.h>
#include "cache/cache.h"
#include "cache/cache_director.h"
#include "vrt.h"
#include "vbm.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