1 /*
2 * SysDB - src/core/store_lookup.c
3 * Copyright (C) 2014 Sebastian 'tokkee' Harl <sh@tokkee.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
28 /*
29 * This module implements operators which may be used to select contents of
30 * the store by matching various attributes of the stored objects. For now, a
31 * simple full table scan is supported only.
32 */
34 #if HAVE_CONFIG_H
35 # include "config.h"
36 #endif /* HAVE_CONFIG_H */
38 #include "sysdb.h"
39 #include "core/store-private.h"
40 #include "core/object.h"
42 #include <assert.h>
44 #include <sys/types.h>
45 #include <regex.h>
47 #include <stdlib.h>
48 #include <string.h>
50 /*
51 * private data types
52 */
54 typedef struct {
55 sdb_store_matcher_t *m;
56 sdb_store_lookup_cb cb;
57 void *user_data;
58 } lookup_iter_data_t;
60 /*
61 * private helper functions
62 */
64 static int
65 lookup_iter(sdb_store_base_t *obj, void *user_data)
66 {
67 lookup_iter_data_t *d = user_data;
69 if (sdb_store_matcher_matches(d->m, obj))
70 return d->cb(obj, d->user_data);
71 return 0;
72 } /* lookup_iter */
74 /*
75 * matcher implementations
76 */
78 static int
79 match_logical(sdb_store_matcher_t *m, sdb_store_base_t *obj);
80 static int
81 match_unary(sdb_store_matcher_t *m, sdb_store_base_t *obj);
82 static int
83 match_obj(sdb_store_matcher_t *m, sdb_store_base_t *obj);
85 /* specific matchers */
87 static int
88 match_name(name_matcher_t *m, const char *name)
89 {
90 assert(m);
92 if ((! m->name) && (! m->name_re))
93 return 1;
95 if (! name)
96 name = "";
98 if (m->name && strcasecmp(m->name, name))
99 return 0;
100 if (m->name_re && regexec(m->name_re, name,
101 /* matches */ 0, NULL, /* flags = */ 0))
102 return 0;
103 return 1;
104 } /* match_name */
106 static char *
107 name_tostring(name_matcher_t *m, char *buf, size_t buflen)
108 {
109 snprintf(buf, buflen, "{ %s%s%s, %p }",
110 m->name ? "'" : "", m->name ? m->name : "NULL", m->name ? "'" : "",
111 m->name_re);
112 return buf;
113 } /* name_tostring */
115 static char *
116 logical_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
117 {
118 char left[buflen + 1], right[buflen + 1];
120 if (! m) {
121 /* this should not happen */
122 snprintf(buf, buflen, "()");
123 return buf;
124 }
126 assert((m->type == MATCHER_OR) || (m->type == MATCHER_AND));
127 snprintf(buf, buflen, "(%s, %s, %s)",
128 m->type == MATCHER_OR ? "OR" : "AND",
129 sdb_store_matcher_tostring(OP_M(m)->left, left, sizeof(left)),
130 sdb_store_matcher_tostring(OP_M(m)->right, right, sizeof(right)));
131 return buf;
132 } /* logical_tostring */
134 static char *
135 unary_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
136 {
137 char op[buflen + 1];
139 if (! m) {
140 /* this should not happen */
141 snprintf(buf, buflen, "()");
142 return buf;
143 }
145 assert(m->type == MATCHER_NOT);
146 snprintf(buf, buflen, "(NOT, %s)",
147 sdb_store_matcher_tostring(UOP_M(m)->op, op, sizeof(op)));
148 return buf;
149 } /* unary_tostring */
151 static char *
152 attr_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
153 {
154 char name[buflen + 1], value[buflen + 1];
156 if (! m) {
157 snprintf(buf, buflen, "ATTR{}");
158 return buf;
159 }
161 assert(m->type == MATCHER_ATTR);
162 snprintf(buf, buflen, "ATTR{ NAME%s, VALUE%s }",
163 name_tostring(&OBJ_M(m)->name, name, sizeof(name)),
164 name_tostring(&ATTR_M(m)->value, value, sizeof(value)));
165 return buf;
166 } /* attr_tostring */
168 static char *
169 service_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
170 {
171 char name[buflen + 1], attr[buflen + 1];
173 if (! m) {
174 snprintf(buf, buflen, "SERVICE{}");
175 return buf;
176 }
178 assert(m->type == MATCHER_SERVICE);
179 snprintf(buf, buflen, "SERVICE{ NAME%s, %s }",
180 name_tostring(&OBJ_M(m)->name, name, sizeof(name)),
181 attr_tostring(SDB_STORE_MATCHER(SERVICE_M(m)->attr),
182 attr, sizeof(attr)));
183 return buf;
184 } /* service_tostring */
186 static char *
187 host_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
188 {
189 char name[buflen + 1], service[buflen + 1], attr[buflen + 1];
191 if (! m) {
192 snprintf(buf, buflen, "HOST{}");
193 return buf;
194 }
196 assert(m->type == MATCHER_HOST);
197 snprintf(buf, buflen, "HOST{ NAME%s, %s, %s }",
198 name_tostring(&OBJ_M(m)->name, name, sizeof(name)),
199 service_tostring(SDB_STORE_MATCHER(HOST_M(m)->service),
200 service, sizeof(service)),
201 attr_tostring(SDB_STORE_MATCHER(HOST_M(m)->attr),
202 attr, sizeof(attr)));
203 return buf;
204 } /* host_tostring */
206 /* match attribute specific values;
207 * always call this function through match_obj() */
208 static int
209 match_attr(attr_matcher_t *m, sdb_store_base_t *obj)
210 {
211 assert(m && obj);
213 if (obj->type != SDB_ATTRIBUTE)
214 return 0;
216 {
217 sdb_attribute_t *attr = SDB_ATTR(obj);
218 char buf[sdb_data_strlen(&attr->value) + 1];
220 if (sdb_data_format(&attr->value, buf, sizeof(buf), SDB_UNQUOTED) <= 0)
221 return 0;
222 return match_name(&m->value, buf);
223 }
224 } /* match_attr */
226 /* match service specific values;
227 * always call this function through match_obj() */
228 static int
229 match_service(service_matcher_t *m, sdb_store_base_t *obj)
230 {
231 sdb_llist_iter_t *iter;
233 assert(m && obj);
235 if (obj->type != SDB_SERVICE)
236 return 0;
238 if (! m->attr)
239 return 1;
241 iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes);
242 while (sdb_llist_iter_has_next(iter)) {
243 sdb_store_base_t *attr = STORE_BASE(sdb_llist_iter_get_next(iter));
245 /* if any of the attributes matches we found a matching service */
246 if (match_obj(M(m->attr), attr)) {
247 sdb_llist_iter_destroy(iter);
248 return 1;
249 }
250 }
251 sdb_llist_iter_destroy(iter);
252 return 0;
253 } /* match_service */
255 /* match host specific values;
256 * always call this function through match_obj() */
257 static int
258 match_host(host_matcher_t *m, sdb_store_base_t *obj)
259 {
260 sdb_llist_iter_t *iter;
261 int status;
263 assert(m && obj);
265 if (obj->type != SDB_HOST)
266 return 0;
268 if (m->service) {
269 iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->children);
270 status = 0;
271 }
272 else {
273 iter = NULL;
274 status = 1;
275 }
276 while (sdb_llist_iter_has_next(iter)) {
277 sdb_store_base_t *service = STORE_BASE(sdb_llist_iter_get_next(iter));
279 /* found a matching service */
280 if (match_obj(M(m->service), service)) {
281 status = 1;
282 break;
283 }
284 }
285 sdb_llist_iter_destroy(iter);
287 if (! status)
288 return status;
289 else if (! m->attr)
290 return 1;
292 iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes);
293 while (sdb_llist_iter_has_next(iter)) {
294 sdb_store_base_t *attr = STORE_BASE(sdb_llist_iter_get_next(iter));
296 /* if any attribute matches, we found a matching host */
297 if (match_obj(M(m->attr), attr)) {
298 sdb_llist_iter_destroy(iter);
299 return 1;
300 }
301 }
302 sdb_llist_iter_destroy(iter);
303 return 0;
304 } /* match_host */
306 /* generic matchers */
308 typedef int (*matcher_cb)(sdb_store_matcher_t *, sdb_store_base_t *);
310 /* this array needs to be indexable by the matcher types;
311 * -> update the enum in store-private.h when updating this */
312 static matcher_cb matchers[] = {
313 match_logical,
314 match_logical,
315 match_unary,
316 match_obj,
317 match_obj,
318 match_obj,
319 };
321 typedef char *(*matcher_tostring_cb)(sdb_store_matcher_t *, char *, size_t);
323 static matcher_tostring_cb matchers_tostring[] = {
324 logical_tostring,
325 logical_tostring,
326 unary_tostring,
327 attr_tostring,
328 service_tostring,
329 host_tostring,
330 };
332 static int
333 match_logical(sdb_store_matcher_t *m, sdb_store_base_t *obj)
334 {
335 int status;
337 assert(m && obj);
338 assert(OP_M(m)->left && OP_M(m)->right);
340 status = sdb_store_matcher_matches(OP_M(m)->left, obj);
341 /* lazy evaluation */
342 if ((! status) && (m->type == MATCHER_AND))
343 return status;
344 else if (status && (m->type == MATCHER_OR))
345 return status;
347 return sdb_store_matcher_matches(OP_M(m)->right, obj);
348 } /* match_logical */
350 static int
351 match_unary(sdb_store_matcher_t *m, sdb_store_base_t *obj)
352 {
353 assert(m && obj);
354 assert(UOP_M(m)->op);
356 return !sdb_store_matcher_matches(UOP_M(m)->op, obj);
357 } /* match_unary */
359 static int
360 match_obj(sdb_store_matcher_t *m, sdb_store_base_t *obj)
361 {
362 int status;
364 assert(m && obj);
366 status = match_name(&OBJ_M(m)->name, obj->super.name);
367 if (! status)
368 return status;
370 switch (m->type) {
371 case MATCHER_ATTR:
372 return match_attr(ATTR_M(m), obj);
373 break;
374 case MATCHER_SERVICE:
375 return match_service(SERVICE_M(m), obj);
376 break;
377 case MATCHER_HOST:
378 return match_host(HOST_M(m), obj);
379 break;
380 }
381 return 0;
382 } /* match_obj */
384 /*
385 * private matcher types
386 */
388 /* initializes a name matcher consuming two elements from ap */
389 static int
390 name_matcher_init(name_matcher_t *m, va_list ap)
391 {
392 const char *name = va_arg(ap, const char *);
393 const char *name_re = va_arg(ap, const char *);
395 if (name) {
396 m->name = strdup(name);
397 if (! m->name)
398 return -1;
399 }
400 if (name_re) {
401 m->name_re = malloc(sizeof(*m->name_re));
402 if (! m->name_re)
403 return -1;
404 if (regcomp(m->name_re, name_re, REG_EXTENDED | REG_ICASE | REG_NOSUB))
405 return -1;
406 }
407 return 0;
408 } /* name_matcher_init */
410 static void
411 name_matcher_destroy(name_matcher_t *m)
412 {
413 if (m->name)
414 free(m->name);
415 if (m->name_re) {
416 regfree(m->name_re);
417 free(m->name_re);
418 }
419 } /* name_matcher_destroy */
421 /* initializes an object matcher consuming two elements from ap */
422 static int
423 obj_matcher_init(sdb_object_t *obj, va_list ap)
424 {
425 obj_matcher_t *m = OBJ_M(obj);
426 return name_matcher_init(&m->name, ap);
427 } /* obj_matcher_init */
429 static void
430 obj_matcher_destroy(sdb_object_t *obj)
431 {
432 obj_matcher_t *m = OBJ_M(obj);
433 name_matcher_destroy(&m->name);
434 } /* obj_matcher_destroy */
436 static int
437 attr_matcher_init(sdb_object_t *obj, va_list ap)
438 {
439 attr_matcher_t *attr = ATTR_M(obj);
440 int status;
442 M(obj)->type = MATCHER_ATTR;
444 status = obj_matcher_init(obj, ap);
445 if (! status)
446 status = name_matcher_init(&attr->value, ap);
447 return status;
448 } /* attr_matcher_init */
450 static void
451 attr_matcher_destroy(sdb_object_t *obj)
452 {
453 attr_matcher_t *attr = ATTR_M(obj);
455 obj_matcher_destroy(obj);
456 name_matcher_destroy(&attr->value);
457 } /* attr_matcher_destroy */
459 static int
460 service_matcher_init(sdb_object_t *obj, va_list ap)
461 {
462 attr_matcher_t *attr;
463 int status;
465 M(obj)->type = MATCHER_SERVICE;
467 status = obj_matcher_init(obj, ap);
468 if (status)
469 return status;
471 attr = va_arg(ap, attr_matcher_t *);
473 sdb_object_ref(SDB_OBJ(attr));
474 SERVICE_M(obj)->attr = attr;
475 return 0;
476 } /* service_matcher_init */
478 static void
479 service_matcher_destroy(sdb_object_t *obj)
480 {
481 obj_matcher_destroy(obj);
482 sdb_object_deref(SDB_OBJ(SERVICE_M(obj)->attr));
483 } /* service_matcher_destroy */
485 static int
486 host_matcher_init(sdb_object_t *obj, va_list ap)
487 {
488 service_matcher_t *service;
489 attr_matcher_t *attr;
490 int status;
492 M(obj)->type = MATCHER_HOST;
494 status = obj_matcher_init(obj, ap);
495 if (status)
496 return status;
498 service = va_arg(ap, service_matcher_t *);
499 attr = va_arg(ap, attr_matcher_t *);
501 sdb_object_ref(SDB_OBJ(service));
502 HOST_M(obj)->service = service;
503 sdb_object_ref(SDB_OBJ(attr));
504 HOST_M(obj)->attr = attr;
505 return 0;
506 } /* host_matcher_init */
508 static void
509 host_matcher_destroy(sdb_object_t *obj)
510 {
511 obj_matcher_destroy(obj);
512 sdb_object_deref(SDB_OBJ(HOST_M(obj)->service));
513 sdb_object_deref(SDB_OBJ(HOST_M(obj)->attr));
514 } /* host_matcher_destroy */
516 static int
517 op_matcher_init(sdb_object_t *obj, va_list ap)
518 {
519 M(obj)->type = va_arg(ap, int);
520 if ((M(obj)->type != MATCHER_OR) && (M(obj)->type != MATCHER_AND))
521 return -1;
523 OP_M(obj)->left = va_arg(ap, sdb_store_matcher_t *);
524 sdb_object_ref(SDB_OBJ(OP_M(obj)->left));
525 OP_M(obj)->right = va_arg(ap, sdb_store_matcher_t *);
526 sdb_object_ref(SDB_OBJ(OP_M(obj)->right));
528 if ((! OP_M(obj)->left) || (! OP_M(obj)->right))
529 return -1;
530 return 0;
531 } /* op_matcher_init */
533 static void
534 op_matcher_destroy(sdb_object_t *obj)
535 {
536 if (OP_M(obj)->left)
537 sdb_object_deref(SDB_OBJ(OP_M(obj)->left));
538 if (OP_M(obj)->right)
539 sdb_object_deref(SDB_OBJ(OP_M(obj)->right));
540 } /* op_matcher_destroy */
542 static int
543 uop_matcher_init(sdb_object_t *obj, va_list ap)
544 {
545 M(obj)->type = va_arg(ap, int);
546 if (M(obj)->type != MATCHER_NOT)
547 return -1;
549 UOP_M(obj)->op = va_arg(ap, sdb_store_matcher_t *);
550 sdb_object_ref(SDB_OBJ(UOP_M(obj)->op));
552 if (! UOP_M(obj)->op)
553 return -1;
554 return 0;
555 } /* uop_matcher_init */
557 static void
558 uop_matcher_destroy(sdb_object_t *obj)
559 {
560 if (UOP_M(obj)->op)
561 sdb_object_deref(SDB_OBJ(UOP_M(obj)->op));
562 } /* uop_matcher_destroy */
564 static sdb_type_t attr_type = {
565 /* size = */ sizeof(attr_matcher_t),
566 /* init = */ attr_matcher_init,
567 /* destroy = */ attr_matcher_destroy,
568 };
570 static sdb_type_t service_type = {
571 /* size = */ sizeof(service_matcher_t),
572 /* init = */ service_matcher_init,
573 /* destroy = */ service_matcher_destroy,
574 };
576 static sdb_type_t host_type = {
577 /* size = */ sizeof(host_matcher_t),
578 /* init = */ host_matcher_init,
579 /* destroy = */ host_matcher_destroy,
580 };
582 static sdb_type_t op_type = {
583 /* size = */ sizeof(op_matcher_t),
584 /* init = */ op_matcher_init,
585 /* destroy = */ op_matcher_destroy,
586 };
588 static sdb_type_t uop_type = {
589 /* size = */ sizeof(uop_matcher_t),
590 /* init = */ uop_matcher_init,
591 /* destroy = */ uop_matcher_destroy,
592 };
594 /*
595 * public API
596 */
598 sdb_store_matcher_t *
599 sdb_store_attr_matcher(const char *attr_name, const char *attr_name_re,
600 const char *attr_value, const char *attr_value_re)
601 {
602 return M(sdb_object_create("attr-matcher", attr_type,
603 attr_name, attr_name_re, attr_value, attr_value_re));
604 } /* sdb_store_attr_matcher */
606 sdb_store_matcher_t *
607 sdb_store_service_matcher(const char *service_name, const char *service_name_re,
608 sdb_store_matcher_t *attr_matcher)
609 {
610 return M(sdb_object_create("service-matcher", service_type,
611 service_name, service_name_re, attr_matcher));
612 } /* sdb_store_service_matcher */
614 sdb_store_matcher_t *
615 sdb_store_host_matcher(const char *host_name, const char *host_name_re,
616 sdb_store_matcher_t *service_matcher,
617 sdb_store_matcher_t *attr_matcher)
618 {
619 return M(sdb_object_create("host-matcher", host_type,
620 host_name, host_name_re, service_matcher, attr_matcher));
621 } /* sdb_store_host_matcher */
623 sdb_store_matcher_t *
624 sdb_store_matcher_parse_cmp(const char *obj_type, const char *attr,
625 const char *op, const char *value)
626 {
627 int typ = -1;
628 int inv = 0;
630 sdb_store_matcher_t *m = NULL;
632 const char *matcher = NULL;
633 const char *matcher_re = NULL;
635 if (! strcasecmp(obj_type, "host"))
636 typ = SDB_HOST;
637 else if (! strcasecmp(obj_type, "service"))
638 typ = SDB_SERVICE;
639 else if (! strcasecmp(obj_type, "attribute"))
640 typ = SDB_ATTRIBUTE;
642 /* TODO: support other operators */
643 if (! strcasecmp(op, "=")) {
644 matcher = value;
645 }
646 else if (! strcasecmp(op, "!=")) {
647 matcher = value;
648 inv = 1;
649 }
650 else if (! strcasecmp(op, "=~")) {
651 matcher_re = value;
652 }
653 else if (! strcasecmp(op, "!~")) {
654 matcher_re = value;
655 inv = 1;
656 }
657 else
658 return NULL;
660 if (! strcasecmp(attr, "name")) {
661 /* accept */
662 }
663 else if (typ == SDB_ATTRIBUTE)
664 m = sdb_store_host_matcher(/* name = */ NULL, NULL,
665 /* service = */ NULL,
666 sdb_store_attr_matcher(attr, NULL, matcher, matcher_re));
667 else
668 return NULL;
670 if (m) {
671 /* accept the attribute value matcher */
672 }
673 else if (typ == SDB_HOST)
674 m = sdb_store_host_matcher(matcher, matcher_re, NULL, NULL);
675 else if (typ == SDB_SERVICE)
676 m = sdb_store_host_matcher(/* name = */ NULL, NULL,
677 sdb_store_service_matcher(matcher, matcher_re, NULL),
678 /* attr = */ NULL);
679 else if (typ == SDB_ATTRIBUTE)
680 m = sdb_store_host_matcher(/* name = */ NULL, NULL,
681 /* service = */ NULL,
682 sdb_store_attr_matcher(matcher, matcher_re, NULL, NULL));
684 if (m && inv) {
685 sdb_store_matcher_t *tmp;
686 tmp = sdb_store_inv_matcher(m);
687 /* pass ownership to the inverse matcher */
688 sdb_object_deref(SDB_OBJ(m));
689 m = tmp;
690 }
691 return m;
692 } /* sdb_store_matcher_parse_cmp */
694 sdb_store_matcher_t *
695 sdb_store_dis_matcher(sdb_store_matcher_t *left, sdb_store_matcher_t *right)
696 {
697 return M(sdb_object_create("dis-matcher", op_type, MATCHER_OR,
698 left, right));
699 } /* sdb_store_dis_matcher */
701 sdb_store_matcher_t *
702 sdb_store_con_matcher(sdb_store_matcher_t *left, sdb_store_matcher_t *right)
703 {
704 return M(sdb_object_create("con-matcher", op_type, MATCHER_AND,
705 left, right));
706 } /* sdb_store_con_matcher */
708 sdb_store_matcher_t *
709 sdb_store_inv_matcher(sdb_store_matcher_t *m)
710 {
711 return M(sdb_object_create("inv-matcher", uop_type, MATCHER_NOT, m));
712 } /* sdb_store_inv_matcher */
714 int
715 sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_base_t *obj)
716 {
717 /* "NULL" always matches */
718 if ((! m) || (! obj))
719 return 1;
721 if ((m->type < 0) || ((size_t)m->type >= SDB_STATIC_ARRAY_LEN(matchers)))
722 return 0;
724 return matchers[m->type](m, obj);
725 } /* sdb_store_matcher_matches */
727 char *
728 sdb_store_matcher_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen)
729 {
730 if (! m)
731 return NULL;
733 if ((m->type < 0)
734 || (((size_t)m->type >= SDB_STATIC_ARRAY_LEN(matchers_tostring))))
735 return NULL;
736 return matchers_tostring[m->type](m, buf, buflen);
737 } /* sdb_store_matcher_tostring */
739 int
740 sdb_store_lookup(sdb_store_matcher_t *m, sdb_store_lookup_cb cb,
741 void *user_data)
742 {
743 lookup_iter_data_t data = { m, cb, user_data };
745 if (! cb)
746 return -1;
747 return sdb_store_iterate(lookup_iter, &data);
748 } /* sdb_store_lookup */
750 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */