Create experimental new options API, various cleanups
[asterisk/asterisk.git] / apps / app_skel.c
1 /*
2  * Asterisk -- A telephony toolkit for Linux.
3  *
4  * Skeleton application
5  * 
6  * Copyright (C) 1999, Mark Spencer
7  *
8  * Mark Spencer <markster@linux-support.net>
9  *
10  * This program is free software, distributed under the terms of
11  * the GNU General Public License
12  */
13
14 #include <asterisk/file.h>
15 #include <asterisk/logger.h>
16 #include <asterisk/channel.h>
17 #include <asterisk/pbx.h>
18 #include <asterisk/module.h>
19 #include <asterisk/lock.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <string.h>
23
24 static char *tdesc = "Trivial skeleton Application";
25 static char *app = "skel";
26 static char *synopsis = 
27 "  This is a skeleton application that shows you the basic structure to create your\n"
28 "own asterisk applications.\n";
29
30 STANDARD_LOCAL_USER;
31
32 LOCAL_USER_DECL;
33
34 static int skel_exec(struct ast_channel *chan, void *data)
35 {
36         int res=0;
37         struct localuser *u;
38         if (!data) {
39                 ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
40                 return -1;
41         }
42         LOCAL_USER_ADD(u);
43         /* Do our thing here */
44         LOCAL_USER_REMOVE(u);
45         return res;
46 }
47
48 int unload_module(void)
49 {
50         STANDARD_HANGUP_LOCALUSERS;
51         return ast_unregister_application(app);
52 }
53
54 int load_module(void)
55 {
56         return ast_register_application(app, skel_exec, tdesc, synopsis);
57 }
58
59 char *description(void)
60 {
61         return tdesc;
62 }
63
64 int usecount(void)
65 {
66         int res;
67         STANDARD_USECOUNT(res);
68         return res;
69 }
70
71 char *key()
72 {
73         return ASTERISK_GPL_KEY;
74 }