Class AndroidMessageTransport
- Assembly
- VpnHood.Core.Client.Devices.Android.dll
Provides the contract of the binder channel between the app and its Android VPN service, which both ends use: the
app's client (AndroidMessageClient) and the service's listener (AndroidMessageListener).
public static class AndroidMessageTransport
- Inheritance
-
AndroidMessageTransport
- Inherited Members
Remarks
It carries the same request and answer bytes as the other channels. Every transaction is oneway: a request carries its ID, the client's reply binder and its bytes, and the service answers on the reply binder. Nothing may go to the app synchronously: Android kills a frozen process that receives a synchronous transaction, and the app may be frozen, as a cached process, while it waits for a reply, while a oneway transaction waits until it thaws. No thread on either side blocks while a request runs.
Fields
BindAction
The action of the bind that selects the channel; any other, as the system's android.net.VpnService, must
go on to VpnService.OnBind.
public const string BindAction = "com.vpnhood.core.vpnservice.MESSAGE"
Field Value
InterfaceToken
The interface token each transaction's parcel carries, which both sides check.
public const string InterfaceToken = "com.vpnhood.core.vpnservice.IMessageTransport"
Field Value
MaxBlobLength
The longest request or answer, in bytes: the IPC size Android suggests, 64 KB before Android 11, less 4 KB for the interface token, the request's own data and Binder's bookkeeping.
public static readonly int MaxBlobLength
Field Value
MaxErrorMessageLength
The longest error message a failed answer carries: 4,096 characters.
public const int MaxErrorMessageLength = 4096
Field Value
ReplyTransactionCode
The code of an answer, service to the client's reply binder, oneway: the request's ID, whether it succeeded, and its bytes or its error message.
public const int ReplyTransactionCode = 2
Field Value
RequestTransactionCode
The code of a request, client to service, oneway: its ID, the reply binder and its bytes
(IBinder.FIRST_CALL_TRANSACTION).
public const int RequestTransactionCode = 1
Field Value
Methods
WriteBlob(Parcel, Memory<byte>)
Writes bytes to a parcel, without a copy of its own where the memory is an array's.
public static void WriteBlob(Parcel data, Memory<byte> blob)