network

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnReset = errors.New("connection break due to context timeout")

Functions

This section is empty.

Types

type AcceptPacket

type AcceptPacket struct {
	Packet
	// contains filtered or unexported fields
}

type AcceptPacket Packet

type BindError

type BindError struct {
	// contains filtered or unexported fields
}

type ConnectPacket

type ConnectPacket struct {
	Packet
	// contains filtered or unexported fields
}

type ConnectPacket Packet

type DataPacket

type DataPacket struct {
	Packet
	// contains filtered or unexported fields
}

type MarkerPacket

type MarkerPacket struct {
	Packet
	// contains filtered or unexported fields
}

type MemorySession

type MemorySession struct {
	// contains filtered or unexported fields
}

func NewMemorySession

func NewMemorySession(inputBuffer, outputBuffer []byte, sessionProp SessionProperties) *MemorySession

func (*MemorySession) GetByte

func (session *MemorySession) GetByte() (uint8, error)

GetByte read one uint8 from input buffer

func (*MemorySession) GetBytes

func (session *MemorySession) GetBytes(length int) ([]byte, error)

GetBytes read specified number of bytes from input buffer

func (*MemorySession) GetClr

func (session *MemorySession) GetClr() (output []byte, err error)

GetClr reed variable length bytearray from input buffer

func (*MemorySession) GetDlc

func (session *MemorySession) GetDlc() (output []byte, err error)

GetDlc read variable length bytearray from input buffer

func (*MemorySession) GetFixedClr

func (session *MemorySession) GetFixedClr() ([]byte, error)

func (*MemorySession) GetInt

func (session *MemorySession) GetInt(size int, compress bool, bigEndian bool) (int, error)

GetInt read int number from input buffer. you should specify the size of the int and either compress or not and stored as big endian or not

func (*MemorySession) GetInt64

func (session *MemorySession) GetInt64(size int, compress bool, bigEndian bool) (int64, error)

GetInt64 read int64 number from input buffer. you should specify the size of the int and either compress or not and stored as big endian or not

func (*MemorySession) GetKeyVal

func (session *MemorySession) GetKeyVal() (key []byte, val []byte, num int, err error)

GetKeyVal read key, value (in form of bytearray), a number flag from input buffer

func (*MemorySession) GetNullTermString

func (session *MemorySession) GetNullTermString() (result string, err error)

GetNullTermString read a null terminated string from input buffer

func (*MemorySession) GetProperties

func (ms *MemorySession) GetProperties() SessionProperties

func (*MemorySession) GetString

func (session *MemorySession) GetString(length int) (string, error)

GetString read a string data from input buffer

func (*MemorySession) GetWriteBuffer

func (session *MemorySession) GetWriteBuffer() []byte

func (*MemorySession) Peek

func (session *MemorySession) Peek() (byte, error)

func (*MemorySession) PutBytes

func (session *MemorySession) PutBytes(data ...byte)

PutBytes write bytes of data to output buffer

func (*MemorySession) PutCHR

func (session *MemorySession) PutCHR(data []byte)

func (*MemorySession) PutClr

func (session *MemorySession) PutClr(data []byte)

PutClr write variable length bytearray to output buffer

func (*MemorySession) PutDlc

func (session *MemorySession) PutDlc(data []byte)

func (*MemorySession) PutFixedClr

func (session *MemorySession) PutFixedClr(data []byte)

func (*MemorySession) PutInt

func (session *MemorySession) PutInt(number interface{}, size uint8, bigEndian bool, compress bool)

PutInt write int number with size entered either use bigEndian or not and use compression or not to

func (*MemorySession) PutKeyVal

func (session *MemorySession) PutKeyVal(key []byte, val []byte, num uint8)

PutKeyVal write key, val (in form of bytearray) and flag number to output buffer

func (*MemorySession) PutKeyValString

func (session *MemorySession) PutKeyValString(key string, val string, num uint8)

PutKeyValString write key, val (in form of string) and flag number to output buffer

