Changeset 5923cf82 in mainline
- Timestamp:
- 2012-01-12T08:47:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 261bbdc
- Parents:
- d545d03
- Location:
- uspace/srv/hid/remcons
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/remcons/remcons.c
rd545d03 r5923cf82 74 74 sizeof(telnet_force_character_mode_command) / sizeof(telnet_cmd_t); 75 75 76 76 /** Creates new keyboard event from given char. 77 * 78 * @param type Event type (press / release). 79 * @param c Pressed character. 80 */ 77 81 static kbd_event_t* new_kbd_event(kbd_event_type_t type, wchar_t c) { 78 82 kbd_event_t *event = malloc(sizeof(kbd_event_t)); … … 88 92 } 89 93 94 /** Handling client requests (VFS and console interface). 95 * 96 * @param user Telnet user the requests belong to. 97 */ 90 98 static void client_connection_message_loop(telnet_user_t *user) 91 99 { … … 232 240 } 233 241 242 /** Callback when client connects to a telnet terminal. */ 234 243 static void client_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 235 244 { … … 257 266 } 258 267 268 /** Fibril for spawning the task running after user connects. 269 * 270 * @param arg Corresponding @c telnet_user_t structure. 271 */ 259 272 static int spawn_task_fibril(void *arg) 260 273 { … … 297 310 } 298 311 312 /** Tell whether given user can be destroyed (has no active clients). 313 * 314 * @param user The telnet user in question. 315 */ 299 316 static bool user_can_be_destroyed_no_lock(telnet_user_t *user) 300 317 { … … 303 320 } 304 321 322 /** Fibril for each accepted socket. 323 * 324 * @param arg Corresponding @c telnet_user_t structure. 325 */ 305 326 static int network_user_fibril(void *arg) 306 327 { -
uspace/srv/hid/remcons/user.c
rd545d03 r5923cf82 59 59 static LIST_INITIALIZE(users); 60 60 61 61 /** Create new telnet user. 62 * 63 * @param socket Socket the user communicates through. 64 * @return New telnet user or NULL when out of memory. 65 */ 62 66 telnet_user_t *telnet_user_create(int socket) 63 67 { … … 98 102 } 99 103 104 /** Destroy telnet user structure. 105 * 106 * @param user User to be destroyed. 107 */ 100 108 void telnet_user_destroy(telnet_user_t *user) 101 109 { … … 109 117 } 110 118 119 /** Find user by service id and increments reference counter. 120 * 121 * @param id Location service id of the telnet user's terminal. 122 */ 111 123 telnet_user_t *telnet_user_get_for_client_connection(service_id_t id) 112 124 { … … 147 159 } 148 160 161 /** Notify that client disconnected from the remote terminal. 162 * 163 * @param user To which user the client was connected. 164 */ 149 165 void telnet_user_notify_client_disconnected(telnet_user_t *user) 150 166 { -
uspace/srv/hid/remcons/user.h
rd545d03 r5923cf82 42 42 #define BUFFER_SIZE 1024 43 43 44 /** Representation of a connected (human) user. */ 44 45 typedef struct { 46 /** Internal id, used for creating locfs entries. */ 45 47 int id; 48 /** Associated socket. */ 46 49 int socket; 50 /** Location service id assigned to the virtual terminal. */ 47 51 service_id_t service_id; 52 /** Path name of the service. */ 48 53 char *service_name; 54 49 55 /** Producer-consumer of kbd_event_t. */ 50 56 prodcons_t in_events; … … 54 60 size_t socket_buffer_pos; 55 61 62 /** Task id of the launched application. */ 56 63 task_id_t task_id; 57 64 … … 69 76 void telnet_user_notify_client_disconnected(telnet_user_t *user); 70 77 78 /** Print informational message about connected user. */ 71 79 #define telnet_user_log(user, fmt, ...) \ 72 80 printf(NAME " [console %d (%d)]: " fmt "\n", user->id, (int) user->service_id, ##__VA_ARGS__) 73 81 82 /** Print error message associated with connected user. */ 74 83 #define telnet_user_error(user, fmt, ...) \ 75 84 fprintf(stderr, NAME " [console %d (%d)]: ERROR: " fmt "\n", user->id, (int) user->service_id, ##__VA_ARGS__)
Note:
See TracChangeset
for help on using the changeset viewer.