target_alloc(3)
π¦ NAME π¦
okay so bestie, welcome to target_alloc(3) from the Arcan Lua API manual β this one is giving server-side matchmaker energy and honestly it ate π
target_alloc β bind an external connection point or force-push a subsegment. No cap, that's the whole vibe.
β¨ SYNOPSIS β¨
vid:new_vid, aid:new_aid, int:new_cookie
target_alloc( string:cpoint, function:callback )
target_alloc( string:cpoint, string:passkey, function:callback )
target_alloc( string:cpoint, string:passkey, int:w, int:h, function:callback )
target_alloc( string:cpoint, int:w, int:h, function:callback )
target_alloc( vid:fsrv )
target_alloc( vid:fsrv, function:callback )
target_alloc( vid:fsrv, int:w, int:h, function:callback )
target_alloc( vid:fsrv, function:callback, string:type )
target_alloc( vid:fsrv, function:callback, number:tag )
target_alloc( vid:fsrv, int:w, int:h, function:callback, string:type )
target_alloc( vid:fsrv, int:w, int:h, function:callback, string:type, bool:forced )
π DESCRIPTION π
okay so this function controls server-side initiated allocation of segments or connection points. The first argument tells you which flavor you're in:
cpointform β if the initial argument is thecpointform, the allocation will be a named connection point to which a client can connect. It's giving βreserve the spot, bestieβ energy πfsrvform β if the initial argument is thefsrvform, a subsegment will be allocated and pushed to the client. This form is more specialised and intended as a server-side means of requesting and probing for client-side support for alternate views of whatever thefsrvconnection current presents. You can further specify this by providing a type (debug,accessibility) and whether a backend implementation should be forced or not (default=false). Literally so much power in one call π₯
The form and use for callback is the same as in launch_target, so please refer to that function for detailed documentation.
The optional passkey form is an aditional authentication string that the connecting client is expected to be able to authenticate against in a platform defined function β typically as a simple string comparison or challenge-response β and is not intended as a strong means of authentication.
β οΈ bestie, hear me: for strong auth cases, thelaunch_targetmechanism combined with thetarget/configurationdatabase is preferred. That's because only the connection itself will be authenticated; the contents can still be subject to interception and tampering by a local attacker. Not me being dramatic, that's just the tea π
π NOTES π
- To push new output segments, see
define_recordtarget,define_nulltargetanddefine_feedtarget. - Each call that allows a non-authoritative connection is only valid once. If a connection fails to verify OR a connection is completed, the connection point will be removed.
- The connection key is limited to 30 characters from the set
[a-Z,_0-9]and the actual search path / mechanism is implementation defined. - The first example below will continuously listen for new connections under the
'nonauth'key. In a real-world setting, be sure to restrict the number of allowed connections to avoid running out of resources, and to monitor for suspicious activities e.g. a high amount of connections or connection attempts in a short timeframe etc. π¨ - The connection point is consumed (closed, unlinked) when the first verified connection goes through. To re-use the connection point, invoke
target_allocagain with the same key from within the callback handler. - For honoring explicit requests from a frameserver regarding new subsegments, use the
accept_targetfunction. - When a
'connected'event has been received, many applications expect adisplayhintevent before being able to proceed (with information about the current surface dimensions and density). iykyk πΈ
π EXAMPLE π
function target_alloc0()
local chain_call = function()
target_alloc("nonauth", function(source, status)
print(source, status.kind);
if (status.kind == "connected") then
chain_call();
end
end);
end
end
π MISUSE π
bestie, this is the βdo not do thisβ exhibit. The original just drops the code, so here it is, untouched:
function target_alloc0()
local a = fill_surface(32, 32, 255, 0, 0, 0);
target_alloc(a, function(source, status)
end);
end
π MISUSE (the sequel) π
another misuse moment, no notes, just chaos π
function target_alloc1()
vid = net_listen();
target_alloc(vid, target_alloc);
end
π SEE ALSO π
that's the tea, bestie: this page is from the targetcontrol source/version, dated October 2026, and target_alloc(3) is signing off π
β¨
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms