2006-11-10 21:49:57 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
2012-04-18 11:51:48 -05:00
|
|
|
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
2006-11-10 21:49:57 +00:00
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
2009-02-04 21:20:54 +00:00
|
|
|
* Anthony Minessale II <anthm@freeswitch.org>
|
2006-11-10 21:49:57 +00:00
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
2009-02-04 21:20:54 +00:00
|
|
|
* Anthony Minessale II <anthm@freeswitch.org>
|
2006-11-10 21:49:57 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* mod_spidermonkey_skel.c -- Skel Javascript Module
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "mod_spidermonkey.h"
|
|
|
|
|
|
|
|
static const char modname[] = "Skel";
|
|
|
|
|
|
|
|
/* Skel Object */
|
|
|
|
/*********************************************************************************/
|
2007-03-29 22:31:56 +00:00
|
|
|
static JSBool skel_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
|
|
|
return JS_TRUE;
|
|
|
|
}
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
static void skel_destroy(JSContext * cx, JSObject * obj)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
static JSBool skel_my_method(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
|
|
|
return JS_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum skel_tinyid {
|
|
|
|
SKEL_NAME
|
|
|
|
};
|
|
|
|
|
|
|
|
static JSFunctionSpec skel_methods[] = {
|
|
|
|
{"myMethod", skel_my_method, 1},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static JSPropertySpec skel_props[] = {
|
2007-03-29 22:31:56 +00:00
|
|
|
{"name", SKEL_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
|
2006-11-10 21:49:57 +00:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
static JSBool skel_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
|
|
|
JSBool res = JS_TRUE;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSClass skel_class = {
|
2007-03-29 22:31:56 +00:00
|
|
|
modname, JSCLASS_HAS_PRIVATE,
|
2007-06-15 17:05:20 +00:00
|
|
|
JS_PropertyStub, JS_PropertyStub, skel_getProperty, DEFAULT_SET_PROPERTY,
|
2007-03-29 22:31:56 +00:00
|
|
|
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, skel_destroy, NULL, NULL, NULL,
|
2006-11-10 21:49:57 +00:00
|
|
|
skel_construct
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
switch_status_t spidermonkey_load(JSContext * cx, JSObject * obj)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
2007-03-29 22:31:56 +00:00
|
|
|
JS_InitClass(cx, obj, NULL, &skel_class, skel_construct, 3, skel_props, skel_methods, skel_props, skel_methods);
|
2006-11-10 21:49:57 +00:00
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const sm_module_interface_t skel_module_interface = {
|
|
|
|
/*.name = */ modname,
|
2007-03-29 22:31:56 +00:00
|
|
|
/*.spidermonkey_load */ spidermonkey_load,
|
|
|
|
/*.next */ NULL
|
2006-11-10 21:49:57 +00:00
|
|
|
};
|
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
|
2006-11-10 21:49:57 +00:00
|
|
|
{
|
|
|
|
*module_interface = &skel_module_interface;
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
}
|
2006-11-27 22:30:48 +00:00
|
|
|
|
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
2008-02-03 22:14:57 +00:00
|
|
|
* indent-tabs-mode:t
|
2006-11-27 22:30:48 +00:00
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
2009-09-14 22:03:37 +00:00
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
2006-11-27 22:30:48 +00:00
|
|
|
*/
|