oracledb 5.5.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +1 -1875
  2. package/LICENSE.txt +8 -222
  3. package/NOTICE.txt +1 -1
  4. package/README.md +38 -30
  5. package/SECURITY.md +38 -0
  6. package/build/Release/oracledb-6.0.1-darwin-x64.node +0 -0
  7. package/build/Release/oracledb-6.0.1-darwin-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-6.0.1-js-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.0.1-linux-arm64.node +0 -0
  10. package/build/Release/oracledb-6.0.1-linux-arm64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.0.1-linux-x64.node +0 -0
  12. package/build/Release/oracledb-6.0.1-linux-x64.node-buildinfo.txt +1 -0
  13. package/build/Release/oracledb-6.0.1-win32-x64.node +0 -0
  14. package/build/Release/oracledb-6.0.1-win32-x64.node-buildinfo.txt +1 -0
  15. package/examples/README.md +113 -0
  16. package/examples/dbconfig.js +100 -0
  17. package/examples/example.js +156 -0
  18. package/index.js +26 -0
  19. package/lib/aqDeqOptions.js +148 -8
  20. package/lib/aqEnqOptions.js +59 -7
  21. package/lib/aqMessage.js +118 -7
  22. package/lib/aqQueue.js +243 -53
  23. package/lib/connection.js +1326 -465
  24. package/lib/constants.js +203 -0
  25. package/lib/dbObject.js +346 -32
  26. package/lib/errors.js +785 -0
  27. package/lib/impl/aqDeqOptions.js +197 -0
  28. package/lib/impl/aqEnqOptions.js +89 -0
  29. package/lib/impl/aqMessage.js +134 -0
  30. package/lib/impl/aqQueue.js +81 -0
  31. package/lib/impl/connection.js +529 -0
  32. package/lib/impl/dbObject.js +159 -0
  33. package/lib/impl/index.js +59 -0
  34. package/lib/impl/lob.js +85 -0
  35. package/lib/impl/pool.js +195 -0
  36. package/lib/impl/resultset.js +223 -0
  37. package/lib/impl/sodaCollection.js +174 -0
  38. package/lib/impl/sodaDatabase.js +81 -0
  39. package/lib/impl/sodaDocCursor.js +63 -0
  40. package/lib/impl/sodaDocument.js +98 -0
  41. package/lib/impl/sodaOperation.js +109 -0
  42. package/lib/lob.js +157 -68
  43. package/lib/oracledb.js +1047 -345
  44. package/lib/pool.js +654 -465
  45. package/lib/poolStatistics.js +24 -9
  46. package/lib/queryStream.js +16 -8
  47. package/lib/resultset.js +291 -183
  48. package/lib/settings.js +191 -0
  49. package/lib/sodaCollection.js +214 -201
  50. package/lib/sodaDatabase.js +108 -71
  51. package/lib/sodaDocCursor.js +44 -32
  52. package/lib/sodaDocument.js +76 -14
  53. package/lib/sodaOperation.js +131 -118
  54. package/lib/thin/connection.js +1043 -0
  55. package/lib/thin/dbObject.js +630 -0
  56. package/lib/thin/index.js +40 -0
  57. package/lib/thin/lob.js +189 -0
  58. package/lib/thin/pool.js +481 -0
  59. package/lib/thin/protocol/buffer.js +1043 -0
  60. package/lib/thin/protocol/capabilities.js +121 -0
  61. package/lib/thin/protocol/constants.js +765 -0
  62. package/lib/thin/protocol/encryptDecrypt.js +185 -0
  63. package/lib/thin/protocol/messages/auth.js +349 -0
  64. package/lib/thin/protocol/messages/base.js +476 -0
  65. package/lib/thin/protocol/messages/commit.js +56 -0
  66. package/lib/thin/protocol/messages/dataType.js +391 -0
  67. package/lib/thin/protocol/messages/execute.js +312 -0
  68. package/lib/thin/protocol/messages/fetch.js +60 -0
  69. package/lib/thin/protocol/messages/index.js +53 -0
  70. package/lib/thin/protocol/messages/lobOp.js +201 -0
  71. package/lib/thin/protocol/messages/logOff.js +53 -0
  72. package/lib/thin/protocol/messages/ping.js +56 -0
  73. package/lib/thin/protocol/messages/protocol.js +78 -0
  74. package/lib/thin/protocol/messages/rollback.js +56 -0
  75. package/lib/thin/protocol/messages/sessionRelease.js +60 -0
  76. package/lib/thin/protocol/messages/withData.js +812 -0
  77. package/lib/thin/protocol/oson.js +661 -0
  78. package/lib/thin/protocol/packet.js +519 -0
  79. package/lib/thin/protocol/protocol.js +202 -0
  80. package/lib/thin/protocol/utils.js +89 -0
  81. package/lib/thin/resultSet.js +122 -0
  82. package/lib/thin/sqlnet/connStrategy.js +175 -0
  83. package/lib/thin/sqlnet/constants.js +199 -0
  84. package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
  85. package/lib/thin/sqlnet/navNodes.js +870 -0
  86. package/lib/thin/sqlnet/networkSession.js +621 -0
  87. package/lib/thin/sqlnet/ntTcp.js +527 -0
  88. package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
  89. package/lib/thin/sqlnet/packet.js +405 -0
  90. package/lib/thin/sqlnet/paramParser.js +206 -0
  91. package/lib/thin/sqlnet/sessionAtts.js +160 -0
  92. package/lib/thin/statement.js +300 -0
  93. package/lib/thin/util.js +289 -0
  94. package/lib/transformer.js +252 -0
  95. package/lib/types.js +357 -0
  96. package/lib/util.js +196 -110
  97. package/lib/version.js +36 -0
  98. package/package/README.md +33 -30
  99. package/package/install.js +89 -64
  100. package/package/prunebinaries.js +60 -12
  101. package/package.json +3 -3
  102. package/build/Release/oracledb-5.5.0-darwin-x64.node +0 -0
  103. package/build/Release/oracledb-5.5.0-darwin-x64.node-buildinfo.txt +0 -1
  104. package/build/Release/oracledb-5.5.0-linux-x64.node +0 -0
  105. package/build/Release/oracledb-5.5.0-linux-x64.node-buildinfo.txt +0 -1
  106. package/build/Release/oracledb-5.5.0-win32-x64.node +0 -0
  107. package/build/Release/oracledb-5.5.0-win32-x64.node-buildinfo.txt +0 -1
