1 18 19 package jcifs.netbios; 20 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 24 public class SessionRequestPacket extends SessionServicePacket { 25 26 private Name calledName, callingName; 27 28 SessionRequestPacket() { 29 calledName = new Name(); 30 callingName = new Name(); 31 } 32 public SessionRequestPacket( Name calledName, Name callingName ) { 33 type = SESSION_REQUEST; 34 this.calledName = calledName; 35 this.callingName = callingName; 36 } 37 int writeTrailerWireFormat( byte[] dst, int dstIndex ) { 38 int start = dstIndex; 39 dstIndex += calledName.writeWireFormat( dst, dstIndex ); 40 dstIndex += callingName.writeWireFormat( dst, dstIndex ); 41 return dstIndex - start; 42 } 43 int readTrailerWireFormat( InputStream in, 44 byte[] buffer, 45 int bufferIndex ) 46 throws IOException { 47 int start = bufferIndex; 48 if( in.read( buffer, bufferIndex, length ) != length ) { 49 throw new IOException ( "invalid session request wire format" ); 50 } 51 bufferIndex += calledName.readWireFormat( buffer, bufferIndex ); 52 bufferIndex += callingName.readWireFormat( buffer, bufferIndex ); 53 return bufferIndex - start; 54 } 55 } 56 | Popular Tags |