2013-02-04 Tristan Gingold <gingold@adacore.com>
[deliverable/binutils-gdb.git] / gdb / remote-notif.h
1 /* Remote notification in GDB protocol
2
3 Copyright (C) 1988-2013 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef REMOTE_NOTIF_H
21 #define REMOTE_NOTIF_H
22
23 #include "queue.h"
24
25 /* An event of a type of async remote notification. */
26
27 struct notif_event
28 {
29 /* Destructor. Release everything from SELF, but not SELF
30 itself. */
31 void (*dtr) (struct notif_event *self);
32 };
33
34 /* A client to a sort of async remote notification. */
35
36 typedef struct notif_client
37 {
38 /* The name of notification packet. */
39 const char *name;
40
41 /* The packet to acknowledge a previous reply. */
42 const char *ack_command;
43
44 /* Parse BUF to get the expected event and update EVENT. This
45 function may throw exception if contents in BUF is not the
46 expected event. */
47 void (*parse) (struct notif_client *self, char *buf,
48 struct notif_event *event);
49
50 /* Send field <ack_command> to remote, and do some checking. If
51 something wrong, throw an exception. */
52 void (*ack) (struct notif_client *self, char *buf,
53 struct notif_event *event);
54
55 /* Check this notification client can get pending events in
56 'remote_notif_process'. */
57 int (*can_get_pending_events) (struct notif_client *self);
58
59 /* Allocate an event. */
60 struct notif_event *(*alloc_event) (void);
61
62 /* One pending event. This is where we keep it until it is
63 acknowledged. When there is a notification packet, parse it,
64 and create an object of 'struct notif_event' to assign to
65 it. This field is unchanged until GDB starts to ack this
66 notification (which is done by
67 remote.c:remote_notif_pending_replies). */
68 struct notif_event *pending_event;
69 } *notif_client_p;
70
71 void remote_notif_ack (struct notif_client *nc, char *buf);
72 struct notif_event *remote_notif_parse (struct notif_client *nc,
73 char *buf);
74
75 void handle_notification (char *buf);
76
77 void remote_notif_register_async_event_handler (void);
78 void remote_notif_unregister_async_event_handler (void);
79
80 void remote_notif_process (struct notif_client *except);
81 extern struct notif_client notif_client_stop;
82
83 extern unsigned int notif_debug;
84
85 #endif /* REMOTE_NOTIF_H */
This page took 0.067186 seconds and 4 git commands to generate.