001: /*
002:
003: Derby - Class org.apache.derby.client.net.NetConfiguration
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021: package org.apache.derby.client.net;
022:
023: import org.apache.derby.iapi.reference.DRDAConstants;
024: import org.apache.derby.client.am.Version;
025:
026: public class NetConfiguration {
027: // ---------------------------------------------------------------------------
028:
029: static final int INITIAL_CAPACITY = 10; // initial size of the Vector for the input parameters
030:
031: // Value to use when padding non-character data in ddm objects.
032: public static final byte NON_CHAR_DDM_DATA_PAD_BYTE = 0x00;
033:
034: static final int CURSOR_NOT_OPEN = 0;
035: static final int CURSOR_OPEN = 1;
036: static final int CURSOR_CLOSE_ONLY = 2;
037:
038: // Number of bytes in the DDM header.
039: static final int DDMHDR_LENGTH = 4;
040:
041: // Number of bytes in the DSS header.
042: static final int DSSHDR_LENGTH = 6;
043:
044: // Maximum size of External Name.
045: static final int EXTNAM_MAXSIZE = 255;
046:
047: // Minimum agent level required by protocol.
048: static final int MIN_AGENT_MGRLVL = 3;
049:
050: // Minimum communications tcpip manager level required by protocol.
051: static final int MIN_CMNTCPIP_MGRLVL = 5;
052:
053: // Minimum LU6.2 Conversational Communications Manager
054: static final int MIN_CMNAPPC_MGRLVL = 3;
055:
056: // Minimum rdb manager level required by protocol.
057: static final int MIN_RDB_MGRLVL = 3;
058:
059: // Minimum secmgr manager level required by protocol.
060: static final int MIN_SECMGR_MGRLVL = 5;
061:
062: // Minimum sqlam manager level required by protocol.
063: static final int MIN_SQLAM_MGRLVL = 4;
064:
065: // Minimum xa manager level required by protocol.
066: static final int MIN_XAMGR_MGRLVL = 7;
067:
068: // Minimum secmgr manager level required by protocol.
069: static final int MIN_SYNCPTMGR_MGRLVL = 5;
070:
071: // Minimum sqlam manager level required by protocol.
072: static final int MIN_RSYNCMGR_MGRLVL = 5;
073:
074: // Maximun Password size.
075: static final int PASSWORD_MAXSIZE = 255;
076:
077: // Fixed PRDDTA application id fixed length.
078: public static final int PRDDTA_APPL_ID_FIXED_LEN = 20;
079:
080: // PRDDTA Accounting Suffix Length byte offset.
081: static final int PRDDTA_ACCT_SUFFIX_LEN_BYTE = 55;
082:
083: // PRDDTA Max Accounting Suffix Length.
084: static final int PRDDTA_MAX_ACCT_SUFFIX_LEN = 199;
085:
086: // PRDDTA Length byte offset.
087: static final int PRDDTA_LEN_BYTE = 0;
088:
089: // Maximum PRDDTA size.
090: static final int PRDDTA_MAXSIZE = 255;
091:
092: // PRDDTA platform id.
093: public static final String PRDDTA_PLATFORM_ID = "JVM ";
094:
095: // Fixed PRDDTA user id fixed length.
096: public static final int PRDDTA_USER_ID_FIXED_LEN = 8;
097:
098: // Identifier Length for fixed length rdb name
099: public static final int PKG_IDENTIFIER_FIXED_LEN = 18;
100:
101: // Maximum RDB Identifier Length
102: static final int PKG_IDENTIFIER_MAX_LEN = 255;
103:
104: // Fixed pkgcnstkn length
105: public static final int PKGCNSTKN_FIXED_LEN = 8;
106:
107: // Maximum length of a security token.
108: // Anything greater than 32763 bytes of SECTKN would require extended length DDMs.
109: // This seems like an impossible upper bound limit right now so set
110: // max to 32763 and cross bridge later.
111: static final int SECTKN_MAXSIZE = 32763; // this was 255
112:
113: // Server class name of the ClientDNC product.
114: static final String SRVCLSNM_JVM = "QDERBY/JVM";
115:
116: // Maximum size of SRVNAM Name.
117: static final int SRVNAM_MAXSIZE = 255;
118:
119: // Manager is NA or not usued.
120: static final int MGRLVL_NA = 0;
121:
122: // Manager Level 3 constant.
123: static final int MGRLVL_3 = 0x03;
124:
125: // Manager Level 4 constant.
126: static final int MGRLVL_4 = 0x04;
127:
128: // Manager Level 5 constant.
129: static final int MGRLVL_5 = 0x05;
130:
131: // Manager level 6 constant.
132: static final int MGRLVL_6 = 0x06;
133:
134: // Manager Level 7 constant.
135: static final public int MGRLVL_7 = 0x07;
136:
137: // Indicates the DCE security mechanism.
138: static final int SECMEC_DCESEC = 0x01;
139:
140: // Indicates encrypted userid, password,
141: // new password security mechanism.
142: static final int SECMEC_EUSRIDNWPWD = 0x0A;
143:
144: // Indicates userid/encrypted password security mechanism.
145: public static final int SECMEC_EUSRIDPWD = 0x09;
146:
147: // Indicates userid only security mechanism.
148: public static final int SECMEC_USRIDONL = 0x04;
149:
150: // Indicates userid/encrypted password security mechanism.
151: public static final int SECMEC_USRENCPWD = 0x07;
152:
153: // Indicates userid/new password security mechanism.
154: static final int SECMEC_USRIDNWPWD = 0x05;
155:
156: // Indicates userid/password security mechanism.
157: public static final int SECMEC_USRIDPWD = 0x03;
158:
159: //Indicates Encrypted userid and Encrypted Security-sensitive Data security mechanism
160: public static final int SECMEC_EUSRIDDTA = 0x0C;
161:
162: //Indicates Encrypted userid,Encrypted password and Encrypted Security-sensitive Data security mechanism
163: public static final int SECMEC_EUSRPWDDTA = 0x0D;
164:
165: // Indicates userid with strong password substitute security mechanism.
166: public static final int SECMEC_USRSSBPWD = 0x08;
167:
168: // list of security mechanisms supported by this driver
169: static final int[] SECMGR_SECMECS = {
170: NetConfiguration.SECMEC_EUSRIDPWD,
171: NetConfiguration.SECMEC_USRENCPWD,
172: NetConfiguration.SECMEC_USRIDPWD,
173: NetConfiguration.SECMEC_USRIDONL,
174: NetConfiguration.SECMEC_EUSRIDDTA,
175: NetConfiguration.SECMEC_EUSRPWDDTA,
176: NetConfiguration.SECMEC_USRSSBPWD };
177:
178: // IEEE ASCII constant.
179: public static final String SYSTEM_ASC = "QTDSQLASC";
180:
181: // JVM constant.
182: static final String SYSTEM_JVM = "QTDSQLJVM";
183:
184: // Maximum size of User Name.
185: static final int USRID_MAXSIZE = 255;
186:
187: // Product id of the ClientDNC.
188: public static String PRDID;
189:
190: // The server release level of this product.
191: // It will be prefixed with PRDID
192: static String SRVRLSLV;
193:
194: // Initialize PRDID and SRVRLSLV
195: static {
196: int majorVersion = Version.getMajorVersion();
197: int minorVersion = Version.getMinorVersion();
198: int protocolMaintVersion = Version.getProtocolMaintVersion();
199:
200: // PRDID format as Network Server expects it: DNCMMmx
201: // MM = major version
202: // mm = minor version
203: // x = protocol MaintenanceVersion
204:
205: String prdId = DRDAConstants.DERBY_DRDA_CLIENT_ID;
206: if (majorVersion < 10) {
207: prdId += "0";
208: }
209: prdId += majorVersion;
210:
211: if (minorVersion < 10) {
212: prdId += "0";
213: }
214:
215: prdId += minorVersion;
216: prdId += protocolMaintVersion;
217: PRDID = prdId;
218: SRVRLSLV = prdId + "/" + Version.getDriverVersion();
219: }
220:
221: }
|