1/*
2 * Copyright (c) 2015, 2021, Oracle and/or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is also distributed with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation.  The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have included with MySQL.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License, version 2.0, for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301  USA
24 */
25
26// tell protobuf 3.0 to use protobuf 2.x rules
27syntax = "proto2";
28
29// ifdef PROTOBUF_LITE: option optimize_for = LITE_RUNTIME;
30
31package Mysqlx;
32option java_package = "com.mysql.cj.x.protobuf";
33
34
35// style-guide:
36//
37// see https://developers.google.com/protocol-buffers/docs/style
38//
39// message CamelCaseMsg {
40//   enum CamelCaseEnum {
41//     FIRST_VALUE = 1;
42//   }
43//   required CamelCaseEnum some_enum = 1;
44// }
45//
46
47
48// IDs of messages that can be sent from client to the server
49//
50// .. note::
51//   this message is never sent on the wire. It is only used to let ``protoc``
52//
53//   * generate constants
54//   * check for uniqueness
55message ClientMessages {
56  enum Type {
57    CON_CAPABILITIES_GET = 1;
58    CON_CAPABILITIES_SET = 2;
59    CON_CLOSE = 3;
60
61    SESS_AUTHENTICATE_START = 4;
62    SESS_AUTHENTICATE_CONTINUE  = 5;
63    SESS_RESET = 6;
64    SESS_CLOSE = 7;
65
66    SQL_STMT_EXECUTE = 12;
67
68    CRUD_FIND = 17;
69    CRUD_INSERT = 18;
70    CRUD_UPDATE = 19;
71    CRUD_DELETE = 20;
72
73    EXPECT_OPEN = 24;
74    EXPECT_CLOSE = 25;
75
76    CRUD_CREATE_VIEW = 30;
77    CRUD_MODIFY_VIEW = 31;
78    CRUD_DROP_VIEW = 32;
79  }
80}
81
82// IDs of messages that can be sent from server to client
83//
84// .. note::
85//   this message is never sent on the wire. It is only used to let ``protoc``
86//
87//   * generate constants
88//   * check for uniqueness
89message ServerMessages {
90  enum Type {
91    OK = 0;
92    ERROR = 1;
93
94    CONN_CAPABILITIES = 2;
95
96    SESS_AUTHENTICATE_CONTINUE = 3;
97    SESS_AUTHENTICATE_OK = 4;
98
99    // NOTICE has to stay at 11 forever
100    NOTICE = 11;
101
102    RESULTSET_COLUMN_META_DATA = 12;
103    RESULTSET_ROW = 13;
104    RESULTSET_FETCH_DONE = 14;
105    RESULTSET_FETCH_SUSPENDED = 15;
106    RESULTSET_FETCH_DONE_MORE_RESULTSETS = 16;
107
108    SQL_STMT_EXECUTE_OK = 17;
109    RESULTSET_FETCH_DONE_MORE_OUT_PARAMS = 18;
110  };
111}
112
113
114// generic Ok message
115message Ok {
116  optional string msg = 1;
117}
118
119
120// generic Error message
121//
122// A ``severity`` of ``ERROR`` indicates the current message sequence is
123// aborted for the given error and the session is ready for more.
124//
125// In case of a ``FATAL`` error message the client should not expect
126// the server to continue handling any further messages and should
127// close the connection.
128//
129// :param severity: severity of the error message
130// :param code: error-code
131// :param sql_state: SQL state
132// :param msg: human readable error message
133message Error {
134  optional Severity severity = 1 [ default = ERROR ];
135  required uint32 code = 2;
136  required string sql_state = 4;
137  required string msg = 3;
138
139  enum Severity {
140    ERROR = 0;
141    FATAL = 1;
142  };
143}
144