@@ -0,0 +1,89 @@
1
+ // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+ 'use strict';
28
+
29
+ const { Buffer } = require('buffer');
30
+ const constants = require('./constants');
31
+ const crypto = require('crypto');
32
+
33
+ class OutOfPacketsError extends Error { }
34
+
35
+ function _convertBase64(result, value, size, offset) {
36
+ for (let i = 0;i < size;i++) {
37
+ result[offset + size - i - 1] = constants.TNS_BASE64_ALPHABET_ARRAY[value & 0x3f];
38
+ value = value >> 6;
39
+ }
40
+ return offset + size;
41
+ }
42
+
43
+ function encodeRowID(rowID) {
44
+ let offset = 0;
45
+ if (rowID.rba !== 0 || rowID.partitionID !== 0 || rowID.blockNum !== 0 || rowID.slotNum != 0) {
46
+ let result = Buffer.alloc(constants.TNS_MAX_ROWID_LENGTH);
47
+ offset = _convertBase64(result, rowID.rba, 6, offset);
48
+ offset = _convertBase64(result, rowID.partitionID, 3, offset);
49
+ offset = _convertBase64(result, rowID.blockNum, 6, offset);
50
+ _convertBase64(result, rowID.slotNum, 3, offset);
51
+ return result.toString('utf8');
52
+ }
53
+ }
54
+
55
+ // obfuscate value and clear memory for Buffers as they are from Buffer pool
56
+ // and are possible to stay longer
57
+ function setObfuscatedValue(value) {
58
+ const buf = crypto.randomBytes(Buffer.byteLength(value));
59
+ const bytes = Buffer.from(value, 'utf8');
60
+ const len = Buffer.byteLength(value);
61
+
62
+ let arr = [];
63
+ for (let i = 0; i < len; i++) {
64
+ arr.push(buf[i] ^ bytes[i]);
65
+ }
66
+ bytes.fill(0);
67
+ return {obfuscatedValue : buf, value : arr};
68
+ }
69
+
70
+ // returns the Deobfuscated value, after removing the obfuscation
71
+ // and clear memory of temporary Buffers coming from Buffer pool
72
+ function getDeobfuscatedValue(value, obfuscatedValue) {
73
+ const arr = [];
74
+ for (let i = 0; i < value.length; i++) {
75
+ arr.push(value[i] ^ obfuscatedValue[i]);
76
+ }
77
+ const buf = Buffer.from(arr);
78
+ arr.fill(0);
79
+ const retVal = buf.toString();
80
+ buf.fill(0);
81
+ return retVal;
82
+ }
83
+
84
+ module.exports = {
85
+ encodeRowID,
86
+ getDeobfuscatedValue,
87
+ OutOfPacketsError,
88
+ setObfuscatedValue
89
+ };
@@ -0,0 +1,122 @@
1
+ // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+ 'use strict';
28
+
29
+ const ResultSetImpl = require('../impl/resultset.js');
30
+ const ExecuteMessage = require('./protocol/messages/execute.js');
31
+ const FetchMessage = require('./protocol/messages/fetch.js');
32
+
33
+ class ThinResultSetImpl extends ResultSetImpl {
34
+
35
+ //---------------------------------------------------------------------------
36
+ // _fetchMoreRows()
37
+ //
38
+ // Fetches more rows from the database. This is done by means of the full
39
+ // OAL8 RPC if needed; otherwise, the simpler OFETCH RPC is used.
40
+ //---------------------------------------------------------------------------
41
+ async _fetchMoreRows(options) {
42
+ const cls = (this.statement.requiresFullExecute) ? ExecuteMessage : FetchMessage;
43
+ const message = new cls(this.connection, this.statement, options, this);
44
+ await this.connection._protocol._processMessage(message);
45
+ this.statement.requiresFullExecute = false;
46
+ }
47
+
48
+ //---------------------------------------------------------------------------
49
+ // Set the metadata info for a new resultSet object
50
+ //---------------------------------------------------------------------------
51
+ _resultSetNew(connection, statement, options) {
52
+ this.connection = connection;
53
+ this.statement = statement;
54
+ this._nestedCursorIndices = [];
55
+ this.options = options;
56
+ this.prefetchRowsProcessed = false;
57
+ this.statement.bufferRowIndex = 0;
58
+ }
59
+
60
+ //---------------------------------------------------------------------------
61
+ // Returns the statement to cache so that it can be used later
62
+ //---------------------------------------------------------------------------
63
+ close() {
64
+ this.connection._returnStatement(this.statement);
65
+ }
66
+
67
+ //---------------------------------------------------------------------------
68
+ // Returns rows fetched to the common layer in array format
69
+ //---------------------------------------------------------------------------
70
+ _processRows(numRowsFetched) {
71
+ let rows = [];
72
+ let bufferRowIndex = this.statement.bufferRowIndex;
73
+ for (let row = bufferRowIndex; row < bufferRowIndex + numRowsFetched; row++) {
74
+ let rowObj = [];
75
+ for (let col = 0; col < this.statement.numQueryVars; col++) {
76
+ rowObj.push(this.statement.queryVars[col].values[row]);
77
+ }
78
+ rows.push(rowObj);
79
+ }
80
+ this.statement.bufferRowIndex += numRowsFetched;
81
+ if (this.statement.bufferRowIndex === this.statement.bufferRowCount) {
82
+ this.statement.bufferRowCount = 0;
83
+ this.statement.bufferRowIndex = 0;
84
+ }
85
+ return rows;
86
+ }
87
+
88
+ //---------------------------------------------------------------------------
89
+ // getRows()
90
+ //
91
+ // Fetches the specified number of rows from the database and returns them to
92
+ // the common layer for processing.
93
+ //---------------------------------------------------------------------------
94
+ async getRows(numRows, options) {
95
+ options.fetchArraySize = numRows || this.options.fetchArraySize;
96
+ options.prefetchRows = this.options.prefetchRows;
97
+ if (this.statement.bufferRowCount - this.statement.bufferRowIndex >= options.fetchArraySize) {
98
+ return this._processRows(options.fetchArraySize);
99
+ } else {
100
+ // We fetch for the required number of row
101
+ options.fetchArraySize = options.fetchArraySize - (this.statement.bufferRowCount - this.statement.bufferRowIndex);
102
+ let prevBufferRowCount = this.statement.bufferRowCount;
103
+ if (this.statement.moreRowsToFetch && options.fetchArraySize > 0) {
104
+ await this._fetchMoreRows(options);
105
+ }
106
+ options.fetchArraySize = numRows || this.options.fetchArraySize;
107
+ if (prevBufferRowCount === this.statement.bufferRowCount) {
108
+ let numRowsFetched = this.statement.bufferRowCount - this.statement.bufferRowIndex;
109
+ this.statement.bufferRowCount = 0;
110
+ if (numRowsFetched > 0) {
111
+ return this._processRows(numRowsFetched);
112
+ }
113
+ return [];
114
+ }
115
+ }
116
+ let numRowsFetched = this.statement.bufferRowCount - this.statement.bufferRowIndex;
117
+ return this._processRows(numRowsFetched);
118
+ }
119
+
120
+ }
121
+
122
+ module.exports = ThinResultSetImpl;
@@ -0,0 +1,175 @@
1
+ // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+ 'use strict';
28
+
29
+ const { NavAddress, NavAddressList, NavDescription, NavDescriptionList } = require("./navNodes.js");
30
+ const { createNVPair } = require("./nvStrToNvPair.js");
31
+
32
+
33
+
34
+ /**
35
+ * Class that holds all possible attributes under Description
36
+ */
37
+ class ConnectDescription {
38
+ constructor() {
39
+ this.cOpts = new Array();
40
+ }
41
+
42
+ addConnectOption(opt) {
43
+ this.cOpts.push(opt);
44
+ }
45
+
46
+ getConnectOptions() {
47
+ return this.cOpts;
48
+ }
49
+
50
+ }
51
+
52
+ /**
53
+ * Class that holds a list of possible connection options.
54
+ */
55
+ class ConnStrategy {
56
+ constructor() {
57
+ this.nextOptToTry = 0;
58
+ this.retryCount = 0;
59
+ this.lastRetryCounter = 0;
60
+ this.lastRetryConnectDescription = 0;
61
+ this.currentDescription = null;
62
+ this.descriptionList = new Array();
63
+ this.sBuf = new Array();
64
+ }
65
+
66
+ hasMoreOptions() {
67
+ let cOptsSize = 0;
68
+
69
+ for (let i = 0; i < this.descriptionList.length; ++i) {
70
+ cOptsSize += this.descriptionList[i].getConnectOptions().length;
71
+ }
72
+ return (this.nextOptToTry < cOptsSize);
73
+ }
74
+
75
+ newConnectionDescription() {
76
+ this.currentDescription = new ConnectDescription();
77
+ return this.currentDescription;
78
+ }
79
+
80
+ getcurrentDescription() {
81
+ return this.currentDescription;
82
+ }
83
+
84
+ closeDescription() {
85
+ this.descriptionList.push(this.currentDescription);
86
+ this.currentDescription = null;
87
+ }
88
+ /**
89
+ * Execute the Connection Options from the array. When a refuse packet is received from
90
+ * server this method is called again and the next connect option is tried.
91
+ */
92
+ async execute(config) {
93
+ /* Check for retryCount in the config if no retryCount exists in the description string */
94
+ if (config != null) {
95
+ if (this.retryCount == 0 && config.retryCount > 0) {
96
+ this.retryCount = config.retryCount;
97
+ }
98
+ }
99
+ /* We try the address list at least once and upto (1 + retryCount) times */
100
+ for (let d = this.lastRetryConnectDescription; d < this.descriptionList.length; d++) {
101
+ let desc = this.descriptionList[d];
102
+ let cOpts = new Array();
103
+ cOpts = desc.getConnectOptions();
104
+ let delay = desc.delayInMillis;
105
+ /* check for retryDelay in config if it doesn't exist in description string */
106
+ if (config != null) {
107
+ if ((delay == 0 || delay == undefined) && config.retryDelay > 0) {
108
+ delay = config.retryDelay * 1000;
109
+ }
110
+ }
111
+ for (let i = this.lastRetryCounter; i <= this.retryCount; ++i) {
112
+ while (this.nextOptToTry < cOpts.length) {
113
+ let copt = cOpts[this.nextOptToTry];
114
+ this.lastRetryCounter = i;
115
+ this.lastRetryConnectDescription = d;
116
+ this.nextOptToTry++;
117
+ return copt;
118
+ }
119
+ this.nextOptToTry = 0;
120
+ // if we reached here then we are retrying other descriptor
121
+ if (delay > 0 && i < this.retryCount) {
122
+ await sleep(delay);
123
+ }// end of (delay > 0)
124
+
125
+ }// end of for(lastRetryCounter..retryCount)
126
+ this.lastRetryCounter = 0; // reset after one description is completed
127
+ }
128
+ // if we get here, all options were tried and none are valid
129
+ this.nextOptToTry = 1000;
130
+ this.lastRetryCounter = 1000;
131
+ throw new Error("All options tried");
132
+ }
133
+ // sleep time expects milliseconds
134
+
135
+
136
+ }
137
+ function sleep(time) {
138
+ return new Promise((resolve) => setTimeout(resolve, time));
139
+ }
140
+
141
+
142
+ /**
143
+ * create different nodes (schemaobject) as per the given input.
144
+ * @param {string} str - input description string
145
+ * @returns {object} - returns a connection strategy object.
146
+ */
147
+ async function createNode(str) {
148
+ let nvpair;
149
+ if (typeof str === 'string')
150
+ nvpair = createNVPair(str);
151
+ else
152
+ nvpair = str; //Already a NVPair
153
+
154
+ let arg = nvpair.name.toUpperCase();
155
+ let navobj = null;
156
+ switch (arg) {
157
+ case "ADDRESS":
158
+ navobj = new NavAddress();
159
+ break;
160
+ case "ADDRESS_LIST":
161
+ navobj = new NavAddressList();
162
+ break;
163
+ case "DESCRIPTION":
164
+ navobj = new NavDescription();
165
+ break;
166
+ case "DESCRIPTION_LIST":
167
+ navobj = new NavDescriptionList();
168
+ break;
169
+ }
170
+ navobj.initFromNVPair(nvpair);
171
+ let cs = new ConnStrategy();
172
+ await navobj.navigate(cs);
173
+ return cs;
174
+ }
175
+ module.exports = { createNode };
@@ -0,0 +1,199 @@
1
+ // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+
28
+ module.exports = {
29
+ // TNS packet types
30
+ NSPTCN : 1, // Connect
31
+ NSPTAC : 2, // Accept
32
+ NSPTAK : 3, // Acknowledge
33
+ NSPTRF : 4, // Refuse
34
+ NSPTRD : 5, // Redirect
35
+ NSPTDA : 6, // Data
36
+ NSPTNL : 7, // Null
37
+ NSPTAB : 9, // Abort
38
+ NSPTRS : 11, // Re-send
39
+ NSPTMK : 12, // Marker
40
+ NSPTAT : 13, // Attention
41
+ NSPTCNL : 14, // Control information
42
+ NSPTDD : 15, // data descriptor
43
+ NSPTHI : 19, // Highest legal packet type
44
+
45
+ // Packet Header
46
+ NSPHDLEN : 0, // Packet length
47
+ NSPHDPSM : 2, // Packet checksum(deprecated in version 3.15 with large sdu support)
48
+ NSPHDTYP : 4, // Packet type
49
+ NSPHDFLGS : 5, // Packet flags
50
+ NSPHDHSM : 6, // Header checksum
51
+ NSPSIZHD : 8, // Packet header size
52
+
53
+ /* Packet flags for NSPHDFLGS */
54
+ NSPFSID : 0x01, // SID is given
55
+ NSPFRDS : 0x02, // ReDirect Separation of cnda vs cndo
56
+ NSPFRDR : 0x04, // ReDiRected client Connect (NSPTCN)
57
+ NSPFLSD : 0x20, // packet with large sdu field
58
+ NO_HEADER_FLAGS : 0,
59
+ NSPFSRN : 0x08,
60
+
61
+ // Connect Packet
62
+ NSPCNVSN : 8, // My version number
63
+ NSPCNLOV : 10, // Lowest version number I can be compatible with
64
+ NSPCNOPT : 12, // Global service options
65
+ NSPCNSDU : 14, // My SDU size
66
+ NSPCNTDU : 16, // Maximum TDU size
67
+ NSPCNNTC : 18, // NT characterstics
68
+ NSPCNTNA : 20, // Line turnaround value
69
+ NSPCNONE : 22, // The value '1' in my hardware byte order
70
+ NSPCNLEN : 24, // Length of connect data
71
+ NSPCNOFF : 26, // Offset to connect data
72
+ NSPCNMXC : 28, // Maximum connect data you can send me
73
+ NSPCNFL0 : 32, // Connect flags
74
+ NSPCNFL1 : 33,
75
+ NSPCNTMO : 50, // local connection timeout val
76
+ NSPCNTCK : 52, // local tick size
77
+ NSPCNADL : 54,
78
+ NSPCNAOF : 56, // offset to reconnect tns addr
79
+ NSPCNLSD : 58, // large sdu
80
+ NSPCNLTD : 62, // large tdu
81
+ NSPCNCFL : 66, // compression data
82
+ NSPCNCFL2 : 70, // connect flag2
83
+ // NSPCNV310DAT : (NSPCNTMO + 8), start of connect data, V3.10 packet
84
+ // NSPCNV315DAT : (NSPCNCFL + 4),
85
+ NSPCNDAT : 74, // Start connect data
86
+ NSPMXCDATA : 230, // Maximum length of connect data
87
+ // Connect flags (Used mostly by NA)
88
+ NSINAWANTED : 0x01, // Want to use NA
89
+ NSINAINTCHG : 0x02, // Interchange involved
90
+ NSINADISABLEDFORCONNECTION: 0x04, // Disable NA
91
+ NSINANOSERVICES : 0x08, // No NA services linked
92
+ NSINAREQUIRED : 0x10, // NA is required
93
+ NSINAAUTHWANTED : 0x20, // Authentication linked
94
+ NSISUPSECRENEG : 0x80, // bkwrd comp: SUPport SECurity RE-NEG
95
+ // Connect options
96
+ NSGDONTCARE : 0x0001, // "don't care"
97
+ NSGHDX : 0x0002, // half-duplex (w/ token management)
98
+ NSGFDX : 0x0004, // full-duplex
99
+ NSGHDRCHKSUM : 0x0008, // checksum on packet header
100
+ NSGPAKCHKSUM : 0x0010, // checksum on entire packet
101
+ NSGBROKEN : 0x0020, // provide broken connection notification
102
+ NSGUSEVIO : 0x0040, // can use Vectored I/O
103
+ NSGOSAUTHOK : 0x0080, // use OS authentication
104
+ NSGSENDATTN : 0x0200, // can send attention
105
+ NSGRECVATTN : 0x0400, // can recv attention
106
+ NSGNOATTNPR : 0x0800, // no attention processing
107
+ NSGRAW : 0x1000, // I/O is direct to/from transport
108
+ TNS_VERSION_DESIRED : 319,
109
+ TNS_VERSION_MINIMUM : 300,
110
+
111
+ /* Accept Packet */
112
+ NSPACVSN : 8, // connection version
113
+ NSPACOPT : 10, // global service options
114
+ NSPACSDU : 12, // SDU size
115
+ NSPACTDU : 14, // Maximum TDU
116
+ NSPACONE : 16, // The value '1' in my hardware byte order
117
+ NSPACLEN : 18, // connect data length
118
+ NSPACOFF : 20, // offset to connect data
119
+ NSPACFL0 : 22, // connect flags
120
+ NSPACFL1 : 23,
121
+ NSPACTMO : 24, // connection pool timeout value
122
+ NSPACTCK : 26, // local tick size
123
+ NSPACADL : 28, // reconnect tns address length
124
+ NSPACAOF : 30, // offset to reconnect tns addr
125
+ NSPACLSD : 32, // Large sdu
126
+ NSPACLTD : 36, // Large tdu
127
+ NSPACCFL : 40, // compression flag
128
+ NSPACFL2 : 41, // accept flag2 (4 bytes)
129
+ NSPACV310DAT : 32, /* start of accept data, V3.10 packet */
130
+ NSPACV315DAT : 41, // start of accept data, V3.15 packet
131
+
132
+ /* Refuse Packet */
133
+ NSPRFURS : 8, // User (appliction) reason for refusal
134
+ NSPRFSRS : 9, // System (NS) reason for
135
+ NSPRFLEN : 10, // Length of refuse data
136
+ NSPRFDAT : 12, // Start of connect data
137
+ // Compression flags
138
+ NSPACCFON : 0x80, // 1st MSB: compression on/off
139
+ NSPACCFAT : 0x40, // 2nd MSB : compression auto
140
+ NSPACCFNT : 0x02, // Second last LSB : compression for non-tcp protocol
141
+ // Accept flag2
142
+ NSPACOOB : 0x00000001, // OOB support check at connection time
143
+ NSGPCHKSCMD : 0x01000000, // Support for Poll and Check logic
144
+
145
+ /* Redirect packet */
146
+ NSPRDLEN : 8, // Length of redirect data
147
+ NSPRDDAT : 10, // Start of connect data
148
+
149
+ /* Data Packet */
150
+ NSPDAFLG : 8, // Data flags
151
+ NSPDADAT : 10, // Start of Data
152
+ NSPDAFEOF : 0x40, // "end of file"
153
+
154
+ /* Marker Packet */
155
+ NSPMKTYP : 8, // marker type (see below)
156
+ NSPMKODT : 9, // old (pre-V3.05) data byte
157
+ NSPMKDAT : 10, // data byte
158
+ NSPMKTD0 : 0, // data marker - 0 data bytes
159
+ NSPMKTD1 : 1, // data marker - 1 data byte
160
+ NSPMKTAT : 2, // Attention Marker
161
+ NIQBMARK : 1, // Break marker
162
+ NIQRMARK : 2, // Reset marker
163
+ NIQIMARK : 3, // Interrupt marker
164
+
165
+ /* Control Packet */
166
+ NSPCTLCMD : 8, // Control Command length is 2 bytes
167
+ NSPCTLDAT : 10, // Control Data length is specific to the Command type.
168
+ NSPCTL_SERR : 8, // Error Control Command Type
169
+ NSPCTL_CLRATTN : 9, // Clear OOB option
170
+
171
+ /* OPTIONS */
172
+ NSPDFSDULN : 8192, // default SDU size
173
+ NSPABSSDULN : 2097152, // maximim SDU size
174
+ NSPMXSDULN : 65535, // maximim SDU size
175
+ NSPMNSDULN : 512, // minimum SDU size
176
+ NSPDFTDULN : 2097152, // default TDU size
177
+ NSPMXTDULN : 2097152, // maximum TDU size
178
+ NSPMNTDULN : 255, // minimum TDU size
179
+ NSFIMM : 0x0040, // immediate close
180
+
181
+ /* PARAMETERS */
182
+ DISABLE_OOB_STR : 'DISABLE_OOB', // disable OOB parameter
183
+ EXPIRE_TIME : 'EXPIRE_TIME', // expire Time
184
+ PEM_WALLET_FILE_NAME : 'ewallet.pem',
185
+
186
+ /* Get/Set options */
187
+ NT_MOREDATA : 1, // More Data in Transport available
188
+ NS_MOREDATA : 2, // More Data available to be read
189
+ SVCNAME : 3, // Service name
190
+ SERVERTYPE : 4, // Server type
191
+ REMOTEADDR : 5, // Remote Address
192
+ HEALTHCHECK : 6, // Health check of connection
193
+ CONNCLASS : 7, // Connection Class
194
+ PURITY : 8, // Purity
195
+ SID : 9, // SID
196
+
197
+ /* FLAGS */
198
+ NSNOBLOCK : 0x0001, // Do not block
199
+ };