func (*MemorySession) PutString

func (session *MemorySession) PutString(data string)

PutString write a string data to output buffer

func (*MemorySession) PutTTCFunc

func (session *MemorySession) PutTTCFunc(ttcCode, funcCode uint8)

PutTTCFunc write bytes that represent ttc function with specific code

func (*MemorySession) PutUint

func (session *MemorySession) PutUint(number interface{}, size uint8, bigEndian, compress bool)

PutUint write uint number with size entered either use bigEndian or not and use compression or not to

func (*MemorySession) ResetBuffer

func (ms *MemorySession) ResetBuffer()

func (*MemorySession) Write

func (ms *MemorySession) Write() error

type OracleError

type OracleError struct {
	ErrCode int
	ErrMsg  string
	// contains filtered or unexported fields
}

func NewOracleError

func NewOracleError(errCode int) *OracleError

func (*OracleError) Bad

func (err *OracleError) Bad() bool

func (*OracleError) ErrPos

func (err *OracleError) ErrPos() int

ErrPos return sql error position。

func (*OracleError) Error

func (err *OracleError) Error() string

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

type PacketInterface

type PacketInterface interface {
	// contains filtered or unexported methods
}

type PacketType

type PacketType uint8
const (
	CONNECT  PacketType = 1
	ACCEPT   PacketType = 2
	ACK      PacketType = 3
	REFUSE   PacketType = 4
	REDIRECT PacketType = 5
	DATA     PacketType = 6
	NULL     PacketType = 7
	ABORT    PacketType = 9
	RESEND   PacketType = 11
	MARKER   PacketType = 12
	ATTN     PacketType = 13
	CTRL     PacketType = 14
	HIGHEST  PacketType = 19
)

type RedirectPacket

type RedirectPacket struct {
	Packet
	// contains filtered or unexported fields
}

type RefusePacket

type RefusePacket struct {
	Packet
	Err          *OracleError
	SystemReason uint8
	UserReason   uint8
	// contains filtered or unexported fields
}

type Session

