1 17 package org.alfresco.filesys.smb.server; 18 19 import org.alfresco.filesys.smb.PacketType; 20 import org.alfresco.filesys.smb.TransactBuffer; 21 import org.alfresco.filesys.util.DataBuffer; 22 import org.alfresco.filesys.util.DataPacker; 23 24 29 class SrvTransactBuffer extends TransactBuffer 30 { 31 32 39 public SrvTransactBuffer(int slen, int plen, int dlen) 40 { 41 super(slen, plen, dlen); 42 } 43 44 52 public SrvTransactBuffer(SrvTransactBuffer tbuf) 53 { 54 super(tbuf.getReturnSetupLimit(), tbuf.getReturnParameterLimit(), tbuf.getReturnDataLimit()); 55 56 58 setReturnLimits(tbuf.getReturnSetupLimit(), tbuf.getReturnParameterLimit(), tbuf.getReturnDataLimit()); 59 60 62 setType(tbuf.isType()); 63 64 66 setTreeId(tbuf.getTreeId()); 67 } 68 69 74 public SrvTransactBuffer(NTTransPacket ntpkt) 75 { 76 77 79 super(0, 0, 0); 80 81 83 setTreeId(ntpkt.getTreeId()); 84 85 87 int slen = ntpkt.getSetupCount() * 2; 88 if (slen > 0) 89 m_setupBuf = new DataBuffer(ntpkt.getBuffer(), ntpkt.getSetupOffset(), slen); 90 91 93 int plen = ntpkt.getTotalParameterCount(); 94 if (plen > 0) 95 m_paramBuf = new DataBuffer(ntpkt.getBuffer(), ntpkt.getParameterBlockOffset(), plen); 96 97 99 int dlen = ntpkt.getDataBlockCount(); 100 if (dlen > 0) 101 m_dataBuf = new DataBuffer(ntpkt.getBuffer(), ntpkt.getDataBlockOffset(), dlen); 102 103 105 setType(ntpkt.getCommand()); 106 setFunction(ntpkt.getNTFunction()); 107 108 110 setReturnParameterLimit(ntpkt.getMaximumParameterReturn()); 111 setReturnDataLimit(ntpkt.getMaximumDataReturn()); 112 113 115 setUnicode(ntpkt.isUnicode()); 116 117 119 m_multi = false; 120 } 121 122 127 public SrvTransactBuffer(SMBSrvTransPacket tpkt) 128 { 129 130 132 super(0, 0, 0); 133 134 136 setTreeId(tpkt.getTreeId()); 137 138 140 int slen = tpkt.getSetupCount() * 2; 141 if (slen > 0) 142 m_setupBuf = new DataBuffer(tpkt.getBuffer(), tpkt.getSetupOffset(), slen); 143 144 146 int plen = tpkt.getTotalParameterCount(); 147 if (plen > 0) 148 m_paramBuf = new DataBuffer(tpkt.getBuffer(), tpkt.getRxParameterBlock(), plen); 149 150 152 int dlen = tpkt.getRxDataBlockLength(); 153 if (dlen > 0) 154 m_dataBuf = new DataBuffer(tpkt.getBuffer(), tpkt.getRxDataBlock(), dlen); 155 156 158 setType(tpkt.getCommand()); 159 160 if (tpkt.getSetupCount() > 0) 161 setFunction(tpkt.getSetupParameter(0)); 162 163 165 setUnicode(tpkt.isUnicode()); 166 167 169 if (isType() == PacketType.Transaction) 170 { 171 172 174 int pos = tpkt.getByteOffset(); 175 byte[] buf = tpkt.getBuffer(); 176 177 if (isUnicode()) 178 pos = DataPacker.wordAlign(pos); 179 180 setName(DataPacker.getString(buf, pos, 64, isUnicode())); 181 } 182 else 183 setName(""); 184 185 187 m_multi = false; 188 } 189 } 190 | Popular Tags |