aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
AgeCommit message (Collapse)Author
2025-11-27internal/pipewire: shorten test data filenamesOphestra
These were getting very annoying to type. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: spa_dict size nil checkOphestra
This fixes serialisation of NULL spa_dict. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: require appending marshalerOphestra
This eliminates all non-reflect allocations. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: preallocate for known sizeOphestra
This is still not efficient by any means, but it should eliminate most non-reflect allocation (all allocation if PODMarshaler is not used). Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: size without serialisationOphestra
This is required to achieve zero allocation (other than reflect). Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: simplify spa_dict appendsOphestra
This change uses the (somewhat) newly exposed MarshalAppend which improves readability. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: define size constantsOphestra
This gets rid of magic numbers in marshal/unmarshal. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-26internal/pipewire: implement Core::DoneOphestra
The message in the sample does not correspond to any known method call. The spec does not mention what to do with messages like this, but all existing usage code simply drops it. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-26internal/pipewire: optional final trailing garbage checkOphestra
Omitting the check is only useful for custom unmarshaler. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-26internal/pipewire: additional Client::Info test caseOphestra
This appears to add *one single entry* compared to the message before it. The inefficiency of this protocol is beyond imagination. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-26internal/pipewire: additional Client::Info test caseOphestra
This message follows the other Client::Info event before it. No idea why. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-26internal/pipewire: implement Client::InfoOphestra
Everything is already supported, as usual. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::BoundPropsOphestra
Very straightforward type, everything is already supported. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: check nil marshalerOphestra
NULL values have special case in the format. This check ensures correctness serialising nil pointers. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::Info and generation footerOphestra
These are not directly related but are first encountered on the same message in the capture. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement footerOphestra
The POD itself is serialised without requiring a special case, however its presence is only indicated by the difference in size recorded in the header and payload. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Long typeOphestra
Thankfully no special case here. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Id typeOphestra
This is, in fact, just a glorified Int type. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: slice at POD boundaryOphestra
This prevents incorrectly reading trailing data as part of the current POD. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: bounds check against wire sizeOphestra
This covers cases where wire size is not known ahead of time. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: spa_dict trailing garbage within PODOphestra
This performs the check within the bounds of the POD only. This was not caught since spa_dict was only used as the final struct field until now. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: zero size before validationOphestra
Leftover values from previous invocations cause incorrect behaviour here. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::SyncOphestra
Once again, already entirely supported, the offset is not yet fully verified but makes intuitive sense. Will verify this on future occurrences of the message. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::GetRegistryOphestra
This struct is entirely supported, so this change is very straightforward. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: move test data to filesOphestra
These get very big later on, and would be painful to represent as the compound literal. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Client::UpdatePropertiesOphestra
This is the second message on the captured sample. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement spa_dict typeOphestra
This is a terrible type that defies the type system. It is implemented on the concrete type to avoid special cases. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: use custom marshaler when availableOphestra
This reduces special cases. This change also exposes unmarshalled message size on the wire. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement string typeOphestra
This is still NUL terminated strings, and an extra NUL character on an 8-byte string does cause an extra 7 bytes of padding. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: check for trailing garbageOphestra
This is useful during development. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::HelloOphestra
This implements enough types to correctly marshal and unmarshal Core::Hello. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-24internal/pipewire: add type constantsOphestra
This change also centralises encoding testing. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-23internal/pipewire: implement message headerOphestra
Test cases are from interactions between pw-container and PipeWire. Results are validated against corresponding body. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-19internal/wayland: clean up pathname socketOphestra
This is cleaner than cleaning up in internal/system as it covers the failure paths. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-17internal/wayland: do not double close fdOphestra
These are already closed during securityContextBindPipe on a non-nil error. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-17internal/wayland: expose WAYLAND_VERSIONOphestra
This might be useful troubleshooting information. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-16.clang-format: increase indent widthOphestra
This significantly increases readability. This patch is pretty big so it is being done after mostly everything has settled. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-16internal/wayland: check pathname sizeOphestra
This avoids passing a truncated pathname to the kernel. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-16internal/wayland: increase error detailOphestra
This includes targeted paths in the returned errors. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-16internal/wayland: remove fd typecastsOphestra
These are no longer necessary since RawConn is no longer used. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-16internal/wayland: reimplement connect/bind codeOphestra
The old implementation is relocated to system/wayland/deprecated.go. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-15internal/wayland: relocate connection structOphestra
This interface is getting replaced, so relocating it to the deprecated wrapper package before working on its replacement. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-15internal/wayland: improve error handlingOphestra
Note: wl_registry_add_listener is undocumented everywhere. Its implementation calls wl_proxy_add_listener which returns 0 on success or -1 on failure. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-15.clang-format: do not limit line lengthOphestra
This hard limit destroys readability in some places. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-15nix: build with clangOphestra
Clang is better than gcc in various ways. This also pulls in clang-format which is very helpful. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-15internal: relocate packagesOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-14treewide: migrate ldd callersOphestra
This discontinues use of the deprecated ldd.Exec function for #25. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-14internal/outcome: rename run from mainOphestra
The "main.go" name is quite confusing as this is often only present in main packages. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-14container/fhs: add constant for /dev/shm/Ophestra
This is mounted for the default read-only /dev/ when programs want to use shm_open(3). Defining it here is less error-prone and saves the extra append at runtime. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-13internal/info: relocate from internalOphestra
This is cleaner and makes more sense. The longer LDFLAGS was never a valid concern since it is always inserted by a script. Signed-off-by: Ophestra <cat@gensokyo.uk>