Mon Mar 31 07:37:55 2008

Asterisk developer's documentation


app_segfault.c

Go to the documentation of this file.
00001 /*
00002  * Segfault application
00003  * 
00004  * An application to provoke a segmentation fault from the dialplan.
00005  * (I know what you are thinking now...., but since Asterisk is too stable...
00006  *  I needed something to test my failover switches.)
00007  *
00008  * Copyright (C) 2005 Junghanns.NET GmbH
00009  * Klaus-Peter Junghanns <kpj@junghanns.net>
00010  *
00011  * This program is free software, distributed under the terms of
00012  * the GNU General Public License. THIS APPLICATION _WILL_ CRASH YOUR
00013  * ASTERISK SERVER SO OF COURSE THERE IS NOT LIABILITY FOR NOTHING!
00014  */
00015 
00016 #include <asterisk.h>
00017 
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <unistd.h>
00021 #include <string.h>
00022 #include <stdlib.h>
00023 
00024 #include <asterisk/lock.h>
00025 #include <asterisk/file.h>
00026 #include <asterisk/logger.h>
00027 #include <asterisk/channel.h>
00028 #include <asterisk/pbx.h>
00029 #include <asterisk/module.h>
00030 
00031 static char *app = "Segfault";
00032 
00033 static char *synopsis = "This application will crash Asterisk with a segmentation fault.";
00034 
00035 static char *descrip = "  Segfault():  Crash with a segfault. Never returns nufin.\n";
00036 
00037 static int segfault_exec(struct ast_channel *chan, void *data)
00038 {
00039    struct ast_module_user *u;
00040    u = ast_module_user_add(chan);
00041    ((char *) 0)[0] = 0;
00042    ast_module_user_remove(u);
00043    return 0;
00044 }
00045 
00046 int unload_module(void)
00047 {
00048    ast_module_user_hangup_all();
00049    return ast_unregister_application(app);
00050 }
00051 
00052 int load_module(void)
00053 {
00054    return ast_register_application(app, segfault_exec, synopsis, descrip);
00055 }
00056 
00057 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Application for crashing Asterisk with a segmentation fault");

Generated on Mon Mar 31 07:37:55 2008 for Asterisk - the Open Source PBX by  doxygen 1.5.1