target_alloc(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ¦‹ 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:

  • cpoint form β€” if the initial argument is the cpoint form, the allocation will be a named connection point to which a client can connect. It's giving β€œreserve the spot, bestie” energy πŸŽ€
  • fsrv form β€” if the initial argument is the fsrv form, 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 the fsrv connection 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, the launch_target mechanism combined with the target/configuration database 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 πŸ“

  1. To push new output segments, see define_recordtarget, define_nulltarget and define_feedtarget.
  2. 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.
  3. The connection key is limited to 30 characters from the set [a-Z,_0-9] and the actual search path / mechanism is implementation defined.
  4. 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. 🚨
  5. The connection point is consumed (closed, unlinked) when the first verified connection goes through. To re-use the connection point, invoke target_alloc again with the same key from within the callback handler.
  6. For honoring explicit requests from a frameserver regarding new subsegments, use the accept_target function.
  7. When a 'connected' event has been received, many applications expect a displayhint event 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