summaryrefslogtreecommitdiff
path: root/nuttx/examples/uip
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-10-27 18:56:04 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-10-27 18:56:04 +0000
commit1e60556b89305022b6cefe9bb28badb51dc15620 (patch)
treed07c947b44430bff1520bd7ced5fe49e19b26bf3 /nuttx/examples/uip
parenta7e644a852025eeb8af8648f73aac7c9ffc315bd (diff)
downloadpx4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.tar.gz
px4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.tar.bz2
px4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.zip
Fixes found in smtp testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@356 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/uip')
-rw-r--r--nuttx/examples/uip/main.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/nuttx/examples/uip/main.c b/nuttx/examples/uip/main.c
index 3024de873..9cddb0ab9 100644
--- a/nuttx/examples/uip/main.c
+++ b/nuttx/examples/uip/main.c
@@ -45,6 +45,7 @@
#include <sys/ioctl.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <time.h>
@@ -70,11 +71,29 @@
# include <net/uip/resolv.h>
#elif defined(CONFIG_EXAMPLE_UIP_WEBCLIENT)
# include <net/uip/webclient.h>
+#else
+# error "No network application specified"
#endif
-/************************************************************
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined(CONFIG_EXAMPLE_UIP_SMTP)
+static const char g_host_name[] = "localhost";
+static const char g_recipient[] = "spudmonkey@racsa.co.cr";
+static const char g_sender[] = "nuttx-testing@example.com";
+static const char g_subject[] = "Testing SMTP from NuttX";
+static const char g_msg_body[] = "Test message sent by NuttX\r\n";
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
* user_initialize
- ************************************************************/
+ ****************************************************************************/
#ifndef CONFIG_HAVE_WEAKFUNCTIONS
void user_initialize(void)
@@ -85,11 +104,11 @@ void user_initialize(void)
}
#endif
-/************************************************************
+/****************************************************************************
* user_start
- ************************************************************/
+ ****************************************************************************/
- int user_start(int argc, char *argv[])
+int user_start(int argc, char *argv[])
{
struct in_addr addr;
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_ARCH_SIM)
@@ -154,9 +173,9 @@ void user_initialize(void)
handle = smtp_open();
if (handle)
{
- smtp_configure("localhost", addr.s_addr);
- smtp_send("adam@sics.se", NULL, "uip-testing@example.com",
- "Testing SMTP from uIP", "Test message sent by uIP\r\n");
+ smtp_configure(handle, g_host_name, &addr.s_addr);
+ smtp_send(handle, g_recipient, NULL, g_sender, g_subject,
+ g_msg_body, strlen(g_msg_body));
smtp_close(handle);
}
#elif defined(CONFIG_EXAMPLE_UIP_WEBCLIENT)
@@ -180,6 +199,7 @@ void uip_log(char *m)
printf("uIP log message: %s\n", m);
}
+#if defined(CONFIG_EXAMPLE_UIP_WEBCLIENT)
void webclient_closed(void)
{
printf("Webclient: connection closed\n");
@@ -204,3 +224,4 @@ void webclient_datahandler(char *data, uint16 len)
{
printf("Webclient: got %d bytes of data.\n", len);
}
+#endif