summaryrefslogtreecommitdiffstats
path: root/traceroute/module.c
blob: c83b8089434c771942ba47d92ae8ff0e7c8a5d76 (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
/*
    Copyright (c)  2006, 2007		Dmitry Butskoy
					<buc@citadel.stu.neva.ru>
    License:  GPL v2 or any later

    See COPYING for the status of this software.
*/

#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "traceroute.h"


static tr_module *base = NULL;

void tr_register_module (tr_module *ops) {

	ops->next = base;
	base = ops;
}

const tr_module *tr_get_module (const char *name) {
	const tr_module *ops;

	if (!name)  return 0;

	for (ops = base; ops; ops = ops->next) {
	    if (!strcasecmp (name, ops->name))
		    return ops;
	}

	return NULL;
}