1 21 22 package org.apache.derby.client.net; 23 24 import javax.transaction.xa.Xid ; 25 26 import org.apache.derby.client.am.Connection; 27 import org.apache.derby.client.am.ConnectionCallbackInterface; 28 import org.apache.derby.client.am.StatementCallbackInterface; 29 import org.apache.derby.client.am.ResultSetCallbackInterface; 30 import org.apache.derby.client.am.DisconnectException; 31 import org.apache.derby.client.am.SqlException; 32 import org.apache.derby.client.am.ClientMessageId; 33 import org.apache.derby.client.am.Sqlca; 34 import java.io.UnsupportedEncodingException ; 35 import org.apache.derby.client.am.UnitOfWorkListener; 36 37 import org.apache.derby.shared.common.error.ExceptionSeverity; 38 import org.apache.derby.shared.common.error.ExceptionUtil; 39 import org.apache.derby.shared.common.reference.SQLState; 40 import org.apache.derby.shared.common.reference.MessageId; 41 import org.apache.derby.shared.common.i18n.MessageUtil; 42 43 44 public class NetConnectionReply extends Reply 45 implements ConnectionReplyInterface { 46 private static MessageUtil msgutil_ = SqlException.getMessageUtil(); 47 48 NetConnectionReply(NetAgent netAgent, int bufferSize) { 49 super(netAgent, bufferSize); 50 } 51 52 void readExchangeServerAttributes(Connection connection) throws SqlException { 54 startSameIdChainParse(); 55 parseEXCSATreply((NetConnection) connection); 56 endOfSameIdChainData(); 57 agent_.checkForChainBreakingException_(); 58 } 59 60 void verifyDeferredReset() throws SqlException { 61 readDssHeader(); 62 verifyConnectReply(CodePoint.EXCSATRD); 63 readDssHeader(); 64 verifyConnectReply(CodePoint.ACCSECRD); 65 readDssHeader(); 66 verifyConnectReply(CodePoint.SECCHKRM); 67 readDssHeader(); 68 verifyConnectReply(CodePoint.ACCRDBRM); 69 agent_.checkForChainBreakingException_(); 70 } 71 72 void verifyConnectReply(int codept) throws SqlException { 73 if (peekCodePoint() != codept) { 74 parseConnectError(); 75 return; 76 } 77 readLengthAndCodePoint(); 78 skipBytes(); 79 80 if (codept == CodePoint.ACCRDBRM) { 81 int peekCP = peekCodePoint(); 82 if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { 83 return; 84 } 85 86 parseTypdefsOrMgrlvlovrs(); 87 NetSqlca netSqlca = parseSQLCARD(null); 88 netAgent_.netConnection_.completeSqlca(netSqlca); 89 } 90 } 91 92 void parseConnectError() throws DisconnectException { 93 int peekCP = peekCodePoint(); 94 switch (peekCP) { 95 case CodePoint.CMDCHKRM: 96 parseCMDCHKRM(); 97 break; 98 case CodePoint.MGRLVLRM: 99 parseMGRLVLRM(); 100 break; 101 default: 102 parseCommonError(peekCP); 103 } 104 } 105 106 void readDummyExchangeServerAttributes(Connection connection) throws SqlException { 107 startSameIdChainParse(); 108 parseDummyEXCSATreply((NetConnection) connection); 109 endOfSameIdChainData(); 110 agent_.checkForChainBreakingException_(); 111 } 112 113 void readAccessSecurity(Connection connection, 115 int securityMechanism) throws SqlException { 116 startSameIdChainParse(); 117 parseACCSECreply((NetConnection) connection, securityMechanism); 118 endOfSameIdChainData(); 119 agent_.checkForChainBreakingException_(); 120 } 121 122 void readSecurityCheck(Connection connection) throws SqlException { 124 startSameIdChainParse(); 125 parseSECCHKreply((NetConnection) connection); 126 endOfSameIdChainData(); 127 agent_.checkForChainBreakingException_(); 128 } 129 130 void readAccessDatabase(Connection connection) throws SqlException { 132 startSameIdChainParse(); 133 parseACCRDBreply((NetConnection) connection); 134 endOfSameIdChainData(); 135 agent_.checkForChainBreakingException_(); 136 } 137 138 139 public void readCommitSubstitute(ConnectionCallbackInterface connection) throws DisconnectException { 140 startSameIdChainParse(); 141 parseDummyEXCSATreply((NetConnection) connection); 142 endOfSameIdChainData(); 143 } 144 145 public void readLocalCommit(ConnectionCallbackInterface connection) throws DisconnectException { 146 startSameIdChainParse(); 147 parseRDBCMMreply(connection); 148 endOfSameIdChainData(); 149 } 150 151 public void readLocalRollback(ConnectionCallbackInterface connection) throws DisconnectException { 152 startSameIdChainParse(); 153 parseRDBRLLBCKreply(connection); 154 endOfSameIdChainData(); 155 } 156 157 158 public void readLocalXAStart(ConnectionCallbackInterface connection) throws DisconnectException { 159 } 160 161 public void readLocalXACommit(ConnectionCallbackInterface connection) throws DisconnectException { 162 } 163 164 public void readLocalXARollback(ConnectionCallbackInterface connection) throws DisconnectException { 165 } 166 167 168 protected void readXaStartUnitOfWork(NetConnection conn) throws DisconnectException { 169 } 170 171 protected int readXaEndUnitOfWork(NetConnection conn) throws DisconnectException { 172 return 0; 173 } 174 175 protected int readXaPrepare(NetConnection conn) throws DisconnectException { 176 return 0; 177 } 178 179 protected void readXaCommit(NetConnection conn) throws DisconnectException { 180 } 181 182 protected int readXaRollback(NetConnection conn) throws DisconnectException { 183 return 0; 184 } 185 186 protected void readXaRecover(NetConnection conn) throws DisconnectException { 187 } 188 189 protected void readXaForget(NetConnection conn) throws DisconnectException { 190 } 191 192 193 198 private void parseRDBCMMreply(ConnectionCallbackInterface connection) throws DisconnectException { 202 int peekCP = parseTypdefsOrMgrlvlovrs(); 203 204 if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) { 205 parseCommitError(connection); 206 return; 207 } 208 209 if (peekCP == CodePoint.ENDUOWRM) { 210 parseENDUOWRM(connection); 211 peekCP = parseTypdefsOrMgrlvlovrs(); 212 } 213 214 NetSqlca netSqlca = parseSQLCARD(null); 215 connection.completeSqlca(netSqlca); 216 } 217 218 private void parseRDBRLLBCKreply(ConnectionCallbackInterface connection) throws DisconnectException { 222 int peekCP = parseTypdefsOrMgrlvlovrs(); 223 if (peekCP != CodePoint.ENDUOWRM) { 224 parseRollbackError(); 225 return; 226 } 227 228 parseENDUOWRM(connection); 229 peekCP = parseTypdefsOrMgrlvlovrs(); 230 231 NetSqlca netSqlca = parseSQLCARD(null); 232 connection.completeSqlca(netSqlca); 233 } 234 235 private void parseEXCSATreply(NetConnection netConnection) throws DisconnectException { 239 if (peekCodePoint() != CodePoint.EXCSATRD) { 240 parseExchangeServerAttributesError(); 241 return; 242 } 243 parseEXCSATRD(netConnection); 244 } 245 246 private void parseDummyEXCSATreply(NetConnection netConnection) throws DisconnectException { 250 if (peekCodePoint() != CodePoint.EXCSATRD) { 251 parseExchangeServerAttributesError(); 252 return; 253 } 254 parseDummyEXCSATRD(netConnection); 255 } 256 257 private void parseACCSECreply(NetConnection netConnection, int securityMechanism) throws DisconnectException { 261 int peekCP = peekCodePoint(); 262 if (peekCP != CodePoint.ACCSECRD) { 263 parseAccessSecurityError(netConnection); 264 return; 265 } 266 parseACCSECRD(netConnection, securityMechanism); 267 268 peekCP = peekCodePoint(); 269 if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { 270 return; 271 } 272 273 } 274 275 private void parseSECCHKreply(NetConnection netConnection) throws DisconnectException { 279 if (peekCodePoint() != CodePoint.SECCHKRM) { 280 parseSecurityCheckError(netConnection); 281 return; 282 } 283 284 parseSECCHKRM(netConnection); 285 if (peekCodePoint() == CodePoint.SECTKN) { 286 boolean done = false; 296 byte[] bytes = parseSECTKN(false); 297 } 298 } 299 300 private void parseACCRDBreply(NetConnection netConnection) throws DisconnectException { 304 int peekCP = peekCodePoint(); 305 if (peekCP != CodePoint.ACCRDBRM) { 306 parseAccessRdbError(netConnection); 307 return; 308 } 309 310 parseACCRDBRM(netConnection); 311 peekCP = peekCodePoint(); 312 if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { 313 return; 314 } 315 316 parseTypdefsOrMgrlvlovrs(); 317 NetSqlca netSqlca = parseSQLCARD(null); 318 netConnection.completeSqlca(netSqlca); 319 } 320 321 322 protected int parseTypdefsOrMgrlvlovrs() throws DisconnectException { 323 boolean targetTypedefCloned = false; 324 while (true) { 325 int peekCP = peekCodePoint(); 326 if (peekCP == CodePoint.TYPDEFNAM) { 327 if (!targetTypedefCloned) { 328 netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone(); 329 targetTypedefCloned = true; 330 } 331 parseTYPDEFNAM(); 332 } else if (peekCP == CodePoint.TYPDEFOVR) { 333 if (!targetTypedefCloned) { 334 netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone(); 335 targetTypedefCloned = true; 336 } 337 parseTYPDEFOVR(); 338 } else { 339 return peekCP; 340 } 341 } 342 } 343 344 345 347 protected void parseCommitError(ConnectionCallbackInterface connection) throws DisconnectException { 348 int peekCP = peekCodePoint(); 349 switch (peekCP) { 350 case CodePoint.ABNUOWRM: 351 NetSqlca sqlca = parseAbnormalEndUow(connection,null); 352 connection.completeSqlca(sqlca); 353 break; 354 case CodePoint.CMDCHKRM: 355 parseCMDCHKRM(); 356 break; 357 case CodePoint.RDBNACRM: 358 parseRDBNACRM(); 359 break; 360 default: 361 parseCommonError(peekCP); 362 break; 363 } 364 } 365 366 void parseRollbackError() throws DisconnectException { 367 int peekCP = peekCodePoint(); 368 switch (peekCP) { 369 case CodePoint.CMDCHKRM: 370 parseCMDCHKRM(); 371 break; 372 case CodePoint.RDBNACRM: 373 parseRDBNACRM(); 374 break; 375 default: 376 parseCommonError(peekCP); 377 break; 378 } 379 } 380 381 void parseExchangeServerAttributesError() throws DisconnectException { 382 int peekCP = peekCodePoint(); 383 switch (peekCP) { 384 case CodePoint.CMDCHKRM: 385 parseCMDCHKRM(); 386 break; 387 case CodePoint.MGRLVLRM: 388 parseMGRLVLRM(); 389 break; 390 default: 391 parseCommonError(peekCP); 392 } 393 } 394 395 void parseAccessSecurityError(NetConnection netConnection) throws DisconnectException { 396 int peekCP = peekCodePoint(); 397 switch (peekCP) { 398 case CodePoint.CMDCHKRM: 399 parseCMDCHKRM(); 400 break; 401 case CodePoint.RDBNFNRM: 402 parseRDBNFNRM(netConnection); 403 break; 404 case CodePoint.RDBAFLRM: 405 parseRdbAccessFailed(netConnection); 406 break; 407 default: 408 parseCommonError(peekCP); 409 } 410 } 411 412 void parseSecurityCheckError(NetConnection netConnection) throws DisconnectException { 413 int peekCP = peekCodePoint(); 414 switch (peekCP) { 415 case CodePoint.CMDCHKRM: 416 parseCMDCHKRM(); 417 break; 418 case CodePoint.OBJNSPRM: 419 parseOBJNSPRM(); 420 break; 421 case CodePoint.RDBNFNRM: 422 parseRDBNFNRM(netConnection); 423 break; 424 case CodePoint.RDBAFLRM: 425 parseRdbAccessFailed(netConnection); 426 break; 427 default: 428 parseCommonError(peekCP); 429 } 430 } 431 432 void parseAccessRdbError(NetConnection netConnection) throws DisconnectException { 433 int peekCP = peekCodePoint(); 434 switch (peekCP) { 435 case CodePoint.CMDCHKRM: 436 parseCMDCHKRM(); 437 break; 438 case CodePoint.RDBACCRM: 439 parseRDBACCRM(); 440 break; 441 case CodePoint.RDBAFLRM: 442 parseRdbAccessFailed(netConnection); 443 break; 444 case CodePoint.RDBATHRM: 445 parseRDBATHRM(netConnection); 446 break; 447 case CodePoint.RDBNFNRM: 448 parseRDBNFNRM(netConnection); 449 break; 450 default: 451 parseCommonError(peekCP); 452 } 453 } 454 455 456 void parseCommonError(int peekCP) throws DisconnectException { 458 switch (peekCP) { 459 case CodePoint.CMDNSPRM: 460 parseCMDNSPRM(); 461 break; 462 case CodePoint.PRCCNVRM: 463 parsePRCCNVRM(); 464 break; 465 case CodePoint.SYNTAXRM: 466 parseSYNTAXRM(); 467 break; 468 case CodePoint.VALNSPRM: 469 parseVALNSPRM(); 470 break; 471 default: 472 doObjnsprmSemantics(peekCP); 473 } 474 } 475 476 485 NetSqlca parseAbnormalEndUow(ConnectionCallbackInterface connection,UnitOfWorkListener uwl) throws DisconnectException { 486 parseABNUOWRM(); 487 if (peekCodePoint() != CodePoint.SQLCARD) { 488 parseTypdefsOrMgrlvlovrs(); 489 } 490 491 NetSqlca netSqlca = parseSQLCARD(null); 492 493 if(ExceptionUtil.getSeverityFromIdentifier(netSqlca.getSqlState()) > 494 ExceptionSeverity.STATEMENT_SEVERITY || uwl == null) 495 connection.completeAbnormalUnitOfWork(); 496 else 497 connection.completeAbnormalUnitOfWork(uwl); 498 499 return netSqlca; 500 } 501 502 511 NetSqlca parseAbnormalEndUow(StatementCallbackInterface s) throws DisconnectException { 512 return parseAbnormalEndUow(s.getConnectionCallbackInterface(),s); 513 } 514 515 524 NetSqlca parseAbnormalEndUow(ResultSetCallbackInterface r) throws DisconnectException { 525 return parseAbnormalEndUow(r.getConnectionCallbackInterface(),r); 526 } 527 528 void parseRdbAccessFailed(NetConnection netConnection) throws DisconnectException { 529 parseRDBAFLRM(); 530 531 535 if (peekCodePoint() == CodePoint.TYPDEFNAM) { 536 parseTYPDEFNAM(); 537 parseTYPDEFOVR(); 538 } else { 539 parseTYPDEFOVR(); 540 parseTYPDEFNAM(); 541 } 542 543 NetSqlca netSqlca = parseSQLCARD(null); 544 545 if(netSqlca.getSqlErrmc() == null) 547 netConnection.setConnectionNull(true); 548 else 549 netConnection.completeSqlca(netSqlca); 550 } 551 552 553 private void parseSECCHKRM(NetConnection netConnection) throws DisconnectException { 564 boolean svrcodReceived = false; 565 int svrcod = CodePoint.SVRCOD_INFO; 566 boolean secchkcdReceived = false; 567 int secchkcd = CodePoint.SECCHKCD_00; 568 boolean sectknReceived = false; 569 byte[] sectkn = null; 570 571 parseLengthAndMatchCodePoint(CodePoint.SECCHKRM); 572 pushLengthOnCollectionStack(); 573 int peekCP = peekCodePoint(); 574 575 while (peekCP != Reply.END_OF_COLLECTION) { 576 577 boolean foundInPass = false; 578 579 if (peekCP == CodePoint.SVRCOD) { 580 foundInPass = true; 584 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 585 svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SEVERE); 586 peekCP = peekCodePoint(); 587 } 588 589 if (peekCP == CodePoint.SECCHKCD) { 590 foundInPass = true; 594 secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived); 595 secchkcd = parseSECCHKCD(); 596 peekCP = peekCodePoint(); 597 } 598 599 if (peekCP == CodePoint.SECTKN) { 600 foundInPass = true; 608 sectknReceived = checkAndGetReceivedFlag(sectknReceived); 609 sectkn = parseSECTKN(true); 610 peekCP = peekCodePoint(); 611 } 612 613 if (!foundInPass) { 614 doPrmnsprmSemantics(peekCP); 615 } 616 617 } 618 popCollectionStack(); 619 checkRequiredObjects(svrcodReceived, secchkcdReceived); 621 622 netConnection.securityCheckComplete(svrcod, secchkcd); 623 } 624 625 626 private void parseACCRDBRM(NetConnection netConnection) throws DisconnectException { 640 boolean svrcodReceived = false; 641 int svrcod = CodePoint.SVRCOD_INFO; 642 boolean prdidReceived = false; 643 String prdid = null; 644 boolean typdefnamReceived = false; 645 boolean typdefovrReceived = false; 646 boolean rdbinttknReceived = false; 647 boolean crrtknReceived = false; 648 byte[] crrtkn = null; 649 boolean usridReceived = false; 650 String usrid = null; 651 652 parseLengthAndMatchCodePoint(CodePoint.ACCRDBRM); 653 pushLengthOnCollectionStack(); 654 int peekCP = peekCodePoint(); 655 656 while (peekCP != Reply.END_OF_COLLECTION) { 657 658 boolean foundInPass = false; 659 660 if (peekCP == CodePoint.SVRCOD) { 661 foundInPass = true; 666 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 667 svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_WARNING); 668 peekCP = peekCodePoint(); 669 } 670 671 if (peekCP == CodePoint.PRDID) { 673 foundInPass = true; 674 prdidReceived = checkAndGetReceivedFlag(prdidReceived); 675 prdid = parsePRDID(false); peekCP = peekCodePoint(); 677 } 678 679 if (peekCP == CodePoint.TYPDEFNAM) { 680 foundInPass = true; 683 typdefnamReceived = checkAndGetReceivedFlag(typdefnamReceived); 684 parseTYPDEFNAM(); 685 peekCP = peekCodePoint(); 686 } 687 688 if (peekCP == CodePoint.TYPDEFOVR) { 689 foundInPass = true; 693 typdefovrReceived = checkAndGetReceivedFlag(typdefovrReceived); 694 parseTYPDEFOVR(); 695 peekCP = peekCodePoint(); 696 } 697 698 699 if (peekCP == CodePoint.USRID) { 700 foundInPass = true; 706 usridReceived = checkAndGetReceivedFlag(usridReceived); 707 usrid = parseUSRID(true); 708 peekCP = peekCodePoint(); 709 } 710 711 if (peekCP == CodePoint.CRRTKN) { 712 foundInPass = true; 719 crrtknReceived = checkAndGetReceivedFlag(crrtknReceived); 720 crrtkn = parseCRRTKN(false); 721 peekCP = peekCodePoint(); 722 } 723 724 725 if (!foundInPass) { 726 doPrmnsprmSemantics(peekCP); 727 } 728 } 729 popCollectionStack(); 730 checkRequiredObjects(svrcodReceived, 732 prdidReceived, 733 typdefnamReceived, 734 typdefovrReceived); 735 736 netConnection.rdbAccessed(svrcod, 737 prdid, 738 crrtknReceived, 739 crrtkn); 740 } 741 742 743 void parseENDUOWRM(ConnectionCallbackInterface connection) throws DisconnectException { 751 boolean svrcodReceived = false; 752 int svrcod = CodePoint.SVRCOD_INFO; 753 boolean uowdspReceived = false; 754 int uowdsp = 0; 755 boolean rdbnamReceived = false; 756 String rdbnam = null; 757 758 parseLengthAndMatchCodePoint(CodePoint.ENDUOWRM); 759 pushLengthOnCollectionStack(); 760 int peekCP = peekCodePoint(); 761 762 while (peekCP != Reply.END_OF_COLLECTION) { 763 764 boolean foundInPass = false; 765 766 if (peekCP == CodePoint.SVRCOD) { 767 foundInPass = true; 768 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 769 svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, CodePoint.SVRCOD_WARNING); 770 peekCP = peekCodePoint(); 771 } 772 773 if (peekCP == CodePoint.UOWDSP) { 774 foundInPass = true; 775 uowdspReceived = checkAndGetReceivedFlag(uowdspReceived); 776 uowdsp = parseUOWDSP(); 777 peekCP = peekCodePoint(); 778 } 779 780 if (peekCP == CodePoint.RDBNAM) { 781 foundInPass = true; 782 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 783 rdbnam = parseRDBNAM(true); 784 peekCP = peekCodePoint(); 785 } 786 787 788 if (!foundInPass) { 789 doPrmnsprmSemantics(peekCP); 790 } 791 } 792 popCollectionStack(); 793 checkRequiredObjects(svrcodReceived, uowdspReceived); 794 795 netAgent_.setSvrcod(svrcod); 796 if (uowdsp == CodePoint.UOWDSP_COMMIT) { 797 connection.completeLocalCommit(); 798 } else { 799 connection.completeLocalRollback(); 800 } 801 } 802 803 protected void parseCMDCHKRM() throws DisconnectException { 845 boolean svrcodReceived = false; 846 int svrcod = CodePoint.SVRCOD_INFO; 847 boolean rdbnamReceived = false; 848 String rdbnam = null; 849 parseLengthAndMatchCodePoint(CodePoint.CMDCHKRM); 850 pushLengthOnCollectionStack(); 851 int peekCP = peekCodePoint(); 852 853 while (peekCP != Reply.END_OF_COLLECTION) { 854 855 boolean foundInPass = false; 856 857 if (peekCP == CodePoint.SVRCOD) { 858 foundInPass = true; 859 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 860 svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SESDMG); 861 peekCP = peekCodePoint(); 862 } 863 864 if (peekCP == CodePoint.RDBNAM) { 865 foundInPass = true; 866 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 867 rdbnam = parseRDBNAM(true); 868 peekCP = peekCodePoint(); 869 } 870 872 if (peekCP == 0x115C) { 873 foundInPass = true; 874 parseLengthAndMatchCodePoint(0x115C); 875 skipBytes(); 876 peekCP = peekCodePoint(); 877 } 878 879 if (!foundInPass) { 880 doPrmnsprmSemantics(peekCP); 881 } 882 883 } 884 popCollectionStack(); 885 checkRequiredObjects(svrcodReceived); 886 887 netAgent_.setSvrcod(svrcod); 888 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 889 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 890 msgutil_.getTextMessage(MessageId.CONN_DRDA_CMDCHKRM))); 891 } 892 893 894 void parseRDBNACRM() throws DisconnectException { 926 boolean svrcodReceived = false; 927 int svrcod = CodePoint.SVRCOD_INFO; 928 boolean rdbnamReceived = false; 929 String rdbnam = null; 930 931 parseLengthAndMatchCodePoint(CodePoint.RDBNACRM); 932 pushLengthOnCollectionStack(); 933 int peekCP = peekCodePoint(); 934 935 while (peekCP != Reply.END_OF_COLLECTION) { 936 937 boolean foundInPass = false; 938 939 if (peekCP == CodePoint.SVRCOD) { 940 foundInPass = true; 941 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 942 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 943 peekCP = peekCodePoint(); 944 } 945 946 if (peekCP == CodePoint.RDBNAM) { 947 foundInPass = true; 948 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 949 rdbnam = parseRDBNAM(true); 950 peekCP = peekCodePoint(); 951 } 952 953 if (!foundInPass) { 954 doPrmnsprmSemantics(peekCP); 955 } 956 957 } 958 popCollectionStack(); 959 checkRequiredObjects(svrcodReceived, rdbnamReceived); 960 961 netAgent_.setSvrcod(svrcod); 962 agent_.accumulateChainBreakingReadExceptionAndThrow( 963 new DisconnectException(agent_, 964 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 965 msgutil_.getTextMessage(MessageId.CONN_DRDA_RDBNACRM))); 966 } 967 968 private void parseRDBNFNRM(NetConnection netConnection) throws DisconnectException { 985 boolean svrcodReceived = false; 986 int svrcod = CodePoint.SVRCOD_INFO; 987 boolean rdbnamReceived = false; 988 String rdbnam = null; 989 990 parseLengthAndMatchCodePoint(CodePoint.RDBNFNRM); 991 pushLengthOnCollectionStack(); 992 int peekCP = peekCodePoint(); 993 994 while (peekCP != Reply.END_OF_COLLECTION) { 995 996 boolean foundInPass = false; 997 998 if (peekCP == CodePoint.SVRCOD) { 999 foundInPass = true; 1000 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1001 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1002 peekCP = peekCodePoint(); 1003 } 1004 1005 if (peekCP == CodePoint.RDBNAM) { 1006 foundInPass = true; 1007 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1008 rdbnam = parseRDBNAM(true); 1009 peekCP = peekCodePoint(); 1010 } 1011 1012 1013 if (!foundInPass) { 1014 doPrmnsprmSemantics(peekCP); 1015 } 1016 1017 } 1018 popCollectionStack(); 1019 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1020 1021 netAgent_.setSvrcod(svrcod); 1022 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1023 new ClientMessageId(SQLState.NET_DATABASE_NOT_FOUND), 1024 netConnection.databaseName_)); 1025 } 1026 1027 1028 private void parseRDBATHRM(NetConnection netConnection) throws DisconnectException { 1046 boolean svrcodReceived = false; 1047 int svrcod = CodePoint.SVRCOD_INFO; 1048 boolean rdbnamReceived = false; 1049 String rdbnam = null; 1050 1051 parseLengthAndMatchCodePoint(CodePoint.RDBATHRM); 1052 pushLengthOnCollectionStack(); 1053 int peekCP = peekCodePoint(); 1054 1055 while (peekCP != Reply.END_OF_COLLECTION) { 1056 1057 boolean foundInPass = false; 1058 1059 if (peekCP == CodePoint.SVRCOD) { 1060 foundInPass = true; 1061 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1062 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1063 peekCP = peekCodePoint(); 1064 } 1065 1066 if (peekCP == CodePoint.RDBNAM) { 1067 foundInPass = true; 1068 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1069 rdbnam = parseRDBNAM(true); 1070 peekCP = peekCodePoint(); 1071 } 1072 1073 if (!foundInPass) { 1074 doPrmnsprmSemantics(peekCP); 1075 } 1076 1077 } 1078 popCollectionStack(); 1079 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1080 1081 netAgent_.setSvrcod(svrcod); 1082 netAgent_.accumulateReadException(new SqlException(agent_.logWriter_, 1083 new ClientMessageId(SQLState.NET_CONNECT_AUTH_FAILED), 1084 msgutil_.getTextMessage(MessageId.CONN_USER_NOT_AUTHORIZED_TO_DB))); 1085 } 1086 1087 protected void parseSYNTAXRM() throws DisconnectException { 1122 boolean svrcodReceived = false; 1123 int svrcod = CodePoint.SVRCOD_INFO; 1124 boolean synerrcdReceived = false; 1125 int synerrcd = 0; 1126 boolean rdbnamReceived = false; 1127 String rdbnam = null; 1128 boolean codpntReceived = false; 1129 int codpnt = 0; 1130 1131 parseLengthAndMatchCodePoint(CodePoint.SYNTAXRM); 1132 pushLengthOnCollectionStack(); 1133 int peekCP = peekCodePoint(); 1134 1135 while (peekCP != Reply.END_OF_COLLECTION) { 1136 1137 boolean foundInPass = false; 1138 1139 if (peekCP == CodePoint.SVRCOD) { 1140 foundInPass = true; 1141 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1142 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1143 peekCP = peekCodePoint(); 1144 } 1145 1146 if (peekCP == CodePoint.SYNERRCD) { 1147 foundInPass = true; 1148 synerrcdReceived = checkAndGetReceivedFlag(synerrcdReceived); 1149 synerrcd = parseSYNERRCD(); 1150 peekCP = peekCodePoint(); 1151 } 1152 1153 if (peekCP == CodePoint.RDBNAM) { 1154 foundInPass = true; 1155 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1156 rdbnam = parseRDBNAM(true); 1157 peekCP = peekCodePoint(); 1158 } 1159 1160 if (peekCP == CodePoint.CODPNT) { 1161 foundInPass = true; 1162 codpntReceived = checkAndGetReceivedFlag(codpntReceived); 1163 codpnt = parseCODPNT(); 1164 peekCP = peekCodePoint(); 1165 } 1166 1167 1169 if (!foundInPass) { 1170 doPrmnsprmSemantics(peekCP); 1171 } 1172 } 1173 popCollectionStack(); 1174 checkRequiredObjects(svrcodReceived, synerrcdReceived); 1175 1176 netAgent_.setSvrcod(svrcod); 1177 doSyntaxrmSemantics(codpnt); 1178 } 1179 1180 private void parseRDBACCRM() throws DisconnectException { 1211 boolean svrcodReceived = false; 1212 int svrcod = CodePoint.SVRCOD_INFO; 1213 boolean rdbnamReceived = false; 1214 String rdbnam = null; 1215 1216 parseLengthAndMatchCodePoint(CodePoint.RDBACCRM); 1217 pushLengthOnCollectionStack(); 1218 int peekCP = peekCodePoint(); 1219 1220 while (peekCP != Reply.END_OF_COLLECTION) { 1221 1222 boolean foundInPass = false; 1223 1224 if (peekCP == CodePoint.SVRCOD) { 1225 foundInPass = true; 1226 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1227 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1228 peekCP = peekCodePoint(); 1229 } 1230 1231 if (peekCP == CodePoint.RDBNAM) { 1232 foundInPass = true; 1233 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1234 rdbnam = parseRDBNAM(true); 1235 peekCP = peekCodePoint(); 1236 } 1237 1238 if (!foundInPass) { 1239 doPrmnsprmSemantics(peekCP); 1240 } 1241 1242 } 1243 popCollectionStack(); 1244 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1245 1246 netAgent_.setSvrcod(svrcod); 1247 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1248 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 1249 msgutil_.getTextMessage(MessageId.CONN_DRDA_RDBACCRM))); 1250 } 1251 1252 private void parseRDBAFLRM() throws DisconnectException { 1285 boolean svrcodReceived = false; 1286 int svrcod = CodePoint.SVRCOD_INFO; 1287 boolean rdbnamReceived = false; 1288 String rdbnam = null; 1289 1290 parseLengthAndMatchCodePoint(CodePoint.RDBAFLRM); 1291 pushLengthOnCollectionStack(); 1292 int peekCP = peekCodePoint(); 1293 1294 while (peekCP != Reply.END_OF_COLLECTION) { 1295 1296 boolean foundInPass = false; 1297 1298 if (peekCP == CodePoint.SVRCOD) { 1299 foundInPass = true; 1300 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1301 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1302 peekCP = peekCodePoint(); 1303 } 1304 1305 if (peekCP == CodePoint.RDBNAM) { 1306 foundInPass = true; 1307 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1308 rdbnam = parseRDBNAM(true); 1309 peekCP = peekCodePoint(); 1310 } 1311 1312 if (!foundInPass) { 1313 doPrmnsprmSemantics(peekCP); 1314 } 1315 1316 } 1317 popCollectionStack(); 1318 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1319 1320 netAgent_.setSvrcod(svrcod); 1321 } 1322 1323 1324 protected void parseVALNSPRM() throws DisconnectException { 1380 boolean svrcodReceived = false; 1381 int svrcod = CodePoint.SVRCOD_INFO; 1382 boolean rdbnamReceived = false; 1383 String rdbnam = null; 1384 boolean codpntReceived = false; 1385 int codpnt = 0; 1386 1387 parseLengthAndMatchCodePoint(CodePoint.VALNSPRM); 1388 pushLengthOnCollectionStack(); 1389 int peekCP = peekCodePoint(); 1390 1391 while (peekCP != Reply.END_OF_COLLECTION) { 1392 1393 boolean foundInPass = false; 1394 1395 if (peekCP == CodePoint.SVRCOD) { 1396 foundInPass = true; 1397 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1398 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1399 peekCP = peekCodePoint(); 1400 } 1401 1402 if (peekCP == CodePoint.RDBNAM) { 1403 foundInPass = true; 1404 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1405 rdbnam = parseRDBNAM(true); 1406 peekCP = peekCodePoint(); 1407 } 1408 1409 if (peekCP == CodePoint.CODPNT) { 1410 foundInPass = true; 1411 codpntReceived = checkAndGetReceivedFlag(codpntReceived); 1412 codpnt = parseCODPNT(); 1413 peekCP = peekCodePoint(); 1414 } 1415 1416 1418 if (!foundInPass) { 1419 doPrmnsprmSemantics(peekCP); 1420 } 1421 1422 } 1423 popCollectionStack(); 1424 checkRequiredObjects(svrcodReceived, codpntReceived); 1425 1426 netAgent_.setSvrcod(svrcod); 1427 doValnsprmSemantics(codpnt, "\"\""); 1428 } 1429 1430 1431 protected void parsePRCCNVRM() throws DisconnectException { 1465 boolean svrcodReceived = false; 1466 int svrcod = CodePoint.SVRCOD_INFO; 1467 boolean rdbnamReceived = false; 1468 String rdbnam = null; 1469 boolean prccnvcdReceived = false; 1470 int prccnvcd = 0; 1471 1472 parseLengthAndMatchCodePoint(CodePoint.PRCCNVRM); 1473 pushLengthOnCollectionStack(); 1474 int peekCP = peekCodePoint(); 1475 1476 while (peekCP != Reply.END_OF_COLLECTION) { 1477 1478 boolean foundInPass = false; 1479 1480 if (peekCP == CodePoint.SVRCOD) { 1481 foundInPass = true; 1482 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1483 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SESDMG); 1484 peekCP = peekCodePoint(); 1485 } 1486 1487 if (peekCP == CodePoint.RDBNAM) { 1488 foundInPass = true; 1489 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1490 rdbnam = parseRDBNAM(true); 1491 peekCP = peekCodePoint(); 1492 } 1493 1494 if (peekCP == CodePoint.PRCCNVCD) { 1495 foundInPass = true; 1496 prccnvcdReceived = checkAndGetReceivedFlag(prccnvcdReceived); 1497 prccnvcd = parsePRCCNVCD(); 1498 peekCP = peekCodePoint(); 1499 } 1500 1501 if (!foundInPass) { 1502 doPrmnsprmSemantics(peekCP); 1503 } 1504 1505 } 1506 popCollectionStack(); 1507 checkRequiredObjects(svrcodReceived, prccnvcdReceived); 1508 1509 netAgent_.setSvrcod(svrcod); 1510 doPrccnvrmSemantics(CodePoint.PRCCNVRM); 1511 } 1512 1513 void parseOBJNSPRM() throws DisconnectException { 1540 boolean svrcodReceived = false; 1541 int svrcod = CodePoint.SVRCOD_INFO; 1542 boolean rdbnamReceived = false; 1543 String rdbnam = null; 1544 boolean codpntReceived = false; 1545 int codpnt = 0; 1546 1547 parseLengthAndMatchCodePoint(CodePoint.OBJNSPRM); 1548 pushLengthOnCollectionStack(); 1549 int peekCP = peekCodePoint(); 1550 1551 while (peekCP != Reply.END_OF_COLLECTION) { 1552 1553 boolean foundInPass = false; 1554 1555 if (peekCP == CodePoint.SVRCOD) { 1556 foundInPass = true; 1557 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1558 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SEVERE); 1559 peekCP = peekCodePoint(); 1560 } 1561 1562 if (peekCP == CodePoint.RDBNAM) { 1563 foundInPass = true; 1564 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1565 rdbnam = parseRDBNAM(true); 1566 peekCP = peekCodePoint(); 1567 } 1568 1569 if (peekCP == CodePoint.CODPNT) { 1570 foundInPass = true; 1571 codpntReceived = checkAndGetReceivedFlag(codpntReceived); 1572 codpnt = parseCODPNT(); 1573 peekCP = peekCodePoint(); 1574 } 1575 1576 1578 if (!foundInPass) { 1579 doPrmnsprmSemantics(peekCP); 1580 } 1581 1582 } 1583 popCollectionStack(); 1584 checkRequiredObjects(svrcodReceived, codpntReceived); 1585 1586 netAgent_.setSvrcod(svrcod); 1587 doObjnsprmSemantics(codpnt); 1588 } 1589 1590 1591 private void parseMGRLVLRM() throws DisconnectException { 1619 boolean svrcodReceived = false; 1620 int svrcod = CodePoint.SVRCOD_INFO; 1621 boolean mgrlvllsReceived = false; 1622 int[] managerCodePoint = null; 1623 int[] managerLevel = null; 1624 1625 parseLengthAndMatchCodePoint(CodePoint.MGRLVLRM); 1626 pushLengthOnCollectionStack(); 1627 int peekCP = peekCodePoint(); 1628 1629 while (peekCP != Reply.END_OF_COLLECTION) { 1630 1631 boolean foundInPass = false; 1632 1633 if (peekCP == CodePoint.SVRCOD) { 1634 foundInPass = true; 1635 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1636 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1637 peekCP = peekCodePoint(); 1638 } 1639 1640 if (peekCP == CodePoint.MGRLVLLS) { 1641 foundInPass = true; 1642 mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); 1643 1644 parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS); 1645 int managerListLength = getDdmLength(); 1646 if ((managerListLength == 0) || ((managerListLength % 7) != 0)) { 1647 doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED); 1648 } 1649 1650 int managerCount = managerListLength / 7; 1651 managerCodePoint = new int[managerCount]; 1652 managerLevel = new int[managerCount]; 1653 for (int i = 0; i < managerCount; i++) { 1654 managerCodePoint[i] = parseCODPNTDR(); 1655 managerLevel[i] = parseMGRLVLN(); 1656 } 1657 peekCP = peekCodePoint(); 1658 } 1659 1660 1661 if (!foundInPass) { 1662 doPrmnsprmSemantics(peekCP); 1663 } 1664 1665 } 1666 popCollectionStack(); 1667 checkRequiredObjects(svrcodReceived, mgrlvllsReceived); 1668 1669 netAgent_.setSvrcod(svrcod); 1670 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 1671 } 1672 1673 1674 protected void parseCMDNSPRM() throws DisconnectException { 1695 boolean svrcodReceived = false; 1696 int svrcod = CodePoint.SVRCOD_INFO; 1697 boolean rdbnamReceived = false; 1698 String rdbnam = null; 1699 boolean srvdgnReceived = false; 1700 byte[] srvdgn = null; 1701 boolean codpntReceived = false; 1702 int codpnt = 0; 1703 1704 parseLengthAndMatchCodePoint(CodePoint.CMDNSPRM); 1705 pushLengthOnCollectionStack(); 1706 int peekCP = peekCodePoint(); 1707 1708 while (peekCP != Reply.END_OF_COLLECTION) { 1709 1710 boolean foundInPass = false; 1711 1712 if (peekCP == CodePoint.SVRCOD) { 1713 foundInPass = true; 1714 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1715 svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, CodePoint.SVRCOD_ERROR); 1716 peekCP = peekCodePoint(); 1717 } 1718 1719 if (peekCP == CodePoint.RDBNAM) { 1720 foundInPass = true; 1721 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1722 rdbnam = parseRDBNAM(true); 1723 peekCP = peekCodePoint(); 1724 } 1725 1726 1727 if (peekCP == CodePoint.CODPNT) { 1728 foundInPass = true; 1729 codpntReceived = checkAndGetReceivedFlag(codpntReceived); 1730 codpnt = parseCODPNT(); 1731 peekCP = peekCodePoint(); 1732 } 1733 1734 if (!foundInPass) { 1735 doPrmnsprmSemantics(peekCP); 1736 } 1737 1738 } 1739 popCollectionStack(); 1740 checkRequiredObjects(svrcodReceived, codpntReceived); 1741 1742 netAgent_.setSvrcod(svrcod); 1743 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1744 new ClientMessageId(SQLState.DRDA_DDM_COMMAND_NOT_SUPPORTED), 1745 Integer.toHexString(codpnt))); 1746 } 1747 1748 void parseABNUOWRM() throws DisconnectException { 1764 boolean svrcodReceived = false; 1765 int svrcod = CodePoint.SVRCOD_INFO; 1766 boolean rdbnamReceived = false; 1767 String rdbnam = null; 1768 1769 parseLengthAndMatchCodePoint(CodePoint.ABNUOWRM); 1770 pushLengthOnCollectionStack(); 1771 int peekCP = peekCodePoint(); 1772 1773 while (peekCP != Reply.END_OF_COLLECTION) { 1774 1775 boolean foundInPass = false; 1776 1777 if (peekCP == CodePoint.SVRCOD) { 1778 foundInPass = true; 1779 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1780 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1781 peekCP = peekCodePoint(); 1782 } 1783 1784 if (peekCP == CodePoint.RDBNAM) { 1785 foundInPass = true; 1789 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1790 rdbnam = parseRDBNAM(true); 1791 peekCP = peekCodePoint(); 1792 } 1793 1794 if (!foundInPass) { 1795 doPrmnsprmSemantics(peekCP); 1796 } 1797 } 1798 1799 popCollectionStack(); 1800 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1801 1802 netAgent_.setSvrcod(svrcod); 1804 } 1805 1806 1808 private void parseEXCSATRD(NetConnection netConnection) throws DisconnectException { 1824 boolean extnamReceived = false; 1825 String extnam = null; 1826 boolean mgrlvllsReceived = false; 1827 boolean srvclsnmReceived = false; 1828 String srvclsnm = null; 1829 boolean srvnamReceived = false; 1830 String srvnam = null; 1831 boolean srvrlslvReceived = false; 1832 String srvrlslv = null; 1833 1834 parseLengthAndMatchCodePoint(CodePoint.EXCSATRD); 1835 pushLengthOnCollectionStack(); 1836 int peekCP = peekCodePoint(); 1837 1838 while (peekCP != Reply.END_OF_COLLECTION) { 1839 1840 boolean foundInPass = false; 1841 1842 if (peekCP == CodePoint.EXTNAM) { 1843 foundInPass = true; 1852 extnamReceived = checkAndGetReceivedFlag(extnamReceived); 1853 extnam = parseEXTNAM(); 1854 peekCP = peekCodePoint(); 1855 } 1856 1857 if (peekCP == CodePoint.MGRLVLLS) { 1858 foundInPass = true; 1862 mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); 1863 parseMGRLVLLS(netConnection); peekCP = peekCodePoint(); 1865 } 1866 1867 if (peekCP == CodePoint.SRVCLSNM) { 1868 foundInPass = true; 1871 srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived); 1872 srvclsnm = parseSRVCLSNM(); 1873 peekCP = peekCodePoint(); 1874 } 1875 1876 if (peekCP == CodePoint.SRVNAM) { 1877 foundInPass = true; 1885 srvnamReceived = checkAndGetReceivedFlag(srvnamReceived); 1886 srvnam = parseSRVNAM(); 1887 peekCP = peekCodePoint(); 1888 } 1889 1890 if (peekCP == CodePoint.SRVRLSLV) { 1891 foundInPass = true; 1897 srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived); 1898 srvrlslv = parseSRVRLSLV(); 1899 peekCP = peekCodePoint(); 1900 } 1901 1902 if (!foundInPass) { 1903 doPrmnsprmSemantics(peekCP); 1904 } 1905 1906 } 1907 popCollectionStack(); 1908 netConnection.setServerAttributeData(extnam, srvclsnm, srvnam, srvrlslv); 1910 } 1911 1912 private void parseDummyEXCSATRD(NetConnection netConnection) throws DisconnectException { 1914 boolean extnamReceived = false; 1915 String extnam = null; 1916 boolean mgrlvllsReceived = false; 1917 boolean srvclsnmReceived = false; 1918 String srvclsnm = null; 1919 boolean srvnamReceived = false; 1920 String srvnam = null; 1921 boolean srvrlslvReceived = false; 1922 String srvrlslv = null; 1923 1924 parseLengthAndMatchCodePoint(CodePoint.EXCSATRD); 1925 pushLengthOnCollectionStack(); 1926 int peekCP = peekCodePoint(); 1927 1928 while (peekCP != Reply.END_OF_COLLECTION) { 1929 1930 boolean foundInPass = false; 1931 1932 if (peekCP == CodePoint.EXTNAM) { 1933 foundInPass = true; 1942 extnamReceived = checkAndGetReceivedFlag(extnamReceived); 1943 extnam = parseEXTNAM(); 1944 peekCP = peekCodePoint(); 1945 } 1946 1947 if (peekCP == CodePoint.MGRLVLLS) { 1948 foundInPass = true; 1952 mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); 1953 parseMGRLVLLS(netConnection); peekCP = peekCodePoint(); 1955 } 1956 1957 if (peekCP == CodePoint.SRVCLSNM) { 1958 foundInPass = true; 1961 srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived); 1962 srvclsnm = parseSRVCLSNM(); 1963 peekCP = peekCodePoint(); 1964 } 1965 1966 if (peekCP == CodePoint.SRVNAM) { 1967 foundInPass = true; 1975 srvnamReceived = checkAndGetReceivedFlag(srvnamReceived); 1976 srvnam = parseSRVNAM(); 1977 peekCP = peekCodePoint(); 1978 } 1979 1980 if (peekCP == CodePoint.SRVRLSLV) { 1981 foundInPass = true; 1987 srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived); 1988 srvrlslv = parseSRVRLSLV(); 1989 peekCP = peekCodePoint(); 1990 } 1991 1992 if (!foundInPass) { 1993 doPrmnsprmSemantics(peekCP); 1994 } 1995 1996 } 1997 popCollectionStack(); 1998 } 2002 2003 private void parseACCSECRD(NetConnection netConnection, int securityMechanism) throws DisconnectException { 2015 boolean secmecReceived = false; 2016 int[] secmecList = null; 2017 boolean sectknReceived = false; 2018 byte[] sectkn = null; 2019 boolean secchkcdReceived = false; 2020 int secchkcd = 0; 2021 2022 parseLengthAndMatchCodePoint(CodePoint.ACCSECRD); 2023 pushLengthOnCollectionStack(); 2024 int peekCP = peekCodePoint(); 2025 2026 while (peekCP != Reply.END_OF_COLLECTION) { 2027 2028 boolean foundInPass = false; 2029 2030 if (peekCP == CodePoint.SECMEC) { 2031 foundInPass = true; 2044 secmecReceived = checkAndGetReceivedFlag(secmecReceived); 2045 secmecList = parseSECMEC(); 2046 peekCP = peekCodePoint(); 2047 } 2048 2049 if (peekCP == CodePoint.SECTKN) { 2050 foundInPass = true; 2052 sectknReceived = checkAndGetReceivedFlag(sectknReceived); 2053 sectkn = parseSECTKN(false); 2054 peekCP = peekCodePoint(); 2055 } 2056 2057 if (peekCP == CodePoint.SECCHKCD) { 2058 foundInPass = true; 2063 secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived); 2064 secchkcd = parseSECCHKCD(); 2065 peekCP = peekCodePoint(); 2066 } 2067 2068 if (!foundInPass) { 2069 doPrmnsprmSemantics(peekCP); 2070 } 2071 } 2072 popCollectionStack(); 2073 checkRequiredObjects(secmecReceived); 2074 2075 netConnection.setAccessSecurityData(secchkcd, 2076 securityMechanism, 2077 secmecList, 2078 sectknReceived, 2079 sectkn); 2080 } 2081 2082 void parseTYPDEFNAM() throws DisconnectException { 2084 parseLengthAndMatchCodePoint(CodePoint.TYPDEFNAM); 2085 netAgent_.targetTypdef_.setTypdefnam(readString()); 2086 } 2087 2088 void parseTYPDEFOVR() throws DisconnectException { 2090 parseLengthAndMatchCodePoint(CodePoint.TYPDEFOVR); 2091 pushLengthOnCollectionStack(); 2092 int peekCP = peekCodePoint(); 2093 2094 while (peekCP != Reply.END_OF_COLLECTION) { 2095 2096 boolean foundInPass = false; 2097 2098 if (peekCP == CodePoint.CCSIDSBC) { 2099 foundInPass = true; 2100 netAgent_.targetTypdef_.setCcsidSbc(parseCCSIDSBC()); 2101 peekCP = peekCodePoint(); 2102 } 2103 2104 if (peekCP == CodePoint.CCSIDDBC) { 2105 foundInPass = true; 2106 netAgent_.targetTypdef_.setCcsidDbc(parseCCSIDDBC()); 2107 peekCP = peekCodePoint(); 2108 } 2109 2110 if (peekCP == CodePoint.CCSIDMBC) { 2111 foundInPass = true; 2112 netAgent_.targetTypdef_.setCcsidMbc(parseCCSIDMBC()); 2113 peekCP = peekCodePoint(); 2114 } 2115 2116 if (!foundInPass) { 2117 doPrmnsprmSemantics(peekCP); 2118 } 2119 2120 } 2121 popCollectionStack(); 2122 } 2123 2124 2125 int parseSYNCCRD(ConnectionCallbackInterface connection) throws DisconnectException { 2130 return 0; 2131 } 2132 2133 protected int parseXARETVAL() throws DisconnectException { 2135 return 0; 2136 } 2137 2138 protected byte parseSYNCTYPE() throws DisconnectException { 2140 return 0; 2141 } 2142 2143 protected int parseSYNCCTLreply(ConnectionCallbackInterface connection) throws DisconnectException { 2146 return 0; 2147 } 2148 2149 void parseSYNCCTLError(int peekCP) throws DisconnectException { 2151 switch (peekCP) { 2152 case CodePoint.CMDCHKRM: 2153 parseCMDCHKRM(); 2154 break; 2155 case CodePoint.PRCCNVRM: 2156 parsePRCCNVRM(); 2157 break; 2158 case CodePoint.SYNTAXRM: 2159 parseSYNTAXRM(); 2160 break; 2161 case CodePoint.VALNSPRM: 2162 parseVALNSPRM(); 2163 break; 2164 default: 2165 doObjnsprmSemantics(peekCP); 2166 } 2167 } 2168 2169 2170 private void parseMGRLVLLS(NetConnection netConnection) throws DisconnectException { 2200 parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS); 2201 2202 int managerListLength = getDdmLength(); 2207 if ((managerListLength == 0) || ((managerListLength % 4) != 0)) { 2208 doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED); 2209 } 2210 int managerCount = managerListLength / 4; 2211 2212 2215 for (int i = 0; i < managerCount; i++) { 2217 2218 int managerCodePoint = parseCODPNTDR(); 2220 int managerLevel = parseMGRLVLN(); 2221 2222 switch (managerCodePoint) { 2225 2226 case CodePoint.AGENT: 2227 if ((managerLevel < NetConfiguration.MIN_AGENT_MGRLVL) || 2228 (managerLevel > netConnection.targetAgent_)) { 2229 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2230 } 2231 netConnection.targetAgent_ = managerLevel; 2232 break; 2233 2234 case CodePoint.CMNTCPIP: 2235 if ((managerLevel < NetConfiguration.MIN_CMNTCPIP_MGRLVL) || 2236 (managerLevel > netConnection.targetCmntcpip_)) { 2237 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2238 } 2239 netConnection.targetCmntcpip_ = managerLevel; 2240 break; 2241 2242 case CodePoint.RDB: 2243 if ((managerLevel < NetConfiguration.MIN_RDB_MGRLVL) || 2244 (managerLevel > netConnection.targetRdb_)) { 2245 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2246 } 2247 netConnection.targetRdb_ = managerLevel; 2248 break; 2249 2250 case CodePoint.SECMGR: 2251 if ((managerLevel < NetConfiguration.MIN_SECMGR_MGRLVL) || 2252 (managerLevel > netConnection.targetSecmgr_)) { 2253 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2254 } 2255 netConnection.targetSecmgr_ = managerLevel; 2256 break; 2257 2258 case CodePoint.SQLAM: 2259 if ((managerLevel < NetConfiguration.MIN_SQLAM_MGRLVL) || 2260 (managerLevel > netAgent_.targetSqlam_)) { 2261 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2262 } 2263 netAgent_.orignalTargetSqlam_ = managerLevel; 2264 break; 2265 2266 case CodePoint.CMNAPPC: 2267 if ((managerLevel < NetConfiguration.MIN_CMNAPPC_MGRLVL) || 2268 (managerLevel > netConnection.targetCmnappc_)) { 2269 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2270 } 2271 netConnection.targetCmnappc_ = managerLevel; 2272 break; 2273 2274 case CodePoint.XAMGR: 2275 if ((managerLevel != 0) && 2276 (managerLevel < NetConfiguration.MIN_XAMGR_MGRLVL) || 2277 (managerLevel > netConnection.targetXamgr_)) { 2278 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2279 } 2280 netConnection.targetXamgr_ = managerLevel; 2281 break; 2282 2283 case CodePoint.SYNCPTMGR: 2284 if ((managerLevel != 0) && 2285 (managerLevel < NetConfiguration.MIN_SYNCPTMGR_MGRLVL) || 2286 (managerLevel > netConnection.targetSyncptmgr_)) { 2287 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2288 } 2289 netConnection.targetSyncptmgr_ = managerLevel; 2290 break; 2291 2292 case CodePoint.RSYNCMGR: 2293 if ((managerLevel != 0) && 2294 (managerLevel < NetConfiguration.MIN_RSYNCMGR_MGRLVL) || 2295 (managerLevel > netConnection.targetRsyncmgr_)) { 2296 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2297 } 2298 netConnection.targetRsyncmgr_ = managerLevel; 2299 break; 2300 default: 2303 doMgrlvlrmSemantics(managerCodePoint, managerLevel); 2304 break; 2305 } 2306 } 2307 } 2308 2309 protected String parseEXTNAM() throws DisconnectException { 2318 parseLengthAndMatchCodePoint(CodePoint.EXTNAM); 2319 return readString(); 2320 } 2321 2322 protected String parseSRVCLSNM() throws DisconnectException { 2325 parseLengthAndMatchCodePoint(CodePoint.SRVCLSNM); 2326 return readString(); 2327 } 2328 2329 protected String parseSRVNAM() throws DisconnectException { 2334 parseLengthAndMatchCodePoint(CodePoint.SRVNAM); 2335 return readString(); 2336 } 2337 2338 protected String parseSRVRLSLV() throws DisconnectException { 2345 parseLengthAndMatchCodePoint(CodePoint.SRVRLSLV); 2346 return readString(); 2347 } 2348 2349 protected int parseMGRLVLN() throws DisconnectException { 2352 return readUnsignedShort(); 2353 } 2354 2355 protected int[] parseSECMEC() throws DisconnectException { 2357 parseLengthAndMatchCodePoint(CodePoint.SECMEC); 2358 return readUnsignedShortList(); 2359 } 2360 2361 protected byte[] parseSECTKN(boolean skip) throws DisconnectException { 2364 parseLengthAndMatchCodePoint(CodePoint.SECTKN); 2365 if (skip) { 2366 skipBytes(); 2367 return null; 2368 } 2369 return readBytes(); 2370 } 2371 2372 2373 protected int parseSECCHKCD() throws DisconnectException { 2376 parseLengthAndMatchCodePoint(CodePoint.SECCHKCD); 2377 int secchkcd = readUnsignedByte(); 2378 if ((secchkcd < CodePoint.SECCHKCD_00) || (secchkcd > CodePoint.SECCHKCD_15)) { 2379 doValnsprmSemantics(CodePoint.SECCHKCD, secchkcd); 2380 } 2381 return secchkcd; 2382 } 2383 2384 protected String parsePRDID(boolean skip) throws DisconnectException { 2387 parseLengthAndMatchCodePoint(CodePoint.PRDID); 2388 if (skip) { 2389 skipBytes(); 2390 return null; 2391 } else { 2392 return readString(); 2393 } 2394 } 2395 2396 protected String parseUSRID(boolean skip) throws DisconnectException { 2398 parseLengthAndMatchCodePoint(CodePoint.USRID); 2399 if (skip) { 2400 skipBytes(); 2401 return null; 2402 } 2403 return readString(); 2404 }; 2405 2406 protected int parseCODPNTDR() throws DisconnectException { 2410 return readUnsignedShort(); 2411 } 2412 2413 protected byte[] parseCRRTKN(boolean skip) throws DisconnectException { 2416 parseLengthAndMatchCodePoint(CodePoint.CRRTKN); 2417 if (skip) { 2418 skipBytes(); 2419 return null; 2420 } 2421 return readBytes(); 2422 } 2423 2424 protected int parseUOWDSP() throws DisconnectException { 2427 parseLengthAndMatchCodePoint(CodePoint.UOWDSP); 2428 int uowdsp = readUnsignedByte(); 2429 if ((uowdsp != CodePoint.UOWDSP_COMMIT) && (uowdsp != CodePoint.UOWDSP_ROLLBACK)) { 2430 doValnsprmSemantics(CodePoint.UOWDSP, uowdsp); 2431 } 2432 return uowdsp; 2433 } 2434 2435 2436 protected String parseRDBNAM(boolean skip) throws DisconnectException { 2439 parseLengthAndMatchCodePoint(CodePoint.RDBNAM); 2440 if (skip) { 2441 skipBytes(); 2442 return null; 2443 } 2444 return readString(); 2445 }; 2446 2447 2448 2449 protected int parseXIDCNT() throws DisconnectException { 2450 parseLengthAndMatchCodePoint(CodePoint.XIDCNT); 2451 return readUnsignedShort(); 2452 } 2453 2454 protected Xid parseXID() throws DisconnectException { 2455 return null; 2456 } 2457 2458 protected java.util.Hashtable parseIndoubtList() throws DisconnectException { 2459 return null; 2460 } 2461 2462 2463 protected int parseSYNERRCD() throws DisconnectException { 2466 parseLengthAndMatchCodePoint(CodePoint.SYNERRCD); 2467 int synerrcd = readUnsignedByte(); 2468 if ((synerrcd < 0x01) || (synerrcd > 0x1D)) { 2469 doValnsprmSemantics(CodePoint.SYNERRCD, synerrcd); 2470 } 2471 return synerrcd; 2472 } 2473 2474 protected int parseCODPNT() throws DisconnectException { 2476 parseLengthAndMatchCodePoint(CodePoint.CODPNT); 2477 return parseCODPNTDR(); 2478 } 2479 2480 protected int parsePRCCNVCD() throws DisconnectException { 2483 parseLengthAndMatchCodePoint(CodePoint.PRCCNVCD); 2484 int prccnvcd = readUnsignedByte(); 2485 if ((prccnvcd != 0x01) && (prccnvcd != 0x02) && (prccnvcd != 0x03) && 2486 (prccnvcd != 0x04) && (prccnvcd != 0x05) && (prccnvcd != 0x06) && 2487 (prccnvcd != 0x10) && (prccnvcd != 0x11) && (prccnvcd != 0x12) && 2488 (prccnvcd != 0x13) && (prccnvcd != 0x15)) { 2489 doValnsprmSemantics(CodePoint.PRCCNVCD, prccnvcd); 2490 } 2491 return prccnvcd; 2492 } 2493 2494 protected int parseCCSIDSBC() throws DisconnectException { 2497 parseLengthAndMatchCodePoint(CodePoint.CCSIDSBC); 2498 return readUnsignedShort(); 2499 } 2500 2501 protected int parseCCSIDMBC() throws DisconnectException { 2504 parseLengthAndMatchCodePoint(CodePoint.CCSIDMBC); 2505 return readUnsignedShort(); 2506 } 2507 2508 protected int parseCCSIDDBC() throws DisconnectException { 2511 parseLengthAndMatchCodePoint(CodePoint.CCSIDDBC); 2512 return readUnsignedShort(); 2513 } 2514 2515 protected int parseSVRCOD(int minSvrcod, int maxSvrcod) throws DisconnectException { 2518 parseLengthAndMatchCodePoint(CodePoint.SVRCOD); 2519 2520 int svrcod = readUnsignedShort(); 2521 if ((svrcod != CodePoint.SVRCOD_INFO) && 2522 (svrcod != CodePoint.SVRCOD_WARNING) && 2523 (svrcod != CodePoint.SVRCOD_ERROR) && 2524 (svrcod != CodePoint.SVRCOD_SEVERE) && 2525 (svrcod != CodePoint.SVRCOD_ACCDMG) && 2526 (svrcod != CodePoint.SVRCOD_PRMDMG) && 2527 (svrcod != CodePoint.SVRCOD_SESDMG)) { 2528 doValnsprmSemantics(CodePoint.SVRCOD, svrcod); 2529 } 2530 2531 if (svrcod < minSvrcod || svrcod > maxSvrcod) { 2532 doValnsprmSemantics(CodePoint.SVRCOD, svrcod); 2533 } 2534 2535 return svrcod; 2536 } 2537 2538 protected int parseFastSVRCOD(int minSvrcod, int maxSvrcod) throws DisconnectException { 2539 matchCodePoint(CodePoint.SVRCOD); 2540 2541 int svrcod = readFastUnsignedShort(); 2542 if ((svrcod != CodePoint.SVRCOD_INFO) && 2543 (svrcod != CodePoint.SVRCOD_WARNING) && 2544 (svrcod != CodePoint.SVRCOD_ERROR) && 2545 (svrcod != CodePoint.SVRCOD_SEVERE) && 2546 (svrcod != CodePoint.SVRCOD_ACCDMG) && 2547 (svrcod != CodePoint.SVRCOD_PRMDMG) && 2548 (svrcod != CodePoint.SVRCOD_SESDMG)) { 2549 doValnsprmSemantics(CodePoint.SVRCOD, svrcod); 2550 } 2551 2552 if (svrcod < minSvrcod || svrcod > maxSvrcod) { 2553 doValnsprmSemantics(CodePoint.SVRCOD, svrcod); 2554 } 2555 2556 return svrcod; 2557 } 2558 2559 protected NetSqlca parseSQLCARD(Sqlca[] rowsetSqlca) throws DisconnectException { 2560 parseLengthAndMatchCodePoint(CodePoint.SQLCARD); 2561 int ddmLength = getDdmLength(); 2562 ensureBLayerDataInBuffer(ddmLength); 2563 NetSqlca netSqlca = parseSQLCARDrow(rowsetSqlca); 2564 adjustLengths(getDdmLength()); 2565 return netSqlca; 2566 } 2567 2569 2575 NetSqlca parseSQLCARDrow(Sqlca[] rowsetSqlca) throws DisconnectException { 2576 return parseSQLCAGRP(rowsetSqlca); 2577 } 2578 2579 int parseSQLNUMROW() throws DisconnectException { 2585 return parseSQLNUMGRP(); 2586 } 2587 2588 int parseFastSQLNUMROW() throws DisconnectException { 2589 return parseFastSQLNUMGRP(); 2590 } 2591 2592 private int parseSQLNUMGRP() throws DisconnectException { 2598 return readShort(); 2599 } 2600 2601 private int parseFastSQLNUMGRP() throws DisconnectException { 2602 return readFastShort(); 2603 } 2604 2605 private NetSqlca parseSQLCAGRP(Sqlca[] rowsetSqlca) throws DisconnectException { 2621 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2622 return null; 2623 } 2624 2625 int sqlcode = readFastInt(); 2626 byte[] sqlstate = readFastBytes(5); 2627 byte[] sqlerrproc = readFastBytes(8); 2628 NetSqlca netSqlca = null; 2629 2630 try 2631 { 2632 netSqlca = new NetSqlca(netAgent_.netConnection_, 2633 sqlcode, 2634 sqlstate, 2635 sqlerrproc); 2636 } 2637 catch(SqlException sqle) 2638 { 2639 throw new DisconnectException(netAgent_,sqle); 2640 } 2641 parseSQLCAXGRP(netSqlca); 2642 2643 if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) { 2644 netSqlca.setRowsetRowCount(parseSQLDIAGGRP(rowsetSqlca)); 2645 } 2646 2647 return netSqlca; 2648 } 2649 2650 private void parseSQLCAXGRP(NetSqlca netSqlca) throws DisconnectException { 2697 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2698 netSqlca.setContainsSqlcax(false); 2699 return; 2700 } 2701 2702 if (netAgent_.targetSqlam_ < NetConfiguration.MGRLVL_7) { 2703 skipFastBytes(18); 2706 } 2707 int[] sqlerrd = new int[6]; 2709 readFastIntArray(sqlerrd); 2710 2711 byte[] sqlwarn = readFastBytes(11); 2713 2714 if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) { 2715 parseFastVCS(); 2718 } 2719 2720 2721 int sqlerrmcCcsid = 0; 2722 byte[] sqlerrmc = readFastLDBytes(); 2723 if (sqlerrmc != null) { 2724 sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidMbc(); 2725 skipFastBytes(2); 2726 } else { 2727 sqlerrmc = readFastLDBytes(); 2728 sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidSbc(); 2729 } 2730 2731 netSqlca.setSqlerrd(sqlerrd); 2732 netSqlca.setSqlwarnBytes(sqlwarn); 2733 netSqlca.setSqlerrmcBytes(sqlerrmc, sqlerrmcCcsid); } 2735 2736 private long parseSQLDIAGGRP(Sqlca[] rowsetSqlca) throws DisconnectException { 2743 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2744 return 0; 2745 } 2746 2747 long row_count = parseSQLDIAGSTT(rowsetSqlca); 2748 parseSQLDIAGCI(rowsetSqlca); 2749 parseSQLDIAGCN(); 2750 2751 return row_count; 2752 } 2753 2754 protected String parseFastVCS() throws DisconnectException { 2758 return readFastString(readFastUnsignedShort(), 2760 netAgent_.targetTypdef_.getCcsidSbcEncoding()); 2761 } 2762 2764 protected boolean checkAndGetReceivedFlag(boolean receivedFlag) throws DisconnectException { 2765 if (receivedFlag) { 2766 doSyntaxrmSemantics(CodePoint.SYNERRCD_DUP_OBJ_PRESENT); 2769 } 2770 return true; 2771 } 2772 2773 protected void checkRequiredObjects(boolean receivedFlag) throws DisconnectException { 2774 if (!receivedFlag) { 2775 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2776 } 2777 } 2778 2779 protected void checkRequiredObjects(boolean receivedFlag, 2780 boolean receivedFlag2) throws DisconnectException { 2781 if (!receivedFlag || !receivedFlag2) { 2782 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2783 } 2784 } 2785 2786 protected void checkRequiredObjects(boolean receivedFlag, 2787 boolean receivedFlag2, 2788 boolean receivedFlag3) throws DisconnectException { 2789 if (!receivedFlag || !receivedFlag2 || !receivedFlag3) { 2790 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2791 } 2792 } 2793 2794 protected void checkRequiredObjects(boolean receivedFlag, 2795 boolean receivedFlag2, 2796 boolean receivedFlag3, 2797 boolean receivedFlag4) throws DisconnectException { 2798 if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4) { 2799 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2800 } 2801 } 2802 2803 protected void checkRequiredObjects(boolean receivedFlag, 2804 boolean receivedFlag2, 2805 boolean receivedFlag3, 2806 boolean receivedFlag4, 2807 boolean receivedFlag5, 2808 boolean receivedFlag6) throws DisconnectException { 2809 if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4 || 2810 !receivedFlag5 || !receivedFlag6) { 2811 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2812 } 2813 2814 } 2815 2816 protected void checkRequiredObjects(boolean receivedFlag, 2817 boolean receivedFlag2, 2818 boolean receivedFlag3, 2819 boolean receivedFlag4, 2820 boolean receivedFlag5, 2821 boolean receivedFlag6, 2822 boolean receivedFlag7) throws DisconnectException { 2823 if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4 || 2824 !receivedFlag5 || !receivedFlag6 || !receivedFlag7) { 2825 doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); 2826 } 2827 } 2828 2829 2833 protected void doObjnsprmSemantics(int codePoint) throws DisconnectException { 2834 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2835 new ClientMessageId(SQLState.DRDA_DDM_OBJECT_NOT_SUPPORTED), 2836 Integer.toHexString(codePoint))); 2837 } 2838 2839 protected void doPrmnsprmSemantics(int codePoint) throws DisconnectException { 2841 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2842 new ClientMessageId(SQLState.DRDA_DDM_PARAM_NOT_SUPPORTED), 2843 Integer.toHexString(codePoint))); 2844 } 2845 2846 void doValnsprmSemantics(int codePoint, int value) throws DisconnectException { 2848 doValnsprmSemantics(codePoint, Integer.toString(value)); 2849 } 2850 2851 void doValnsprmSemantics(int codePoint, String value) throws DisconnectException { 2852 2853 if (codePoint == CodePoint.FDODTA) { 2855 agent_.accumulateReadException(new SqlException(agent_.logWriter_, 2856 new ClientMessageId(SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED), 2857 Integer.toHexString(codePoint))); 2858 return; 2859 } 2860 2861 if (codePoint == CodePoint.CCSIDSBC || 2862 codePoint == CodePoint.CCSIDDBC || 2863 codePoint == CodePoint.CCSIDMBC) { 2864 int cpValue = 0; 2871 switch (codePoint) { 2872 case CodePoint.CCSIDSBC: 2873 cpValue = netAgent_.typdef_.getCcsidSbc(); 2874 break; 2875 case CodePoint.CCSIDDBC: 2876 cpValue = netAgent_.typdef_.getCcsidDbc(); 2877 break; 2878 case CodePoint.CCSIDMBC: 2879 cpValue = netAgent_.typdef_.getCcsidSbc(); 2880 break; 2881 default: 2882 cpValue = 0; 2884 break; 2885 } 2886 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2887 new ClientMessageId(SQLState.DRDA_NO_AVAIL_CODEPAGE_CONVERSION), 2888 new Integer (cpValue), value)); 2889 return; 2890 } 2891 2893 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2896 new ClientMessageId(SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED), 2897 Integer.toHexString(codePoint))); 2898 } 2899 2900 void doDtamchrmSemantics() throws DisconnectException { 2901 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2902 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 2903 msgutil_.getTextMessage(MessageId.CONN_DRDA_DTARMCHRM))); 2904 } 2905 2906 private void doMgrlvlrmSemantics(String manager, String level) throws DisconnectException { 2921 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2922 new ClientMessageId(SQLState.DRDA_MGRLVLRM), 2923 manager, level)); 2924 } 2925 2926 private void doMgrlvlrmSemantics(int manager, int level) throws DisconnectException { 2927 doMgrlvlrmSemantics("0x" + Integer.toHexString(manager), 2928 "0x" + Integer.toHexString(level)); 2929 } 2930 2931 private void doMgrlvlrmSemantics(int[] nameList, int[] levelList) throws DisconnectException { 2932 StringBuffer managerNames = new StringBuffer (100); 2933 StringBuffer managerLevels = new StringBuffer (100); 2934 2935 int count = nameList.length; 2936 for (int i = 0; i < count; i++) { 2937 managerNames.append("0x"); 2938 managerNames.append(nameList[i]); 2939 managerLevels.append("0x"); 2940 managerLevels.append(levelList[i]); 2941 if (i != (count - 1)) { 2942 managerNames.append(","); 2943 managerLevels.append(","); 2944 } 2945 } 2946 doMgrlvlrmSemantics(managerNames.toString(), managerLevels.toString()); 2947 } 2948 2949 protected void doPrccnvrmSemantics(int conversationProtocolErrorCode) throws DisconnectException { 2997 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 3000 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 3001 msgutil_.getTextMessage(MessageId.CONN_DRDA_PRCCNVRM, 3002 Integer.toHexString(conversationProtocolErrorCode)))); 3003 } 3004 3005 void parseSQLDCTOKS() throws DisconnectException { 3009 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 3010 return; 3011 } 3012 int num = parseFastSQLNUMROW(); 3013 for (int i = 0; i < num; i++) { 3014 parseSQLTOKROW(); 3015 } 3016 } 3017 3018 private void parseSQLDIAGCI(Sqlca[] rowsetSqlca) throws DisconnectException { 3022 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 3023 return; 3024 } 3025 int num = parseFastSQLNUMROW(); 3026 if (num == 0) { 3027 resetRowsetSqlca(rowsetSqlca, 0); 3028 } 3029 3030 int lastRow = 1; 3032 for (int i = 0; i < num; i++) { 3033 lastRow = parseSQLDCROW(rowsetSqlca, lastRow); 3034 } 3035 resetRowsetSqlca(rowsetSqlca, lastRow + 1); 3036 } 3037 3038 private void parseSQLDIAGCN() throws DisconnectException { 3042 if (readUnsignedByte() == CodePoint.NULLDATA) { 3043 return; 3044 } 3045 int num = parseFastSQLNUMROW(); 3046 for (int i = 0; i < num; i++) { 3047 parseSQLCNROW(); 3048 } 3049 } 3050 3051 private void parseSQLCNROW() throws DisconnectException { 3054 parseSQLCNGRP(); 3055 } 3056 3057 private int parseSQLDCROW(Sqlca[] rowsetSqlca, int lastRow) throws DisconnectException { 3060 return parseSQLDCGRP(rowsetSqlca, lastRow); 3061 } 3062 3063 private void parseSQLTOKROW() throws DisconnectException { 3066 parseSQLTOKGRP(); 3067 } 3068 3069 private void parseSQLTOKGRP() throws DisconnectException { 3071 skipFastNVCMorNVCS(); 3072 } 3073 3074 private long parseSQLDIAGSTT(Sqlca[] rowsetSqlca) throws DisconnectException { 3095 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 3096 return 0; 3097 } 3098 int sqldsFcod = readFastInt(); int sqldsCost = readFastInt(); int sqldsLrow = readFastInt(); 3102 skipFastBytes(16); 3103 3104 long sqldsRowc = readFastLong(); 3106 skipFastBytes(24); 3107 3108 return sqldsRowc; 3109 } 3110 3111 private void parseSQLCNGRP() throws DisconnectException { 3123 skipBytes(18); 3124 String sqlcnRDB = parseFastVCS(); String sqlcnClass = parseFastVCS(); String sqlcnAuthid = parseFastVCS(); } 3128 3129 private int parseSQLDCGRP(Sqlca[] rowsetSqlca, int lastRow) throws DisconnectException { 3157 int sqldcCode = readFastInt(); String sqldcState = readFastString(5, Typdef.UTF8ENCODING); int sqldcReason = readFastInt(); int sqldcLinen = readFastInt(); int sqldcRown = (int) readFastLong(); 3163 if (sqldcCode == 20237) { 3168 rowsetSqlca[0] = new NetSqlca(netAgent_.netConnection_, 3169 sqldcCode, 3170 sqldcState, 3171 null); 3172 } else { 3173 if (rowsetSqlca[sqldcRown] != null) { 3174 rowsetSqlca[sqldcRown].resetRowsetSqlca(netAgent_.netConnection_, 3175 sqldcCode, 3176 sqldcState, 3177 null); 3178 } else { 3179 rowsetSqlca[sqldcRown] = new NetSqlca(netAgent_.netConnection_, 3180 sqldcCode, 3181 sqldcState, 3182 null); 3183 } 3184 } 3185 3186 for (int i = lastRow + 1; i < sqldcRown; i++) { 3188 rowsetSqlca[i] = null; 3189 } 3190 3191 skipFastBytes(47); 3192 String sqldcRdb = parseFastVCS(); parseSQLDCTOKS(); String sqldcMsg = parseFastNVCMorNVCS(); 3197 skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); 3202 parseSQLDCXGRP(); return sqldcRown; 3204 } 3205 3206 private void parseSQLDCXGRP() throws DisconnectException { 3239 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 3240 return; 3241 } 3242 skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); String sqldcxCrdb = parseFastVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); parseFastVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); parseFastVCS(); skipFastNVCMorNVCS(); skipFastNVCMorNVCS(); } 3256 3257 private String parseFastNVCMorNVCS() throws DisconnectException { 3258 String stringToBeSet = null; 3259 int vcm_length = 0; 3260 int vcs_length = 0; 3261 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3262 vcm_length = readFastUnsignedShort(); 3263 if (vcm_length > 0) { 3264 stringToBeSet = readFastString(vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding()); 3265 } 3266 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3267 agent_.accumulateChainBreakingReadExceptionAndThrow( 3268 new DisconnectException(agent_, 3269 new ClientMessageId( 3270 SQLState.NET_NVCM_NVCS_BOTH_NON_NULL))); 3271 } 3272 } else { 3273 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3274 vcs_length = readFastUnsignedShort(); 3275 if (vcs_length > 0) { 3276 stringToBeSet = readFastString(vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding()); 3277 } 3278 } 3279 } 3280 return stringToBeSet; 3281 } 3282 3283 private void skipFastNVCMorNVCS() throws DisconnectException { 3284 int vcm_length = 0; 3285 int vcs_length = 0; 3286 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3287 vcm_length = readFastUnsignedShort(); 3288 if (vcm_length > 0) 3289 { 3291 skipFastBytes(vcm_length); 3292 } 3293 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3294 agent_.accumulateChainBreakingReadExceptionAndThrow( 3295 new DisconnectException(agent_, 3296 new ClientMessageId( 3297 SQLState.NET_NVCM_NVCS_BOTH_NON_NULL))); 3298 } 3299 } else { 3300 if (readFastUnsignedByte() != CodePoint.NULLDATA) { 3301 vcs_length = readFastUnsignedShort(); 3302 if (vcs_length > 0) 3303 { 3305 skipFastBytes(vcs_length); 3306 } 3307 } 3308 } 3309 } 3310 3311 void resetRowsetSqlca(Sqlca[] rowsetSqlca, int row) { 3312 int count = ((rowsetSqlca == null) ? 0 : rowsetSqlca.length); 3314 for (int i = row; i < count; i++) { 3315 rowsetSqlca[i] = null; 3316 } 3317 } 3318} 3319 3320 3321 3322 | Popular Tags |