source: rtems/testsuites/libtests/termios06/test_pppd.c @ 4c86e3d

4.115
Last change on this file since 4c86e3d was 4c86e3d, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/12 at 17:20:47

libtmtests - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include <termios.h>
16#include <rtems/termiostypes.h>
17#include <rtems/dumpbuf.h>
18
19/* forward declarations to avoid warnings */
20void ppp_test_driver_set_rx(const char *expected, size_t len);
21void pppasyncattach(void);
22int  pppopen(struct rtems_termios_tty *tty);
23int  pppclose(struct rtems_termios_tty *tty);
24int  pppread(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args);
25int  pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args);
26int  pppioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args);
27int  pppinput(int c, struct rtems_termios_tty *tty);
28int  pppstart(struct rtems_termios_tty *tp);
29
30/*
31 * Define the PPP line discipline.
32 */
33
34static struct rtems_termios_linesw pppdisc = {
35  pppopen, pppclose, pppread, pppwrite,
36  pppinput, pppstart, pppioctl, NULL
37};
38
39const char *RXExpected;
40size_t      RXLength;
41
42void ppp_test_driver_set_rx( const char *expected, size_t len )
43{
44  RXExpected = expected;
45  RXLength   = len;
46}
47
48void pppasyncattach(void)
49{
50  rtems_termios_linesw[PPPDISC] = pppdisc;
51}
52
53int  pppopen(struct rtems_termios_tty *tty)
54{
55  puts( "pppopen called" );
56  return 0;
57}
58
59int  pppclose(struct rtems_termios_tty *tty)
60{
61  puts( "pppclose called" );
62  return 0;
63}
64
65int  pppread(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
66{
67  puts( "pppread called" );
68 
69  rtems_termios_enqueue_raw_characters( tty, (char *)RXExpected, RXLength );
70 
71  RXExpected = NULL;
72  RXLength = 0;
73  return 0;
74}
75
76int  pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
77{
78  int                           maximum    = rw_args->count;
79  char                         *out_buffer = rw_args->buffer;
80
81  printf( "pppwrite called - %d bytes\n", maximum );
82  rtems_print_buffer( (unsigned char *) out_buffer, maximum );
83  rw_args->bytes_moved = maximum;
84  rtems_termios_dequeue_characters( tty, 1 );
85  return 0;
86}
87
88int  pppioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
89{
90  puts( "pppioctl called" );
91  return 0;
92}
93
94int  pppinput(int c, struct rtems_termios_tty *tty)
95{
96  printf( "pppinput called - with (%c)\n", c );
97  return 0;
98}
99
100int  pppstart(struct rtems_termios_tty *tp)
101{
102  puts( "pppstart called" );
103  return 0;
104}
105
106
Note: See TracBrowser for help on using the repository browser.