blob: 8c3543b3dca43ad7445c2518049f0021942f732a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
* http_vhostdb_api - virtual hosts mapping backend registration
*
* Copyright(c) 2017 Glenn Strauss gstrauss()gluelogic.com All rights reserved
* License: BSD 3-clause (same as lighttpd)
*/
#include "first.h"
#include "mod_vhostdb_api.h"
#include <string.h>
static http_vhostdb_backend_t http_vhostdb_backends[8];
void http_vhostdb_dumbdata_reset (void)
{
memset(http_vhostdb_backends, 0, sizeof(http_vhostdb_backends));
}
const http_vhostdb_backend_t * http_vhostdb_backend_get (const buffer *name)
{
int i = 0;
while (NULL != http_vhostdb_backends[i].name
&& 0 != strcmp(http_vhostdb_backends[i].name, name->ptr)) {
++i;
}
return (NULL != http_vhostdb_backends[i].name)
? http_vhostdb_backends+i
: NULL;
}
void http_vhostdb_backend_set (const http_vhostdb_backend_t *backend)
{
unsigned int i = 0;
while (NULL != http_vhostdb_backends[i].name) ++i;
/*(must resize http_vhostdb_backends[] if too many different backends)*/
force_assert(
i < (sizeof(http_vhostdb_backends)/sizeof(http_vhostdb_backend_t))-1);
memcpy(http_vhostdb_backends+i, backend, sizeof(http_vhostdb_backend_t));
}
|