unsigned WS_Reserve(struct ws *ws, unsigned bytes);
void WS_Release(struct ws *ws, unsigned bytes);
void WS_ReleaseP(struct ws *ws, char *ptr);
-void WS_Assert(struct ws *ws);
+void WS_Assert(const struct ws *ws);
void WS_Reset(struct ws *ws);
char *WS_Alloc(struct ws *ws, unsigned bytes);
/* Backend method */
-typedef struct vbe_conn *vbe_getfd_f(struct sess *sp);
+typedef struct vbe_conn *vbe_getfd_f(const struct sess *sp);
typedef void vbe_close_f(struct worker *w, struct vbe_conn *vc);
typedef void vbe_recycle_f(struct worker *w, struct vbe_conn *vc);
typedef void vbe_init_f(void);
-typedef const char *vbe_gethostname_f(struct backend *);
-typedef void vbe_cleanup_f(struct backend *);
-typedef void vbe_updatehealth_f(struct sess *sp, struct vbe_conn *vc, int);
+typedef const char *vbe_gethostname_f(const struct backend *);
+typedef void vbe_cleanup_f(const struct backend *);
+typedef void vbe_updatehealth_f(const struct sess *sp, const struct vbe_conn *vc, int);
struct backend_method {
const char *name;
/* cache_backend.c */
void VBE_Init(void);
-struct vbe_conn *VBE_GetFd(struct sess *sp);
+struct vbe_conn *VBE_GetFd(const struct sess *sp);
void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc);
void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc);
struct bereq * VBE_new_bereq(void);
struct backend *VBE_NewBackend(struct backend_method *method);
struct vbe_conn *VBE_NewConn(void);
void VBE_ReleaseConn(struct vbe_conn *);
-void VBE_UpdateHealth(struct sess *sp, struct vbe_conn *, int);
+void VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *, int);
/* convenience functions for backend methods */
int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai);
const char *http_StatusMessage(int);
void HTTP_Init(void);
void http_ClrHeader(struct http *to);
-unsigned http_Write(struct worker *w, struct http *hp, int resp);
+unsigned http_Write(struct worker *w, const struct http *hp, int resp);
void http_CopyResp(struct http *to, const struct http *fm);
void http_SetResp(struct http *to, const char *proto, const char *status, const char *response);
void http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how);
void WRK_Reset(struct worker *w, int *fd);
unsigned WRK_Flush(struct worker *w);
unsigned WRK_Write(struct worker *w, const void *ptr, int len);
-unsigned WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf);
+unsigned WRK_WriteH(struct worker *w, const struct http_hdr *hh, const char *suf);
#ifdef HAVE_SENDFILE
void WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len);
#endif /* HAVE_SENDFILE */
/* cache_session.c [SES] */
void SES_Init(void);
-struct sess *SES_New(struct sockaddr *addr, unsigned len);
+struct sess *SES_New(const struct sockaddr *addr, unsigned len);
void SES_Delete(struct sess *sp);
void SES_RefSrcAddr(struct sess *sp);
void SES_Charge(struct sess *sp);
void SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl);
/* cache_vary.c */
-void VRY_Create(struct sess *sp);
-int VRY_Match(struct sess *sp, unsigned char *vary);
+void VRY_Create(const struct sess *sp);
+int VRY_Match(const struct sess *sp, const unsigned char *vary);
/* cache_vcl.c */
void VCL_Init(void);
#endif
/* rfc2616.c */
-int RFC2616_cache_policy(struct sess *sp, struct http *hp);
+int RFC2616_cache_policy(const struct sess *sp, const struct http *hp);
#if 1
#define MTX pthread_mutex_t
}
static void
-vca_kev(struct kevent *kp)
+vca_kev(const struct kevent *kp)
{
int i, j;
struct sess *sp;
/*--------------------------------------------------------------------*/
struct vbe_conn *
-VBE_GetFd(struct sess *sp)
+VBE_GetFd(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
* details and comments about this function.
*/
void
-VBE_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int a)
+VBE_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int a)
{
struct backend *b;
*/
static int
-ber_conn_try_list(struct sess *sp, struct brspec *bs)
+ber_conn_try_list(const struct sess *sp, struct brspec *bs)
{
struct addrinfo *ai, *from;
int s, loops;
/*--------------------------------------------------------------------*/
static int
-ber_conn_try(struct sess *sp, struct backend *bp, struct brspec *bs)
+ber_conn_try(const struct sess *sp, struct backend *bp, struct brspec *bs)
{
int s;
*/
static struct vbe_conn *
-ber_nextfd(struct sess *sp)
+ber_nextfd(const struct sess *sp)
{
struct vbe_conn *vc;
struct backend *bp;
}
static struct vbe_conn *
-ber_GetFd(struct sess *sp)
+ber_GetFd(const struct sess *sp)
{
struct vbe_conn *vc;
unsigned n;
/*--------------------------------------------------------------------*/
static void
-ber_Cleanup(struct backend *b)
+ber_Cleanup(const struct backend *b)
{
struct ber *ber;
struct vbe_conn *vbe;
/* Will return the hostname of the first backend in the list */
static const char *
-ber_GetHostname(struct backend *b)
+ber_GetHostname(const struct backend *b)
{
struct ber *ber;
* towards neutral (0) as time passes
*/
static void
-ber_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int add)
+ber_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add)
{
struct brspec *bs, *first;
struct ber *ber;
/*--------------------------------------------------------------------*/
void
-VRT_init_random_backend(struct backend **bp, struct vrt_random_backend *t)
+VRT_init_random_backend(struct backend **bp, const struct vrt_random_backend *t)
{
struct backend *b;
struct ber *ber;
*/
static int
-brr_conn_try_list(struct sess *sp, struct bspec *bs)
+brr_conn_try_list(const struct sess *sp, struct bspec *bs)
{
struct addrinfo *ai, *from;
int s, loops;
/*--------------------------------------------------------------------*/
static int
-brr_conn_try(struct sess *sp, struct backend *bp, struct bspec *bs)
+brr_conn_try(const struct sess *sp, struct backend *bp, struct bspec *bs)
{
int s;
*/
static struct vbe_conn *
-brr_nextfd(struct sess *sp)
+brr_nextfd(const struct sess *sp)
{
struct vbe_conn *vc;
struct backend *bp;
}
static struct vbe_conn *
-brr_GetFd(struct sess *sp)
+brr_GetFd(const struct sess *sp)
{
struct vbe_conn *vc;
unsigned n;
/*--------------------------------------------------------------------*/
static void
-brr_Cleanup(struct backend *b)
+brr_Cleanup(const struct backend *b)
{
struct brr *brr;
struct vbe_conn *vbe;
/* Will return the hostname of the first backend in the list */
static const char *
-brr_GetHostname(struct backend *b)
+brr_GetHostname(const struct backend *b)
{
struct brr *brr;
* towards neutral (0) as time passes
*/
static void
-brr_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int add)
+brr_UpdateHealth(const struct sess *sp, const struct vbe_conn *vc, int add)
{
struct bspec *bs, *first;
struct brr *brr;
/*--------------------------------------------------------------------*/
void
-VRT_init_round_robin_backend(struct backend **bp, struct vrt_round_robin_backend *t)
+VRT_init_round_robin_backend(struct backend **bp, const struct vrt_round_robin_backend *t)
{
struct backend *b;
struct brr *brr;
*/
static int
-bes_conn_try_list(struct sess *sp, struct bes *bes)
+bes_conn_try_list(const struct sess *sp, struct bes *bes)
{
struct addrinfo *ai, *from;
int s, loops;
/*--------------------------------------------------------------------*/
static int
-bes_conn_try(struct sess *sp, struct backend *bp)
+bes_conn_try(const struct sess *sp, struct backend *bp)
{
int s;
struct bes *bes;
*/
static struct vbe_conn *
-bes_nextfd(struct sess *sp)
+bes_nextfd(const struct sess *sp)
{
struct vbe_conn *vc;
struct backend *bp;
/*--------------------------------------------------------------------*/
static struct vbe_conn *
-bes_GetFd(struct sess *sp)
+bes_GetFd(const struct sess *sp)
{
struct vbe_conn *vc;
unsigned n;
/*--------------------------------------------------------------------*/
static void
-bes_Cleanup(struct backend *b)
+bes_Cleanup(const struct backend *b)
{
struct bes *bes;
struct vbe_conn *vbe;
/*--------------------------------------------------------------------*/
static const char *
-bes_GetHostname(struct backend *b)
+bes_GetHostname(const struct backend *b)
{
struct bes *bes;
/*--------------------------------------------------------------------*/
void
-VRT_init_simple_backend(struct backend **bp, struct vrt_simple_backend *t)
+VRT_init_simple_backend(struct backend **bp, const struct vrt_simple_backend *t)
{
struct backend *b;
struct bes *bes;
/*--------------------------------------------------------------------*/
unsigned
-http_Write(struct worker *w, struct http *hp, int resp)
+http_Write(struct worker *w, const struct http *hp, int resp)
{
unsigned u, l;
}
unsigned
-WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf)
+WRK_WriteH(struct worker *w, const struct http_hdr *hh, const char *suf)
{
unsigned u;
/*--------------------------------------------------------------------*/
static void
-ses_sum_acct(struct acct *sum, struct acct *inc)
+ses_sum_acct(struct acct *sum, const struct acct *inc)
{
sum->sess += inc->sess;
/*--------------------------------------------------------------------*/
struct sess *
-SES_New(struct sockaddr *addr, unsigned len)
+SES_New(const struct sockaddr *addr, unsigned len)
{
struct sessmem *sm;
struct sess *sp;
#include "cache.h"
void
-VRY_Create(struct sess *sp)
+VRY_Create(const struct sess *sp)
{
char *v, *p, *q, *h, *e;
struct vsb *sb, *sbh;
}
int
-VRY_Match(struct sess *sp, unsigned char *vary)
+VRY_Match(const struct sess *sp, const unsigned char *vary)
{
char *h, *e;
int i, l, lh;
while (*vary) {
/* Look for header */
- i = http_GetHdr(sp->http, (char*)vary, &h);
+ i = http_GetHdr(sp->http, (const char*)vary, &h);
vary += *vary + 2;
/* Expected length of header (or 0xffff) */
#include "cache.h"
void
-WS_Assert(struct ws *ws)
+WS_Assert(const struct ws *ws)
{
assert(ws != NULL);
*/
static struct objhead *
-hcl_lookup(struct sess *sp, struct objhead *noh)
+hcl_lookup(const struct sess *sp, struct objhead *noh)
{
struct objhead *roh;
struct hcl_entry *he, *he2;
*/
static int
-hcl_deref(struct objhead *oh)
+hcl_deref(const struct objhead *oh)
{
struct hcl_entry *he;
struct hcl_hd *hp;
*/
static struct objhead *
-hsl_lookup(struct sess *sp, struct objhead *nobj)
+hsl_lookup(const struct sess *sp, struct objhead *nobj)
{
struct hsl_entry *he, *he2;
int i;
*/
static int
-hsl_deref(struct objhead *obj)
+hsl_deref(const struct objhead *obj)
{
struct hsl_entry *he;
int ret;
typedef int hash_init_f(const char *);
typedef void hash_start_f(void);
-typedef struct objhead *hash_lookup_f(struct sess *sp, struct objhead *nobj);
-typedef int hash_deref_f(struct objhead *obj);
+typedef struct objhead *hash_lookup_f(const struct sess *sp, struct objhead *nobj);
+typedef int hash_deref_f(const struct objhead *obj);
struct hash_slinger {
const char *name;
/*--------------------------------------------------------------------*/
static int
-child_listener(struct ev *e, int what)
+child_listener(const struct ev *e, int what)
{
int i;
char buf[BUFSIZ];
/*--------------------------------------------------------------------*/
static int
-child_poker(struct ev *e, int what)
+child_poker(const struct ev *e, int what)
{
(void)e;
/*--------------------------------------------------------------------*/
static int
-mgt_sigchld(struct ev *e, int what)
+mgt_sigchld(const struct ev *e, int what)
{
int status;
pid_t r;
/*--------------------------------------------------------------------*/
static int
-mgt_sigint(struct ev *e, int what)
+mgt_sigint(const struct ev *e, int what)
{
(void)e;
};
static int
-mgt_cli_callback(struct ev *e, int what)
+mgt_cli_callback(const struct ev *e, int what)
{
struct cli_port *cp;
char *p, *q;
}
static int
-telnet_accept(struct ev *ev, int what)
+telnet_accept(const struct ev *ev, int what)
{
struct sockaddr_storage addr;
socklen_t addrlen;
struct ev;
struct evbase;
-typedef int ev_cb_f(struct ev *, int what);
+typedef int ev_cb_f(const struct ev *, int what);
struct ev {
unsigned magic;
#endif
static double
-RFC2616_Ttl(const struct sess *sp, struct http *hp, struct object *obj)
+RFC2616_Ttl(const struct sess *sp, const struct http *hp, struct object *obj)
{
int retirement_age;
unsigned u1, u2;
}
int
-RFC2616_cache_policy(struct sess *sp, struct http *hp)
+RFC2616_cache_policy(const struct sess *sp, const struct http *hp)
{
int body = 0;
}
void
-STV_trim(struct storage *st, size_t size)
+STV_trim(const struct storage *st, size_t size)
{
CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
}
void
-STV_free(struct storage *st)
+STV_free(const struct storage *st)
{
CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
struct iovec;
typedef void storage_init_f(struct stevedore *, const char *spec);
-typedef void storage_open_f(struct stevedore *);
+typedef void storage_open_f(const struct stevedore *);
typedef struct storage *storage_alloc_f(struct stevedore *, size_t size);
typedef void storage_trim_f(const struct storage *, size_t size);
typedef void storage_free_f(const struct storage *);
};
struct storage *STV_alloc(struct sess *sp, size_t size);
-void STV_trim(struct storage *st, size_t size);
-void STV_free(struct storage *st);
+void STV_trim(const struct storage *st, size_t size);
+void STV_free(const struct storage *st);
void STV_add(const char *spec);
void STV_open(void);
}
static void
-remfree(struct smf_sc *sc, struct smf *sp)
+remfree(const struct smf_sc *sc, struct smf *sp)
{
size_t b;
}
static void
-smf_open(struct stevedore *st)
+smf_open(const struct stevedore *st)
{
struct smf_sc *sc;
off_t fail = 1 << 30; /* XXX: where is OFF_T_MAX ? */
/*--------------------------------------------------------------------*/
static int
-cmp_hash(struct hash_slinger *s, const char *p, const char *q)
+cmp_hash(const struct hash_slinger *s, const char *p, const char *q)
{
if (strlen(s->name) != q - p)
return (1);
/*--------------------------------------------------------------------*/
static void
-cli_check(struct cli *cli)
+cli_check(const struct cli *cli)
{
if (cli->result == CLIS_OK) {
vsb_clear(cli->sb);
/* Backend related */
-void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *);
-void VRT_init_round_robin_backend(struct backend **, struct vrt_round_robin_backend *);
-void VRT_init_random_backend(struct backend **, struct vrt_random_backend *);
+void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *);
+void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *);
+void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);
void VRT_fini_backend(struct backend *);
char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);
}
vcc_NextToken(tl);
- Fc(tl, 0, "\nstatic struct vrt_simple_backend sbe_%.*s = {\n",
+ Fc(tl, 0, "\nstatic const struct vrt_simple_backend sbe_%.*s = {\n",
PF(t_be));
Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(t_be));
if (t_port != NULL)
Fc(tl, 0, "\nstatic struct backend\t*backends[%d];\n", tl->nbackend);
- Fc(tl, 0, "\nstruct VCL_conf VCL_conf = {\n");
+ Fc(tl, 0, "\nconst struct VCL_conf VCL_conf = {\n");
Fc(tl, 0, "\t.magic = VCL_CONF_MAGIC,\n");
Fc(tl, 0, "\t.init_func = VGC_Init,\n");
Fc(tl, 0, "\t.fini_func = VGC_Fini,\n");
vcl_output_lang_h(tl->fh);
Fh(tl, 0, "\n/* ---===### VCC generated below here ###===---*/\n");
- Fh(tl, 0, "\nextern struct VCL_conf VCL_conf;\n");
+ Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n");
/* Register and lex the main source */
VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
vsb_cat(sb, "\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "/* Backend related */\n");
- vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *);\n");
- vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, struct vrt_round_robin_backend *);\n");
- vsb_cat(sb, "void VRT_init_random_backend(struct backend **, struct vrt_random_backend *);\n");
+ vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, const struct vrt_simple_backend *);\n");
+ vsb_cat(sb, "void VRT_init_round_robin_backend(struct backend **, const struct vrt_round_robin_backend *);\n");
+ vsb_cat(sb, "void VRT_init_random_backend(struct backend **, const struct vrt_random_backend *);\n");
vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);\n");