mirror of
https://github.com/lux-tel/libsession-util.git
synced 2026-10-30 20:25:11 +00:00
This adds support for automatic wrapping and unwrapping of config messages that may be wrapped in protobuf; this was unintentional, but is out in the wild in current Session releases. The long-term plan is to stop doing this eventually, but supporting it here allows us to change from the current mode (always wrap/unwrap affected message types) to a mode where we only unwrap, and then finally we can drop unwrapping as well. For now: we wrap/unwrap the existing released message types (user profile, conversation info, and so on) but not the new groups configs (which should always be un-wrapped). Various notes: - protobuf added as external dependency. - protobuf 21.12 is used, which is an older release, but is what is still being used by lots of projects and Linux distributions because Google applied huge amounts of extra bloat in v22 (including pulling a massive pile of crap in abseil), broke the build system in various ways, and made everything suck to the point that many Linux distributions have just stuck with the latest 21.12 because of all the broken crap Google imposed on everyone in v22 and newer. - SessionProtos.pro and WebSocketResources.proto looped in from session-ios codebase, with one minor change to let us use it in "lite" mode (which is still very bloated, but nothing like non-lite mode). - Added pregenerated header/cpp files; we experimented with building them as part of the build, but that ended up neigh impossible for our various cross-compiled builds. (These also get excluded from format.sh because they break if formatted. Hurray.) - Add protobuf::libprotobuf-lite to the static build list. - Adds a dummy test script that does nothing, but tests that we can probably link against the combined archive (when building with `-DSTATIC_BUILD=ON`).
52 lines
1.2 KiB
Protocol Buffer
52 lines
1.2 KiB
Protocol Buffer
/**
|
|
* Copyright (C) 2014-2016 Open Whisper Systems
|
|
*
|
|
* Licensed according to the LICENSE file in this repository.
|
|
*/
|
|
|
|
// iOS - since we use a modern proto-compiler, we must specify
|
|
// the legacy proto format.
|
|
syntax = "proto2";
|
|
|
|
// iOS - package name determines class prefix
|
|
package WebSocketProtos;
|
|
|
|
option optimize_for = LITE_RUNTIME;
|
|
|
|
option java_package = "org.whispersystems.signalservice.internal.websocket";
|
|
option java_outer_classname = "WebSocketProtos";
|
|
|
|
message WebSocketRequestMessage {
|
|
// @required
|
|
optional string verb = 1;
|
|
// @required
|
|
optional string path = 2;
|
|
optional bytes body = 3;
|
|
repeated string headers = 5;
|
|
// @required
|
|
optional uint64 requestId = 4;
|
|
}
|
|
|
|
message WebSocketResponseMessage {
|
|
// @required
|
|
optional uint64 requestId = 1;
|
|
// @required
|
|
optional uint32 status = 2;
|
|
optional string message = 3;
|
|
repeated string headers = 5;
|
|
optional bytes body = 4;
|
|
}
|
|
|
|
message WebSocketMessage {
|
|
enum Type {
|
|
UNKNOWN = 0;
|
|
REQUEST = 1;
|
|
RESPONSE = 2;
|
|
}
|
|
|
|
// @required
|
|
optional Type type = 1;
|
|
optional WebSocketRequestMessage request = 2;
|
|
optional WebSocketResponseMessage response = 3;
|
|
}
|