FileDocCategorySizeDatePackage
SessionServicePacket.javaAPI DocJCIFS 1.3.17 API4996Tue Oct 18 15:26:24 BST 2011jcifs.netbios

SessionServicePacket

public abstract class SessionServicePacket extends Object

Fields Summary
static final int
SESSION_MESSAGE
static final int
SESSION_REQUEST
public static final int
POSITIVE_SESSION_RESPONSE
public static final int
NEGATIVE_SESSION_RESPONSE
static final int
SESSION_RETARGET_RESPONSE
static final int
SESSION_KEEP_ALIVE
static final int
MAX_MESSAGE_SIZE
static final int
HEADER_LENGTH
int
type
int
length
Constructors Summary
Methods Summary
intreadHeaderWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)

        type = buffer[bufferIndex++] & 0xFF;
        length = (( buffer[bufferIndex] & 0x01 ) << 16 ) + readInt2( buffer, bufferIndex + 1 );
        return HEADER_LENGTH;
    
static intreadInt2(byte[] src, int srcIndex)

        return (( src[srcIndex] & 0xFF ) << 8 ) +
                ( src[srcIndex + 1] & 0xFF );
    
static intreadInt4(byte[] src, int srcIndex)

        return (( src[srcIndex] & 0xFF ) << 24 ) +
                (( src[srcIndex + 1] & 0xFF ) << 16 ) +
                (( src[srcIndex + 2] & 0xFF ) << 8 ) +
                ( src[srcIndex + 3] & 0xFF );
    
static intreadLength(byte[] src, int srcIndex)

        srcIndex++;
        return (( src[srcIndex++] & 0x01 ) << 16 ) +
                (( src[srcIndex++] & 0xFF ) << 8 ) +
                ( src[srcIndex++] & 0xFF );
    
static intreadPacketType(java.io.InputStream in, byte[] buffer, int bufferIndex)

        int n;
        if(( n = readn( in, buffer, bufferIndex, HEADER_LENGTH )) != HEADER_LENGTH ) {
            if( n == -1 ) {
                return -1;
            }
            throw new IOException( "unexpected EOF reading netbios session header" );
        }
        int t = buffer[bufferIndex] & 0xFF;
        return t;
    
abstract intreadTrailerWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)

intreadWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)

        readHeaderWireFormat( in, buffer, bufferIndex );
        return HEADER_LENGTH + readTrailerWireFormat( in, buffer, bufferIndex );
    
static intreadn(java.io.InputStream in, byte[] b, int off, int len)

        int i = 0, n;

        while (i < len) {
            n = in.read( b, off + i, len - i );
            if (n <= 0) {
                break;
            }
            i += n;
        }

        return i;
    
intwriteHeaderWireFormat(byte[] dst, int dstIndex)

        dst[dstIndex++] = (byte)type;
        if( length > 0x0000FFFF ) {
            dst[dstIndex] = (byte)0x01;
        }
        dstIndex++;
        writeInt2( length, dst, dstIndex );
        return HEADER_LENGTH;
    
static voidwriteInt2(int val, byte[] dst, int dstIndex)


              
        dst[dstIndex++] = (byte)(( val >> 8 ) & 0xFF );
        dst[dstIndex] = (byte)( val & 0xFF );
    
static voidwriteInt4(int val, byte[] dst, int dstIndex)

        dst[dstIndex++] = (byte)(( val >> 24 ) & 0xFF );
        dst[dstIndex++] = (byte)(( val >> 16 ) & 0xFF );
        dst[dstIndex++] = (byte)(( val >> 8 ) & 0xFF );
        dst[dstIndex] = (byte)( val & 0xFF );
    
abstract intwriteTrailerWireFormat(byte[] dst, int dstIndex)

public intwriteWireFormat(byte[] dst, int dstIndex)

        length = writeTrailerWireFormat( dst, dstIndex + HEADER_LENGTH );
        writeHeaderWireFormat( dst, dstIndex );
        return HEADER_LENGTH + length;