java.lang.Object
org.codelibs.jcifs.smb1.dcerpc.DcerpcHandle
- All Implemented Interfaces:
DcerpcConstants
- Direct Known Subclasses:
DcerpcPipeHandle
Abstract base class for DCERPC handles providing core RPC functionality.
This class manages DCE/RPC protocol bindings and communications over SMB transport.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DcerpcBindingThe DCERPC binding configuration for this handleprotected intMaximum receive buffer size for DCERPC messagesprotected intMaximum transmit buffer size for DCERPC messagesprotected DcerpcSecurityProviderThe security provider for authentication and message protectionprotected intThe current state of the DCERPC connectionFields inherited from interface org.codelibs.jcifs.smb1.dcerpc.DcerpcConstants
DCERPC_CONC_MPX, DCERPC_DID_NOT_EXECUTE, DCERPC_FIRST_FRAG, DCERPC_LAST_FRAG, DCERPC_MAYBE, DCERPC_OBJECT_UUID, DCERPC_PENDING_CANCEL, DCERPC_RESERVED_1, DCERPC_UUID_SYNTAX_NDR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Binds this handle to the remote DCERPC endpointabstract voidclose()Closes this DCERPC handle and releases resourcesprotected abstract voiddoReceiveFragment(byte[] buf, boolean isDirect) Receives a DCERPC fragment from the remote endpointprotected abstract voiddoSendFragment(byte[] buf, int off, int length, boolean isDirect) Sends a DCERPC fragment to the remote endpointstatic DcerpcHandlegetHandle(String url, NtlmPasswordAuthentication auth) Gets a DCERPC handle for the specified URL and authenticationGets the principal associated with this handleGets the server hostname or addressprotected static DcerpcBindingparseBinding(String str) Parses a DCERPC binding string into a DcerpcBinding objectvoidsendrecv(DcerpcMessage msg) Sends a DCERPC message and receives the responsevoidsetDcerpcSecurityProvider(DcerpcSecurityProvider securityProvider) Sets the security provider for this handletoString()
-
Field Details
-
binding
The DCERPC binding configuration for this handle -
max_xmit
protected int max_xmitMaximum transmit buffer size for DCERPC messages -
max_recv
protected int max_recvMaximum receive buffer size for DCERPC messages -
state
protected int stateThe current state of the DCERPC connection -
securityProvider
The security provider for authentication and message protection
-
-
Constructor Details
-
DcerpcHandle
protected DcerpcHandle()Default constructor for DcerpcHandle. Initializes the DCE/RPC handle for protocol operations.
-
-
Method Details
-
parseBinding
Parses a DCERPC binding string into a DcerpcBinding object- Parameters:
str- the binding string to parse- Returns:
- the parsed DcerpcBinding object
- Throws:
DcerpcException- if the binding string is malformed
-
getHandle
public static DcerpcHandle getHandle(String url, NtlmPasswordAuthentication auth) throws UnknownHostException, MalformedURLException, DcerpcException Gets a DCERPC handle for the specified URL and authentication- Parameters:
url- the DCERPC URL to connect toauth- the NTLM authentication credentials- Returns:
- a DCERPC handle for the connection
- Throws:
UnknownHostException- if the host cannot be resolvedMalformedURLException- if the URL is malformedDcerpcException- if DCERPC initialization fails
-
bind
Binds this handle to the remote DCERPC endpoint- Throws:
DcerpcException- if the bind operation failsIOException- if an I/O error occurs
-
sendrecv
Sends a DCERPC message and receives the response- Parameters:
msg- the message to send- Throws:
DcerpcException- if the RPC operation failsIOException- if an I/O error occurs
-
setDcerpcSecurityProvider
Sets the security provider for this handle- Parameters:
securityProvider- the security provider to use
-
getServer
Gets the server hostname or address- Returns:
- the server name
-
getPrincipal
Gets the principal associated with this handle- Returns:
- the principal or null if not authenticated
-
toString
-
doSendFragment
protected abstract void doSendFragment(byte[] buf, int off, int length, boolean isDirect) throws IOException Sends a DCERPC fragment to the remote endpoint- Parameters:
buf- the buffer containing the fragmentoff- the offset into the bufferlength- the length of data to sendisDirect- whether to use direct transmission- Throws:
IOException- if an I/O error occurs
-
doReceiveFragment
Receives a DCERPC fragment from the remote endpoint- Parameters:
buf- the buffer to receive the fragmentisDirect- whether to use direct reception- Throws:
IOException- if an I/O error occurs
-
close
Closes this DCERPC handle and releases resources- Throws:
IOException- if an I/O error occurs during close
-