Changeset ebb1489 in mainline for uspace/srv/hid/remcons/user.h


Ignore:
Timestamp:
2024-10-13T08:23:40Z (8 weeks ago)
Author:
GitHub <noreply@…>
Children:
0472cf17
Parents:
2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
git-committer:
GitHub <noreply@…> (2024-10-13 08:23:40)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/remcons/user.h

    r2a0c827c rebb1489  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2012 Vojtech Horky
    34 * All rights reserved.
     
    3637#define TELNET_USER_H_
    3738
    38 #include <adt/prodcons.h>
    3939#include <fibril_synch.h>
    4040#include <inet/tcp.h>
    4141#include <inttypes.h>
    4242#include <io/con_srv.h>
    43 #include "remcons.h"
    4443
    4544#define BUFFER_SIZE 32
     45#define SEND_BUF_SIZE 512
     46
     47/** Telnet callbacks */
     48typedef struct {
     49        void (*ws_update)(void *, unsigned, unsigned);
     50} telnet_cb_t;
    4651
    4752/** Representation of a connected (human) user. */
    4853typedef struct {
    49         /** Mutex guarding the whole structure. */
    50         fibril_mutex_t guard;
     54        /** Synchronize send operations */
     55        fibril_mutex_t send_lock;
     56        /** Synchronize receive operations */
     57        fibril_mutex_t recv_lock;
     58        /** Callback functions */
     59        telnet_cb_t *cb;
     60        /** Argument to callback functions */
     61        void *arg;
    5162
    5263        /** Internal id, used for creating locfs entries. */
     
    6172        con_srvs_t srvs;
    6273
    63         /** Producer-consumer of kbd_event_t. */
    64         prodcons_t in_events;
    6574        link_t link;
    6675        char socket_buffer[BUFFER_SIZE];
    6776        size_t socket_buffer_len;
    6877        size_t socket_buffer_pos;
     78        char send_buf[SEND_BUF_SIZE];
     79        size_t send_buf_used;
    6980
    7081        /** Task id of the launched application. */
     
    7990        /** X position of the cursor. */
    8091        int cursor_x;
     92        /** Y position of the cursor. */
     93        int cursor_y;
     94        /** Total number of columns */
     95        unsigned cols;
     96        /** Total number of rows */
     97        unsigned rows;
    8198} telnet_user_t;
    8299
    83 extern telnet_user_t *telnet_user_create(tcp_conn_t *);
     100extern telnet_user_t *telnet_user_create(tcp_conn_t *, telnet_cb_t *, void *);
    84101extern void telnet_user_add(telnet_user_t *);
    85102extern void telnet_user_destroy(telnet_user_t *);
     
    88105extern void telnet_user_notify_client_disconnected(telnet_user_t *);
    89106extern errno_t telnet_user_get_next_keyboard_event(telnet_user_t *, kbd_event_t *);
    90 extern errno_t telnet_user_send_data(telnet_user_t *, uint8_t *, size_t);
     107extern errno_t telnet_user_send_data(telnet_user_t *, const char *, size_t);
     108extern errno_t telnet_user_send_raw(telnet_user_t *, const char *, size_t);
     109extern errno_t telnet_user_flush(telnet_user_t *);
     110extern errno_t telnet_user_recv(telnet_user_t *, void *, size_t, size_t *);
    91111extern void telnet_user_update_cursor_x(telnet_user_t *, int);
     112extern void telnet_user_resize(telnet_user_t *, unsigned, unsigned);
    92113
    93114/** Print informational message about connected user. */
Note: See TracChangeset for help on using the changeset viewer.