summaryrefslogtreecommitdiff
path: root/src/debug/jdwp/jdwp_def.h
blob: fc5a8fe2225241e11d1e79b9667a5a569d94734f (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

/* OpenIDA - Outil d'analyse de fichiers binaires
 * jdwp_def.h - transcription du protocole Java Debug Wire Protocol
 *
 * Copyright (C) 2010 Cyrille Bagard
 *
 *  This file is part of OpenIDA.
 *
 *  OpenIDA is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  OpenIDA 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.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _DEBUG_JDWP_JDWP_DEF_H
#define _DEBUG_JDWP_JDWP_DEF_H


#include <stdint.h>



/**
 * Les définitions ci-dessous sont issues des pages Web suivantes :
 *  - http://download.oracle.com/javase/1.4.2/docs/guide/jpda/jdwp-spec.html
 *  - http://download.oracle.com/javase/1.4.2/docs/guide/jpda/jdwp/jdwp-protocol.html
 */



/* ---------------------------------------------------------------------------------- */
/*                              EN-TETES DE PAQUETS JDWP                              */
/* ---------------------------------------------------------------------------------- */


/* En-tête générique */
typedef struct __attribute__((__packed__)) _jdwp_header
{
    uint32_t length;                        /* Taille totale du paquet     */
    uint32_t id;                            /* Numéro de séquence          */
    uint8_t flags;                          /* Options diverses            */

    union
    {
        /* Requête */
        struct
        {
            uint8_t set;                    /* Jeu de commandes            */
            uint8_t command;                /* Identifiant de commande     */
        };

        /* Réponse */
        uint16_t error;                     /* Numéro d'erreur             */

    };

} jdwp_header;


#define JDWP_FLAGS_NONE     0x00
#define JDWP_FLAGS_REPLY    0x80



/* ---------------------------------------------------------------------------------- */
/*                           TYPES DE BASE DIVERS POUR JDWP                           */
/* ---------------------------------------------------------------------------------- */




/* "string" */
typedef struct _jdwp_string
{
    uint32_t length;                        /* Taille de la chaîne         */
    char *value;                            /* Chaîne encodée en UTF-8     */

} jdwp_string;






/**
 * Jeux de commandes.
 */

#define JDWP_CST_VIRTUAL_MACHINE    1


/**
 * Sous-commandes d'un jeu.
 */

/* VirtualMachine Command Set */

#define JDWP_CMD_VM_VERSION         1


/**
 * Charges utiles des paquets.
 */

/* JDWP_CMD_VM_VERSION */

typedef struct _jdwp_cmd_vm_version_reply
{
    jdwp_string description;                /* Infos sur la VM             */
    uint32_t jdwp_major;                    /* Numéro majeur de JDWP       */
    uint32_t jdwp_minor;                    /* Numéro mineur de JDWP       */
    jdwp_string vm_version;                 /* Version JRE de la VM ciblée */
    jdwp_string vm_name;                    /* Nom de la VM                */

} jdwp_cmd_vm_version_reply;






#endif  /* _DEBUG_JDWP_JDWP_DEF_H */