1 /*
2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package jdk.jshell.execution;
27 
28 /**
29  * Communication constants shared between the main process and the remote
30  * execution process.  These are not enums to allow for future expansion, and
31  * remote/local of different versions.
32  *
33  * @author Robert Field
34  */
35 class RemoteCodes {
36 
37     /**
38      * Command prefix markers.
39      */
40     static final int COMMAND_PREFIX = 0xC03DC03D;
41 
42     // Command codes
43 
44     /**
45      * Exit the the agent.
46      */
47     static final String CMD_CLOSE          = "CMD_CLOSE";
48     /**
49      * Load classes.
50      */
51     static final String CMD_LOAD           = "CMD_LOAD";
52     /**
53      * Redefine classes.
54      */
55     static final String CMD_REDEFINE       = "CMD_REDEFINE";
56     /**
57      * Invoke a method.
58      */
59     static final String CMD_INVOKE         = "CMD_INVOKE";
60     /**
61      * Retrieve the value of a variable.
62      */
63     static final String CMD_VAR_VALUE      = "CMD_VAR_VALUE";
64     /**
65      * Add to the class-path.
66      */
67     static final String CMD_ADD_CLASSPATH  = "CMD_ADD_CLASSPATH";
68     /**
69      * Stop an invoke.
70      */
71     static final String CMD_STOP           = "CMD_STOP";
72 
73     // Return result codes
74 
75     /**
76      * The command succeeded.
77      */
78     static final int RESULT_SUCCESS                 = 100;
79     /**
80      * Unbidden execution engine termination.
81      */
82     static final int RESULT_TERMINATED              = 101;
83     /**
84      * Command not implemented.
85      */
86     static final int RESULT_NOT_IMPLEMENTED         = 102;
87     /**
88      * The command failed.
89      */
90     static final int RESULT_INTERNAL_PROBLEM        = 103;
91     /**
92      * User exception encountered. Legacy and used within RESULT_USER_EXCEPTION_CHAINED
93      */
94     static final int RESULT_USER_EXCEPTION          = 104;
95     /**
96      * Corralled code exception encountered.
97      */
98     static final int RESULT_CORRALLED               = 105;
99     /**
100      * Exception encountered during class load/redefine.
101      */
102     static final int RESULT_CLASS_INSTALL_EXCEPTION = 106;
103     /**
104      * The invoke has been stopped.
105      */
106     static final int RESULT_STOPPED                 = 107;
107     /**
108      * User exception encountered.
109      * @since 11
110      */
111     static final int RESULT_USER_EXCEPTION_CHAINED  = 108;
112 }
113