1/**
2 * \file
3 * \brief Blocking I/O API for terminal client library.
4 */
5
6/*
7 * Copyright (c) 2012, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, CAB F.78, Universitaetstrasse 6, CH-8092 Zurich,
13 * Attn: Systems Group.
14 */
15
16#ifndef LIBTERM_CLIENT_CLIENT_BLOCKING_H
17#define LIBTERM_CLIENT_CLIENT_BLOCKING_H
18
19#include <barrelfish/caddr.h>
20#include <barrelfish/types.h>
21#include <term/client/defs.h>
22#include <termios.h>
23
24/**
25 * Character that is used by libterm_client to determine end of line.
26 */
27#define TERM_CLIENT_EOL_CHAR '\n'
28
29enum TerminalConfig {
30    TerminalConfig_ECHO, //< Echo yes, no
31    TerminalConfig_ICRNL, //< CR to NL conversion
32    TerminalConfig_CTRLC //< Enable/Disable CTRLC exit handler
33};
34
35errval_t term_client_blocking_init(struct term_client *client,
36                                   struct capref sessionid);
37void term_client_blocking_exit(struct term_client *client);
38
39errval_t term_client_blocking_read(struct term_client *client, char *data,
40                                   size_t length, size_t *read);
41errval_t term_client_blocking_write(struct term_client *client,
42                                    const char *data, size_t length,
43                                    size_t *written);
44errval_t term_client_blocking_config(struct term_client *client,
45                                     enum TerminalConfig opt, size_t arg);
46
47errval_t term_client_blocking_tcgetattr(struct term_client *client,
48                                        struct termios* t);
49errval_t term_client_blocking_tcsetattr(struct term_client *client,
50                                        const struct termios* t);
51
52#endif // LIBTERM_CLIENT_CLIENT_BLOCKING_H
53