Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FarlandsModdingTeam/TerbinProyect/llms.txt
Use this file to discover all available pages before exploring further.
TerbinExecutableAttribute is the central annotation that wires a static C# method into Terbin’s IPC routing engine. When TerbinExecutor.Register(Assembly) runs at startup it scans every type in the assembly, finds all methods carrying this attribute, validates their signatures, and registers them as handlers inside TerbinExecutableManager. From that moment on, any incoming packet whose action key matches the attribute’s byte sequence will be dispatched to the decorated method automatically.
Interfaces
IExecutableAttribute
Every attribute that participates in Terbin’s routing system must implement this interface.
The byte sequence that identifies this action key. For two-byte keys the convention is
[CodeServices.X, CodeServicesSection.Y].Length of the
Action array. Derived as Action.Length.The concrete
IExecutableDispatcher type responsible for storing and calling handlers registered under this attribute. For TerbinExecutableAttribute this is always typeof(ExecutableDispatcher).IExecutableDispatcher
The contract that every dispatcher must satisfy.
Adds a single handler for an action key.
Looks up the handler list for
pActions and invokes it, returning the first non-null InfoResponse.Scans an assembly and calls
Register for every valid decorated method found.TerbinExecutableAttribute
AllowMultiple = true means a single static method can carry multiple [TerbinExecutable] attributes with different byte keys, registering itself as a handler for each key simultaneously.Constructors
Direct byte constructor. Pass raw byte literals or cast enum values explicitly.
Object-array constructor. Each element is cast to
byte internally via Serialineitor.CastToByte. Throws OverflowException if more than 255 elements are provided.Handler Signature
Every method decorated with[TerbinExecutable] must exactly match the TerbinExecutableDelegate signature. Methods that do not pass the signature check are silently skipped during assembly scanning.
The packet header. Contains
IdRequest (used when building responses), OrderRequest (fragmentation order), Status (CodeStatus), and IdMemory.Raw payload bytes delivered with the packet. Deserialize with
Serialineitor as needed.A per-action cancellation token. Check
pToken.IsCancellationRequested before any long-running work. This token is cancelled when CodeStatus.CancelByAction is received for the same action key.Task<InfoResponse?>. Return null if no reply should be sent (e.g., fire-and-forget). Use the InfoResponse.Create* factory methods to build typed responses.
Multi-Byte Action Keys
In practice, Terbin handlers use two bytes: a service code fromCodeServices and a section code from CodeServicesSection. This forms a composite key that allows fine-grained routing without collisions.
ByteArrayKey struct wraps the byte[] and provides value-equality semantics so that new byte[]{20, 30} and new byte[]{20, 30} hash to the same slot in the ConcurrentDictionary.
Complete Working Examples
Minimal service handler (ServiceInstances.cs)
Protocol-level Stop handler (Worker.cs)
Obsolete Variant
TerbinExecutable_ObsoleteAttribute accepts a single byte pAction and targets ExecutableDispatcherSimple. It is marked [Obsolete] and should not be used in new code. Use TerbinExecutableAttribute with ExecutableDispatcher instead.See Also
- ExecutableDispatcher — the thread-safe routing engine that stores and calls registered handlers.
- TerbinExecutor — the static scanner that seeds
TerbinExecutableManagerfrom assemblies.