src/server/object.c

changeset 5
dbc01588686e
parent 3
137197831306
child 6
ce8fecc9847d
equal deleted inserted replaced
4:998844b5ed25 5:dbc01588686e
36 36
37 httpd_object* object_new(char *name) { 37 httpd_object* object_new(char *name) {
38 // TODO: Speicherverwaltung 38 // TODO: Speicherverwaltung
39 httpd_object *obj = malloc(sizeof(httpd_object)); 39 httpd_object *obj = malloc(sizeof(httpd_object));
40 obj->name = name; 40 obj->name = name;
41 obj->path = NULL;
41 42
42 // create directive table 43 // create directive table
43 obj->dt = calloc(sizeof(struct dtable), NUM_NSAPI_TYPES - 1); 44 obj->dt = calloc(sizeof(struct dtable), NUM_NSAPI_TYPES - 1);
44 obj->nd = NUM_NSAPI_TYPES - 1; 45 obj->nd = NUM_NSAPI_TYPES - 1;
45 46
54 55
55 56
56 void object_add_directive(httpd_object *obj, directive *dir, int dt) { 57 void object_add_directive(httpd_object *obj, directive *dir, int dt) {
57 dtable *l = object_get_dtable(obj, dt); 58 dtable *l = object_get_dtable(obj, dt);
58 // allocate space for the new directive 59 // allocate space for the new directive
59 l->directive = realloc(l->directive, (l->ndir+1)*sizeof(directive*)); 60 l->dirs = realloc(l->dirs, (l->ndir+1)*sizeof(directive*));
60 // add directive 61 // add directive
61 l->directive[l->ndir] = dir; 62 l->dirs[l->ndir] = dir;
62 l->ndir++; 63 l->ndir++;
63 } 64 }
64 65
65 66
66 67
84 object_add_directive(obj, d2, NSAPIService); 85 object_add_directive(obj, d2, NSAPIService);
85 86
86 return objset; 87 return objset;
87 } 88 }
88 89
90
91 void httpobjconf_add_object(HTTPObjectConfig *conf, httpd_object *obj) {
92 conf->nobj++;
93 conf->objects = realloc(conf->objects, conf->nobj * sizeof(void*));
94 conf->objects[conf->nobj - 1] = obj;
95 }

mercurial