summaryrefslogtreecommitdiffstats
path: root/c/src/tests/samples/pppd/pppdapp.c
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2003-11-11 00:57:23 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2003-11-11 00:57:23 +0000
commit532f51ce426bc247b7054ffc64f006f7397d6268 (patch)
tree672371d581f9567794f08d2eb5e315c3590647e8 /c/src/tests/samples/pppd/pppdapp.c
parent2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff)
downloadrtems-532f51ce426bc247b7054ffc64f006f7397d6268.tar.bz2
2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* base_mp/node1/.cvsignore: Remove. * base_mp/node1/Makefile.am: Remove. * base_mp/node1/base_mp.doc: Remove. * base_mp/node1/base_mp.scn: Remove. * base_mp/.cvsignore: Remove. * base_mp/Makefile.am: Remove. * base_mp/apptask.c: Remove. * base_mp/init.c: Remove. * base_mp/system.h: Remove. * base_mp/node2/.cvsignore: Remove. * base_mp/node2/Makefile.am: Remove. * base_mp/node2/base_mp.doc: Remove. * base_mp/node2/base_mp.scn: Remove. * .cvsignore: Remove. * ChangeLog: Remove. * Makefile.am: Remove. * README: Remove. * configure.ac: Remove. * sample.am: Remove. * base_sp/.cvsignore: Remove. * base_sp/Makefile.am: Remove. * base_sp/apptask.c: Remove. * base_sp/base_sp.doc: Remove. * base_sp/base_sp.scn: Remove. * base_sp/init.c: Remove. * base_sp/system.h: Remove. * cdtest/.cvsignore: Remove. * cdtest/Makefile.am: Remove. * cdtest/cdtest.scn: Remove. * cdtest/init.c: Remove. * cdtest/main.cc: Remove. * cdtest/system.h: Remove. * fileio/.cvsignore: Remove. * fileio/Makefile.am: Remove. * fileio/fileio.doc: Remove. * fileio/init.c: Remove. * fileio/system.h: Remove. * hello/.cvsignore: Remove. * hello/Makefile.am: Remove. * hello/hello.doc: Remove. * hello/hello.scn: Remove. * hello/init.c: Remove. * hello/system.h: Remove. * loopback/.cvsignore: Remove. * loopback/Makefile.am: Remove. * loopback/README: Remove. * loopback/init.c: Remove. * loopback/loopback.scn: Remove. * minimum/.cvsignore: Remove. * minimum/Makefile.am: Remove. * minimum/init.c: Remove. * minimum/minimum.doc: Remove. * minimum/minimum.scn: Remove. * paranoia/.cvsignore: Remove. * paranoia/Makefile.am: Remove. * paranoia/init.c: Remove. * paranoia/paranoia.c: Remove. * paranoia/paranoia.doc: Remove. * paranoia/system.h: Remove. * pppd/.cvsignore: Remove. * pppd/Makefile-user: Remove. * pppd/Makefile.am: Remove. * pppd/README: Remove. * pppd/init.c: Remove. * pppd/netconfig.h: Remove. * pppd/ppp.conf: Remove. * pppd/pppd.options: Remove. * pppd/pppdapp.c: Remove. * pppd/system.h: Remove. * ticker/.cvsignore: Remove. * ticker/Makefile.am: Remove. * ticker/init.c: Remove. * ticker/system.h: Remove. * ticker/tasks.c: Remove. * ticker/ticker.doc: Remove. * ticker/ticker.scn: Remove. * unlimited/.cvsignore: Remove. * unlimited/Makefile.am: Remove. * unlimited/init.c: Remove. * unlimited/system.h: Remove. * unlimited/test1.c: Remove. * unlimited/test2.c: Remove. * unlimited/test3.c: Remove. * unlimited/unlimited.doc: Remove. * unlimited/unlimited.scn: Remove.
Diffstat (limited to 'c/src/tests/samples/pppd/pppdapp.c')
-rw-r--r--c/src/tests/samples/pppd/pppdapp.c146
1 files changed, 0 insertions, 146 deletions
diff --git a/c/src/tests/samples/pppd/pppdapp.c b/c/src/tests/samples/pppd/pppdapp.c
deleted file mode 100644
index 59e5029088..0000000000
--- a/c/src/tests/samples/pppd/pppdapp.c
+++ /dev/null
@@ -1,146 +0,0 @@
-
-#include <stdio.h>
-#include <rtemspppd.h>
-#include "system.h"
-
-
-/* define global variables */
-static unsigned int pppdapp_linkcount = 0;
-static rtems_id pppdapp_taskid;
-
-
-static void pppdapp_linkup_hook(void)
-{
- pppdapp_linkcount++;
- printf("PPP LINK UP [%d]\n", pppdapp_linkcount);
-}
-
-static void pppdapp_linkdown_hook(void)
-{
- printf("PPP LINK DOWN [%d]\n", pppdapp_linkcount);
-}
-
-static void pppdapp_ipup_hook(void)
-{
- /* send ipup signal to pppdapp task */
- rtems_event_send(pppdapp_taskid, RTEMS_EVENT_10);
-}
-
-static void pppdapp_ipdown_hook(void)
-{
- /* send ip down signal to pppdapp task */
- rtems_event_send(pppdapp_taskid, RTEMS_EVENT_11);
-}
-
-static void pppdapp_setup(void)
-{
- const char *pUser = "oscar";
- const char *pPassword = "goldman";
-
-#undef USE_MODEM
-#ifdef USE_MODEM
- const char *pTelephone = "5551234";
- const char *pInitScript = "TIMEOUT@5@@AT@@OK@";
- const char *pConnectScript = "TIMEOUT@90@@ATDT%s@CONNECT@@name:@%s@word:@%s@";
- const char *pDisconnectScript = "TIMEOUT@5@@ATH0@@OK@";
- char pConnect[128];
-
- /* set the connect string */
- sprintf(pConnect, pConnectScript, pTelephone, pUser, pPassword);
-
- /* set pppd options for modem */
- rtems_pppd_set_option("/dev/ttyS2", NULL);
- rtems_pppd_set_option("57600", NULL);
- rtems_pppd_set_option("crtscts", NULL);
- rtems_pppd_set_option("modem", NULL);
- rtems_pppd_set_option("noauth", NULL);
- rtems_pppd_set_option("debug", NULL);
- rtems_pppd_set_option("init", pInitScript);
- rtems_pppd_set_option("connect", pConnect);
- rtems_pppd_set_option("disconnect", pDisconnectScript);
-#else
- /* set pppd options for null modem direct link serial cable */
- rtems_pppd_set_option("/dev/ttyS1", NULL);
- rtems_pppd_set_option("57600", NULL);
- rtems_pppd_set_option("crtscts", NULL);
- rtems_pppd_set_option("local", NULL);
- rtems_pppd_set_option("noauth", NULL);
- rtems_pppd_set_option("debug", NULL);
- rtems_pppd_set_option("user", pUser);
- rtems_pppd_set_option("password", pPassword);
-#endif
-
- /* set up pppd hooks */
- rtems_pppd_set_hook(RTEMS_PPPD_LINKUP_HOOK, pppdapp_linkup_hook);
- rtems_pppd_set_hook(RTEMS_PPPD_LINKDOWN_HOOK, pppdapp_linkdown_hook);
- rtems_pppd_set_hook(RTEMS_PPPD_IPUP_HOOK, pppdapp_ipup_hook);
- rtems_pppd_set_hook(RTEMS_PPPD_IPDOWN_HOOK, pppdapp_ipdown_hook);
-}
-
-static rtems_task pppdapp(rtems_task_argument arg)
-{
- rtems_status_code sc = RTEMS_SUCCESSFUL;
- rtems_interval tickspersecond = 0;
- rtems_option options;
- rtems_event_set in;
- rtems_event_set out;
-
- /* initialize ticks per second */
- rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &tickspersecond);
- if ( tickspersecond == 0 ) {
- /* ensure value is greater than zero */
- tickspersecond = 100;
- }
-
- /* initiate connection */
- pppdapp_setup();
- rtems_pppd_connect();
-
- /* enter processing loop */
- in = (RTEMS_EVENT_10 | RTEMS_EVENT_11);
- options = (RTEMS_EVENT_ANY | RTEMS_WAIT);
- while ( sc == RTEMS_SUCCESSFUL ) {
- /* wait for the next event */
- sc = rtems_event_receive(in, options, RTEMS_NO_TIMEOUT, &out);
- if ( sc == RTEMS_SUCCESSFUL ) {
- /* determine which event was sent */
- if ( out & RTEMS_EVENT_10 ) {
- /* ip up recived */
- /* call disconnect function */
- rtems_pppd_disconnect();
- }
- if ( out & RTEMS_EVENT_11 ) {
- /* ip down recived */
- /* sleep 10 seconds and call connect function */
- rtems_task_wake_after(10*tickspersecond);
- rtems_pppd_connect();
- }
- }
- }
-
- /* terminate myself */
- rtems_task_delete(RTEMS_SELF);
-}
-
-int pppdapp_initialize(void)
-{
- int iReturn = (int)-1;
- rtems_status_code status;
- rtems_name taskName;
-
- taskName = rtems_build_name( 'p', 'a', 'p', 'p' );
- status = rtems_task_create(taskName,
- CONFIGURE_INIT_TASK_PRIORITY,
- CONFIGURE_INIT_TASK_STACK_SIZE,
- CONFIGURE_INIT_TASK_INITIAL_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &pppdapp_taskid);
- if ( status == RTEMS_SUCCESSFUL ) {
- status = rtems_task_start(pppdapp_taskid, pppdapp, 0);
- if ( status == RTEMS_SUCCESSFUL ) {
- iReturn = (int)0;
- }
- }
-
- return ( iReturn );
-}