type Session struct {
	Context *SessionContext

	TimeZone          []byte
	HasEOSCapability  bool
	HasFSAPCapability bool
	Summary           *SummaryObject

	StrConv converters.IStringConverter

	Connected bool
	SSL       struct {
		CertificateRequest []*x509.CertificateRequest
		PrivateKeys        []*rsa.PrivateKey
		Certificates       []*x509.Certificate
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

func NewSession

func NewSession(config *configurations.ConnectionConfig, tracer trace.Tracer) *Session

func NewSessionWithInputBufferForDebug

func NewSessionWithInputBufferForDebug(input []byte) *Session

func (*Session) BreakConnection

func (session *Session) BreakConnection() error

BreakConnection elicit connection break to cancel the current operation

func (*Session) Connect

func (session *Session) Connect(ctx context.Context) error

Connect perform network connection on address:port check if the client need to use SSL then send connect packet to the server and receive either accept, redirect or refuse packet

func (*Session) Disconnect

func (session *Session) Disconnect()

Disconnect close the network and release resources

func (*Session) EndContext

func (session *Session) EndContext(done chan struct{})

func (*Session) GetByte

func (session *Session) GetByte() (uint8, error)

GetByte read one uint8 from input buffer

func (*Session) GetBytes

func (session *Session) GetBytes(length int) ([]byte, error)

GetBytes read specified number of bytes from input buffer

func (*Session) GetClr

func (session *Session) GetClr() (output []byte, err error)

GetClr reed variable length bytearray from input buffer

func (*Session) GetDlc

func (session *Session) GetDlc() (output []byte, err error)

GetDlc read variable length bytearray from input buffer

func (*Session) GetError

func (session *Session) GetError() *OracleError

GetError Return the error in form or OracleError

func (*Session) GetFixedClr

func (session *Session) GetFixedClr() ([]byte, error)

func (*Session) GetInt

func (session *Session) GetInt(size int, compress bool, bigEndian bool) (int, error)

GetInt read int number from input buffer. you should specify the size of the int and either compress or not and stored as big endian or not

func (*Session) GetInt64

func (session *Session) GetInt64(size int, compress bool, bigEndian bool) (int64, error)

GetInt64 read int64 number from input buffer. you should specify the size of the int and either compress or not and stored as big endian or not

func (*Session) GetKeyVal

func (session *Session) GetKeyVal() (key []byte, val []byte, num int, err error)

GetKeyVal read key, value (in form of bytearray), a number flag from input buffer

func (*Session) GetNullTermString

func (session *Session) GetNullTermString() (result string, err error)

GetNullTermString read a null terminated string from input buffer

func (*Session) GetProperties

func (session *Session) GetProperties() SessionProperties

func (*Session) GetString

func (session *Session) GetString(length int) (string, error)

GetString read a string data from input buffer

func (*Session) GetWriteBuffer

func (session *Session) GetWriteBuffer() []byte

func (*Session) HasError

func (session *Session) HasError() bool

HasError Check if the session has error or not

func (*Session) IsBreak

func (session *Session) IsBreak() bool

IsBreak tell if the connection break elicit

func (*Session) LoadSSLData

func (session *Session) LoadSSLData(certs, keys, certRequests [][]byte) error

LoadSSLData load data required for SSL connection like certificate, private keys and certificate requests

func (*Session) LoadState

func (session *Session) LoadState() (oldState *SessionState)

LoadState load last saved session state and return the current state if this is the only session state available set session state memory to nil

func (*Session) Peek

func (session *Session) Peek() (byte, error)

func (*Session) PutBytes

func (session *Session) PutBytes(data ...byte)

PutBytes write bytes of data to output buffer

func (*Session) PutCHR

func (session *Session) PutCHR(data []byte)

func (*Session) PutClr

func (session *Session) PutClr(data []byte)

PutClr write variable length bytearray to output buffer

func (*Session) PutDlc

func (session *Session) PutDlc(data []byte)

func (*Session) PutFixedClr

func (session *Session) PutFixedClr(data []byte)

func (*Session) PutInt

func (session *Session) PutInt(number interface{}, size uint8, bigEndian bool, compress bool)

PutInt write int number with size entered either use bigEndian or not and use compression or not to

func (*Session) PutKeyVal

func (session *Session) PutKeyVal(key []byte, val []byte, num uint8)

PutKeyVal write key, val (in form of bytearray) and flag number to output buffer

func (*Session) PutKeyValString

func (session *Session) PutKeyValString(key string, val string, num uint8)

PutKeyValString write key, val (in form of string) and flag number to output buffer

func (*Session) PutString

func (session *Session) PutString(data string)

PutString write a string data to output buffer

func (*Session) PutTTCFunc

func (session *Session) PutTTCFunc(ttcCode, funcCode uint8)

PutTTCFunc write bytes that represent ttc function with specific code

func (*Session) PutUint

func (session *Session) PutUint(number interface{}, size uint8, bigEndian, compress bool)

PutUint write uint number with size entered either use bigEndian or not and use compression or not to

func (*Session) ResetBreak

func (session *Session) ResetBreak()

func (*Session) ResetBuffer

func (session *Session) ResetBuffer()

ResetBuffer empty in and out buffer and set read index to 0

func (*Session) SaveState

func (session *Session) SaveState(newState *SessionState)

SaveState save current session state and accept new state if new state is nil the session will be reset

func (*Session) SetConnected

func (session *Session) SetConnected()

func (*Session) StartContext

func (session *Session) StartContext(ctx context.Context) chan struct{}

func (*Session) Write

func (session *Session) Write() error

Write send data store in output buffer through network

if data bigger than fSessionDataUnit it should be divided into segment and each segment sent in data packet

func (*Session) WriteFinalPacket

func (session *Session) WriteFinalPacket() error

func (*Session) WriteRPC

func (session *Session) WriteRPC(start, end bool) error

type SessionContext

type SessionContext struct {
	// conn net.Conn
	// ConnOption *ConnectionOption
	// PortNo int
	// InstanceName string
	// HostName string
	// IPAddress string
	// Protocol string
	// ServiceName string
	SID []byte

	Version            uint16
	LoVersion          uint16
	Options            uint16
	NegotiatedOptions  uint16
	NegotiatedOptions2 uint32
	OurOne             uint16

	ReconAddr string

	ACFL0               uint8
	ACFL1               uint8
	SessionDataUnit     uint32
	TransportDataUnit   uint32
	UsingAsyncReceivers bool
	IsNTConnected       bool
	OnBreakReset        bool
	GotReset            bool
	AdvancedService     struct {
		CryptAlgo  security.OracleNetworkEncryption
		HashAlgo   security.OracleNetworkDataIntegrity
		SessionKey []byte
		IV         []byte
	}

	FastAuthEnabled  bool
	EODDAFlagEnabled bool
	UUID             []byte
	// contains filtered or unexported fields
}

func NewSessionContext

func NewSessionContext(config *configurations.ConnectionConfig) *SessionContext

type SessionProperties

type SessionProperties struct {
	UseBigClrChunks bool
	UseBigScn       bool
	ClrChunkSize    int
	ServerFlags     uint8
}

type SessionReadWriter

type SessionReadWriter interface {
	ResetBuffer()
	GetProperties() SessionProperties
	SessionReader
	SessionWriter
}

type SessionReader

type SessionReader interface {
	Peek() (byte, error)
	GetByte() (uint8, error)
	GetBytes(length int) ([]byte, error)
	GetInt64(size int, compress, bigEndian bool) (int64, error)
	GetInt(size int, compress, bigEndian bool) (int, error)
	GetClr() ([]byte, error)
	GetDlc() ([]byte, error)
	GetFixedClr() ([]byte, error)
	GetString(length int) (string, error)
	GetNullTermString() (string, error)
	GetKeyVal() (key, val []byte, num int, err error)
}

type SessionState

type SessionState struct {
	InBuffer  *bytes.Buffer
	OutBuffer *bytes.Buffer
	// contains filtered or unexported fields
}

type SessionWriter

type SessionWriter interface {
	PutInt(number interface{}, size uint8, bigEndian, compress bool)
	PutUint(number interface{}, size uint8, bigEndian, compress bool)
	PutBytes(data ...byte)
	PutClr(data []byte)
	PutCHR(data []byte)
	PutFixedClr(data []byte)
	PutString(data string)
	PutDlc(data []byte)
	PutKeyVal(key, val []byte, num uint8)
	PutKeyValString(key, val string, num uint8)
	PutTTCFunc(ttcCode, funcCode uint8)
	GetWriteBuffer() []byte
	Write() error
}

type SummaryObject

type SummaryObject struct {
	EndOfCallStatus      int // uint32
	EndToEndECIDSequence int // uint16
	CurRowNumber         int // uint32
	RetCode              int // uint16

	CursorID int // uint16

	Flags int // uint16

	ErrorMessage []byte
	// contains filtered or unexported fields
}

func NewSummary

func NewSummary(session *Session) (*SummaryObject, error)

type TerminalReader

type TerminalReader interface {
	// contains filtered or unexported methods
}

type ValueStreamReader

type ValueStreamReader interface {
	Read(session SessionReader) (interface{}, error)
}

type ValueStreamWriter

type ValueStreamWriter interface {
	Write(session SessionWriter) error
}

type ValueStreamer

type ValueStreamer interface {
	// Read value from stream
	ValueStreamReader
	// Write value to stream
	ValueStreamWriter
}

type WarningObject

type WarningObject struct {
	// contains filtered or unexported fields
}

func NewWarningObject

func NewWarningObject(session *Session) (*WarningObject, error)

Directories

Path Synopsis
md4
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL