From c8b129df56428e07fd77e1bf5075144c0ec72f8c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 1 Dec 2006 17:59:58 +0000 Subject: [PATCH] initial stubs for odbc and libetpan modules for spidermonkey. These do not do anything yet. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3507 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- Freeswitch.sln | 44 + libs/win32/Download ETPAN.vcproj | 97 ++ libs/win32/etpan/cleancount | 1 + libs/win32/etpan/libetpan.vcproj | 1109 +++++++++++++++++ src/mod/languages/mod_spidermonkey/Makefile | 3 +- .../mod_spidermonkey/mod_spidermonkey.h | 1 - .../languages/mod_spidermonkey_etpan/Makefile | 20 + .../mod_spidermonkey_etpan.c | 390 ++++++ .../mod_spidermonkey_etpan.vcproj | 217 ++++ .../languages/mod_spidermonkey_odbc/Makefile | 20 + .../mod_spidermonkey_odbc.c | 132 ++ .../mod_spidermonkey_odbc.vcproj | 217 ++++ .../mod_spidermonkey_teletone.c | 1 + 13 files changed, 2249 insertions(+), 3 deletions(-) create mode 100644 libs/win32/Download ETPAN.vcproj create mode 100644 libs/win32/etpan/cleancount create mode 100644 libs/win32/etpan/libetpan.vcproj create mode 100644 src/mod/languages/mod_spidermonkey_etpan/Makefile create mode 100644 src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c create mode 100644 src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.vcproj create mode 100644 src/mod/languages/mod_spidermonkey_odbc/Makefile create mode 100644 src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c create mode 100644 src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.vcproj diff --git a/Freeswitch.sln b/Freeswitch.sln index 9325bc5c27..4202ad398b 100644 --- a/Freeswitch.sln +++ b/Freeswitch.sln @@ -579,6 +579,30 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applica {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_etpan", "src\mod\languages\mod_spidermonkey_etpan\mod_spidermonkey_etpan.vcproj", "{D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}" + ProjectSection(ProjectDependencies) = postProject + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}" + ProjectSection(ProjectDependencies) = postProject + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} + {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download ETPAN", "libs\win32\Download ETPAN.vcproj", "{EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libetpan", "libs\win32\etpan\libetpan.vcproj", "{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}" + ProjectSection(ProjectDependencies) = postProject + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB} = {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -949,6 +973,22 @@ Global {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 + {D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}.Debug|Win32.ActiveCfg = Debug|Win32 + {D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}.Debug|Win32.Build.0 = Debug|Win32 + {D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}.Release|Win32.ActiveCfg = Release|Win32 + {D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}.Release|Win32.Build.0 = Release|Win32 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32 + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}.Debug|Win32.ActiveCfg = Debug|Win32 + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}.Debug|Win32.Build.0 = Debug|Win32 + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}.Release|Win32.ActiveCfg = Release|Win32 + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}.Release|Win32.Build.0 = Release|Win32 + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}.Debug|Win32.Build.0 = Debug|Win32 + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}.Release|Win32.ActiveCfg = Release|Win32 + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1021,11 +1061,14 @@ Global {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} {B0C6CFF9-7DCD-4A21-8BA4-C2011E18DED8} = {0C808854-54D1-4230-BFF5-77B5FD905000} {7B077E7F-1BE7-4291-AB86-55E527B25CAC} = {0C808854-54D1-4230-BFF5-77B5FD905000} {ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000} {8F992C49-6C51-412F-B2A3-34EAB708EB65} = {0C808854-54D1-4230-BFF5-77B5FD905000} + {D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9} = {0C808854-54D1-4230-BFF5-77B5FD905000} + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF} = {0C808854-54D1-4230-BFF5-77B5FD905000} {692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0} {1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A} {CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5} @@ -1044,5 +1087,6 @@ Global {B0AA13FC-636C-45A7-8EAE-663220679A75} = {C120A020-773F-4EA3-923F-B67AF28B750D} {8B2CE7D1-77EF-45ED-927D-82147805440B} = {C120A020-773F-4EA3-923F-B67AF28B750D} {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {EAE4F6B7-B1E3-4975-8580-481E47A9BEAB} = {C120A020-773F-4EA3-923F-B67AF28B750D} EndGlobalSection EndGlobal diff --git a/libs/win32/Download ETPAN.vcproj b/libs/win32/Download ETPAN.vcproj new file mode 100644 index 0000000000..33382b328a --- /dev/null +++ b/libs/win32/Download ETPAN.vcproj @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/win32/etpan/cleancount b/libs/win32/etpan/cleancount new file mode 100644 index 0000000000..56a6051ca2 --- /dev/null +++ b/libs/win32/etpan/cleancount @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/libs/win32/etpan/libetpan.vcproj b/libs/win32/etpan/libetpan.vcproj new file mode 100644 index 0000000000..5edea84db0 --- /dev/null +++ b/libs/win32/etpan/libetpan.vcproj @@ -0,0 +1,1109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/languages/mod_spidermonkey/Makefile b/src/mod/languages/mod_spidermonkey/Makefile index 1f52f712a6..cfbc9afcad 100644 --- a/src/mod/languages/mod_spidermonkey/Makefile +++ b/src/mod/languages/mod_spidermonkey/Makefile @@ -1,5 +1,5 @@ include sm.mak -OBJS=$(BASE)/libs/mozilla/js/src/$(OS_CONFIG)_$(VER).OBJ/libjs.a $(BASE)/libs/mozilla/nsprpub/dist/lib/libnspr4.a -lcurl -letpan +OBJS=$(BASE)/libs/mozilla/js/src/$(OS_CONFIG)_$(VER).OBJ/libjs.a $(BASE)/libs/mozilla/nsprpub/dist/lib/libnspr4.a -lcurl LINKER=$(CC) @@ -8,7 +8,6 @@ all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) depends: BUILD_OPT=$(BO) MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) mozilla.tar.gz --prefix=$(PREFIX) MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install curl-7.15.2.tar.gz --prefix=$(PREFIX) --without-libidn - MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install libetpan-0.45.tar.gz --prefix=$(PREFIX) $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h index b07ac1bdd1..846853a6c9 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h @@ -50,7 +50,6 @@ #include "jsparse.h" #include "jsscope.h" #include "jsscript.h" -#include SWITCH_BEGIN_EXTERN_C diff --git a/src/mod/languages/mod_spidermonkey_etpan/Makefile b/src/mod/languages/mod_spidermonkey_etpan/Makefile new file mode 100644 index 0000000000..aa76344851 --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_etpan/Makefile @@ -0,0 +1,20 @@ +include ../mod_spidermonkey/sm.mak + +OBJS=#$(BASE)/libs/mozilla/js/src/$(OS_CONFIG)_$(VER).OBJ/libjs.a $(BASE)/libs/mozilla/nsprpub/dist/lib/libnspr4.a -letpan +LINKER=$(CC) + + +all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) + +depends: + MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install libetpan-0.46.tar.gz --prefix=$(PREFIX) + +$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c + $(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o + $(LINKER) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS) + +clean: + rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ + +install: + cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod diff --git a/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c new file mode 100644 index 0000000000..b3113eaf1d --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c @@ -0,0 +1,390 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * 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 + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II + * + * + * mod_spidermonkey_etpan.c -- etpan Javascript Module + * + */ +#include "mod_spidermonkey.h" +#include + +static const char modname[] = "etpan"; + +/* etpan Object */ +/*********************************************************************************/ +static JSBool etpan_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + return JS_TRUE; +} + +static void etpan_destroy(JSContext *cx, JSObject *obj) +{ +} + +static JSBool etpan_my_method(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + return JS_FALSE; +} + +enum etpan_tinyid { + etpan_NAME +}; + +static JSFunctionSpec etpan_methods[] = { + {"myMethod", etpan_my_method, 1}, + {0} +}; + + +static JSPropertySpec etpan_props[] = { + {"name", etpan_NAME, JSPROP_READONLY|JSPROP_PERMANENT}, + {0} +}; + + +static JSBool etpan_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) +{ + JSBool res = JS_TRUE; + + return res; +} + +JSClass etpan_class = { + modname, JSCLASS_HAS_PRIVATE, + JS_PropertyStub, JS_PropertyStub, etpan_getProperty, JS_PropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, etpan_destroy, NULL, NULL, NULL, + etpan_construct +}; + + +switch_status_t spidermonkey_load(JSContext *cx, JSObject *obj) +{ + JS_InitClass(cx, + obj, + NULL, + &etpan_class, + etpan_construct, + 3, + etpan_props, + etpan_methods, + etpan_props, + etpan_methods + ); + return SWITCH_STATUS_SUCCESS; +} + + +const sm_module_interface_t etpan_module_interface = { + /*.name = */ modname, + /*.spidermonkey_load*/ spidermonkey_load, + /*.next*/ NULL +}; + +SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface) +{ + *module_interface = &etpan_module_interface; + return SWITCH_STATUS_SUCCESS; +} + +/* sample code from smtp send example*/ +#if 0 +/* globals */ +char *smtp_server; +uint16_t smtp_port = 25; +char *smtp_user; +char *smtp_password; +char *smtp_from; +int smtp_tls = 0; +int smtp_esmtp = 1; + +struct mem_message { + char *data; + size_t len; + MMAPString *mstring; +}; + +#define BLOCKSIZE 4096 + +int collect(struct mem_message *message) { + struct stat sb; + int len; + + memset(message, 0, sizeof(struct mem_message)); + +#ifndef MMAP_UNAVAILABLE + /* if stdin is a file whose size is known, try to mmap it */ + if (!fstat(0, &sb) && S_ISREG(sb.st_mode) && sb.st_size >= 0) { + message->len = sb.st_size; + if ((message->data = mmap(NULL, message->len, PROT_READ, MAP_SHARED, + STDIN_FILENO, 0)) != MAP_FAILED) + return 0; + } +#endif + + /* read the buffer from stdin by blocks, until EOF or error. + save the message in a mmap_string */ + if ((message->mstring = mmap_string_sized_new(BLOCKSIZE)) == NULL) { + perror("mmap_string_new"); + goto error; + } + message->len = 0; + + while ((len = read(STDIN_FILENO, + message->mstring->str + message->len, BLOCKSIZE)) > 0) { + message->len += len; + /* reserve room for next block */ + if ((mmap_string_set_size(message->mstring, + message->len + BLOCKSIZE)) == NULL) { + perror("mmap_string_set_size"); + goto error; + } + } + + if (len == 0) { + message->data = message->mstring->str; + return 0; /* OK */ + } + + perror("read"); + + error: + if (message->mstring != NULL) + mmap_string_free(message->mstring); + return -1; +} + +char *guessfrom() { +#ifndef _MSC_VER + uid_t uid; + struct passwd *pw; + char hostname[256]; + int len; + char *gfrom; + + if (gethostname(hostname, sizeof(hostname))) { + perror("gethostname"); + return NULL; + } + hostname[sizeof(hostname) - 1] = '\0'; + + uid = getuid(); + pw = getpwuid(uid); + + len = ((pw != NULL) ? strlen(pw->pw_name) : 12) + + strlen(hostname) + 2; + + if ((gfrom = malloc(len)) == NULL) { + perror("malloc"); + return NULL; + } + if (pw != NULL && pw->pw_name != NULL) + snprintf(gfrom, len, "%s@%s", pw->pw_name, hostname); + else + snprintf(gfrom, len, "#%u@%s", uid, hostname); + return gfrom; +#else + return NULL; +#endif +} + +void release(struct mem_message *message) { + if (message->mstring != NULL) + mmap_string_free(message->mstring); +#ifndef MMAP_UNAVAILABLE + else if (message->data != NULL) + munmap(message->data, message->len); +#endif +} + +int send_message(char *data, size_t len, char**rcpts) { + int s = -1; + int ret; + char **r; + int esmtp = 0; + mailsmtp *smtp = NULL; + + if ((smtp = mailsmtp_new(0, NULL)) == NULL) { + perror("mailsmtp_new"); + goto error; + } + + /* first open the stream */ + if ((ret = mailsmtp_socket_connect(smtp, + (smtp_server != NULL ? smtp_server : "localhost"), + smtp_port)) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_socket_connect: %s\n", mailsmtp_strerror(ret)); + goto error; + } + + /* then introduce ourselves */ + if (smtp_esmtp && (ret = mailesmtp_ehlo(smtp)) == MAILSMTP_NO_ERROR) + esmtp = 1; + else if (!smtp_esmtp || ret == MAILSMTP_ERROR_NOT_IMPLEMENTED) + ret = mailsmtp_helo(smtp); + if (ret != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_helo: %s\n", mailsmtp_strerror(ret)); + goto error; + } + + if (esmtp && smtp_tls && + (ret = mailsmtp_socket_starttls(smtp)) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_starttls: %s\n", mailsmtp_strerror(ret)); + goto error; + } + + if (esmtp && smtp_user != NULL && + (ret = mailsmtp_auth(smtp, smtp_user, + (smtp_password != NULL) ? smtp_password : "")) + != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_auth: %s: %s\n", smtp_user, mailsmtp_strerror(ret)); + goto error; + } + + /* source */ + if ((ret = (esmtp ? + mailesmtp_mail(smtp, smtp_from, 1, "etPanSMTPTest") : + mailsmtp_mail(smtp, smtp_from))) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_mail: %s, %s\n", smtp_from, mailsmtp_strerror(ret)); + goto error; + } + + /* recipients */ + for (r = rcpts; *r != NULL; r++) { + if ((ret = (esmtp ? + mailesmtp_rcpt(smtp, *r, + MAILSMTP_DSN_NOTIFY_FAILURE|MAILSMTP_DSN_NOTIFY_DELAY, + NULL) : + mailsmtp_rcpt(smtp, *r))) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_rcpt: %s: %s\n", *r, mailsmtp_strerror(ret)); + goto error; + } + } + + /* message */ + if ((ret = mailsmtp_data(smtp)) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_data: %s\n", mailsmtp_strerror(ret)); + goto error; + } + if ((ret = mailsmtp_data_message(smtp, data, len)) != MAILSMTP_NO_ERROR) { + fprintf(stderr, "mailsmtp_data_message: %s\n", mailsmtp_strerror(ret)); + goto error; + } + mailsmtp_free(smtp); + return 0; + + error: + if (smtp != NULL) + mailsmtp_free(smtp); + if (s >= 0) + close(s); + return -1; +} + +int main(int argc, char **argv) { + struct mem_message message; + int index, r; + + static struct option long_options[] = { + {"server", 1, 0, 's'}, + {"port", 1, 0, 'p'}, + {"user", 1, 0, 'u'}, + {"password", 1, 0, 'v'}, + {"from", 1, 0, 'f'}, + {"tls", 0, 0, 'S'}, + {"no-esmtp", 0, 0, 'E'}, + }; + + while(1) { + if ((r = getopt_long(argc, argv, "s:p:u:v:f:SE", long_options, &index)) < 0) + break; + switch (r) { + case 's': + if (smtp_server != NULL) + free(smtp_server); + smtp_server = strdup(optarg); + break; + case 'p': + smtp_port = (uint16_t) strtoul(optarg, NULL, 10); + break; + case 'u': + if (smtp_user != NULL) + free(smtp_user); + smtp_user = strdup(optarg); + break; + case 'v': + if (smtp_password != NULL) + free(smtp_password); + smtp_password = strdup(optarg); + break; + case 'f': + if (smtp_from != NULL) + free(smtp_from); + smtp_from = strdup(optarg); + break; + case 'S': + smtp_tls = 1; + break; + case 'E': + smtp_esmtp = 0; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc < 1) { + fprintf(stderr, "usage: smtpsend [-f from] [-u user] [-v password] [-s server] [-p port] [-S] ...\n"); + return EXIT_FAILURE; + } + + if (smtp_from == NULL && (smtp_from = guessfrom()) == NULL) { + fprintf(stderr, "can't guess a valid from, please use -f option.\n"); + return EXIT_FAILURE; + } + + /* reads message from stdin */ + if (collect(&message)) + return EXIT_FAILURE; + + send_message(message.data, message.len, argv); + + release(&message); + return EXIT_SUCCESS; +} + +#endif +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:nil + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.vcproj b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.vcproj new file mode 100644 index 0000000000..41078196d5 --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.vcproj @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/languages/mod_spidermonkey_odbc/Makefile b/src/mod/languages/mod_spidermonkey_odbc/Makefile new file mode 100644 index 0000000000..c22d59d32f --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_odbc/Makefile @@ -0,0 +1,20 @@ +include ../mod_spidermonkey/sm.mak + +OBJS=#$(BASE)/libs/mozilla/js/src/$(OS_CONFIG)_$(VER).OBJ/libjs.a $(BASE)/libs/mozilla/nsprpub/dist/lib/libnspr4.a -lunixodbc +LINKER=$(CC) + + +all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) + +depends: + MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install unixODBC-2.2.12.tar.gz --prefix=$(PREFIX) + +$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c + $(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o + $(LINKER) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS) + +clean: + rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ + +install: + cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod diff --git a/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c new file mode 100644 index 0000000000..27dcca54fd --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c @@ -0,0 +1,132 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005/2006, Anthony Minessale II + * + * 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 + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II + * + * + * mod_spidermonkey_odbc.c -- ODBC Javascript Module + * + */ +#include "mod_spidermonkey.h" + +#include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4201) +#include +#pragma warning(pop) +#else +#include +#endif +#include + +static const char modname[] = "odbc"; + +/* ODBC Object */ +/*********************************************************************************/ +static JSBool odbc_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + return JS_TRUE; +} + +static void odbc_destroy(JSContext *cx, JSObject *obj) +{ +} + +static JSBool odbc_my_method(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + return JS_FALSE; +} + +enum odbc_tinyid { + odbc_NAME +}; + +static JSFunctionSpec odbc_methods[] = { + {"myMethod", odbc_my_method, 1}, + {0} +}; + + +static JSPropertySpec odbc_props[] = { + {"name", odbc_NAME, JSPROP_READONLY|JSPROP_PERMANENT}, + {0} +}; + + +static JSBool odbc_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) +{ + JSBool res = JS_TRUE; + + return res; +} + +JSClass odbc_class = { + modname, JSCLASS_HAS_PRIVATE, + JS_PropertyStub, JS_PropertyStub, odbc_getProperty, JS_PropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, odbc_destroy, NULL, NULL, NULL, + odbc_construct +}; + + +switch_status_t spidermonkey_load(JSContext *cx, JSObject *obj) +{ + JS_InitClass(cx, + obj, + NULL, + &odbc_class, + odbc_construct, + 3, + odbc_props, + odbc_methods, + odbc_props, + odbc_methods + ); + return SWITCH_STATUS_SUCCESS; +} + + +const sm_module_interface_t odbc_module_interface = { + /*.name = */ modname, + /*.spidermonkey_load*/ spidermonkey_load, + /*.next*/ NULL +}; + +SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface) +{ + *module_interface = &odbc_module_interface; + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:nil + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.vcproj b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.vcproj new file mode 100644 index 0000000000..3f42918513 --- /dev/null +++ b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.vcproj @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c index ea339128df..264a0f547b 100644 --- a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c +++ b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c @@ -30,6 +30,7 @@ * */ #include "mod_spidermonkey.h" +#include static const char modname[] = "TeleTone";