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
This commit is contained in:
Michael Jerris 2006-12-01 17:59:58 +00:00
parent 5969fe801b
commit c8b129df56
13 changed files with 2249 additions and 3 deletions

View File

@ -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

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Download ETPAN"
ProjectGUID="{EAE4F6B7-B1E3-4975-8580-481E47A9BEAB}"
RootNamespace="Download ETPAN"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
CommandLine=""
Outputs=""
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\etpan\cleancount"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Downloading ETPAN."
CommandLine="if not exist &quot;$(ProjectDir)..\libetpan-0.46&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/libetpan-0.46.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
Outputs="$(ProjectDir)..\libetpan-0.46"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Downloading ETPAN."
CommandLine="if not exist &quot;$(ProjectDir)..\libetpan-0.46&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://svn.freeswitch.org/downloads/libs/libetpan-0.46.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
Outputs="$(ProjectDir)..\libetpan-0.46"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1 @@
1

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -50,7 +50,6 @@
#include "jsparse.h"
#include "jsscope.h"
#include "jsscript.h"
#include <libteletone.h>
SWITCH_BEGIN_EXTERN_C

View File

@ -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

View File

@ -0,0 +1,390 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* 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 <anthmct@yahoo.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthmct@yahoo.com>
*
*
* mod_spidermonkey_etpan.c -- etpan Javascript Module
*
*/
#include "mod_spidermonkey.h"
#include <libetpan/libetpan.h>
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] <rcpts>...\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:
*/

View File

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_spidermonkey_etpan"
ProjectGUID="{D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}"
RootNamespace="mod_spidermonkey_etpan"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\libetpan-0.46\build-windows\include&quot;;&quot;$(InputDir)..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\include&quot;;&quot;$(InputDir)..\mod_spidermonkey&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;DEBUG;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB;JS_THREADSAFE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="true"
AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mod_spidermonkey_etpan.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\libetpan-0.46\build-windows\include&quot;;&quot;$(InputDir)..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\include&quot;;&quot;$(InputDir)..\mod_spidermonkey&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB;JS_THREADSAFE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="true"
AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
ImportLibrary="$(OutDir)/mod_spidermonkey_etpan.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\mod_spidermonkey_etpan.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -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

View File

@ -0,0 +1,132 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* 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 <anthmct@yahoo.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthmct@yahoo.com>
*
*
* mod_spidermonkey_odbc.c -- ODBC Javascript Module
*
*/
#include "mod_spidermonkey.h"
#include <sql.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4201)
#include <sqlext.h>
#pragma warning(pop)
#else
#include <sqlext.h>
#endif
#include <sqltypes.h>
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:
*/

View File

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_spidermonkey_odbc"
ProjectGUID="{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
RootNamespace="mod_spidermonkey_odbc"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;;&quot;$(InputDir)..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\include&quot;;&quot;$(InputDir)..\mod_spidermonkey&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;DEBUG;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB;JS_THREADSAFE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="true"
AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib odbc32.lib "
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mod_spidermonkey_odbc.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;;&quot;$(InputDir)..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\include&quot;;&quot;$(InputDir)..\mod_spidermonkey&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB;JS_THREADSAFE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="true"
AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib odbc32.lib "
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
ImportLibrary="$(OutDir)/mod_spidermonkey_odbc.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\mod_spidermonkey_odbc.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -30,6 +30,7 @@
*
*/
#include "mod_spidermonkey.h"
#include <libteletone.h>
static const char modname[] = "TeleTone";