summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/pty.h
blob: e9303a1be3433773ca1aaaf50d2cf5f06bcd2a21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
 * @file
 * 
 * @brief /dev/ptyXX  (A first version for pseudo-terminals)
 */

/*
 * Copyright (c) 2001 Fernando Ruiz Casas <fruizcasas@gmail.com>
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef _RTEMS_PTY_H
#define _RTEMS_PTY_H

#ifdef __cplusplus
extern "C" {
#endif	

#include <rtems/termiostypes.h>

#define RTEMS_PTY_SB_MAX 16

typedef struct {
  rtems_termios_device_context  base;
  rtems_termios_tty            *ttyp;
  tcflag_t                      c_cflag;
  int                           socket;
  int                           last_cr;
  unsigned                      iac_mode;
  unsigned char                 sb_buf[RTEMS_PTY_SB_MAX];
  int                           sb_ind;
  int                           width;
  int                           height;
  char                          name[sizeof("/dev/pty18446744073709551615")];
} rtems_pty_context;

const char *rtems_pty_initialize(rtems_pty_context *pty, uintptr_t unique);

static inline const char *rtems_pty_get_path(const rtems_pty_context *pty)
{
  return pty->name;
}

void rtems_pty_close_socket(rtems_pty_context *pty);

void rtems_pty_set_socket(rtems_pty_context *pty, int socket);

#ifdef __cplusplus
}
#endif	

#endif