From cc9a825279d36cedf91f70615bd7f65505c04fd7 Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Wed, 29 Sep 2021 13:07:04 -0500 Subject: [PATCH] Remove checked in generated code --- pom.xml | 2 +- .../messages/protobuf/SubProtocol.java | 2841 ----------------- .../src/main/proto/WebSocketProtocol.proto | 39 + 3 files changed, 40 insertions(+), 2842 deletions(-) delete mode 100644 websocket-resources/src/main/java/org/whispersystems/websocket/messages/protobuf/SubProtocol.java create mode 100644 websocket-resources/src/main/proto/WebSocketProtocol.proto diff --git a/pom.xml b/pom.xml index be05c4232..5a0ba7640 100644 --- a/pom.xml +++ b/pom.xml @@ -295,7 +295,7 @@ protobuf-maven-plugin 0.6.1 - com.google.protobuf:protoc:3.17.2:exe:${os.detected.classifier} + com.google.protobuf:protoc:3.18.0:exe:${os.detected.classifier} diff --git a/websocket-resources/src/main/java/org/whispersystems/websocket/messages/protobuf/SubProtocol.java b/websocket-resources/src/main/java/org/whispersystems/websocket/messages/protobuf/SubProtocol.java deleted file mode 100644 index f71d374eb..000000000 --- a/websocket-resources/src/main/java/org/whispersystems/websocket/messages/protobuf/SubProtocol.java +++ /dev/null @@ -1,2841 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: SubProtocol.proto - -package org.whispersystems.websocket.messages.protobuf; - -public final class SubProtocol { - private SubProtocol() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface WebSocketRequestMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional string verb = 1; - /** - * optional string verb = 1; - */ - boolean hasVerb(); - /** - * optional string verb = 1; - */ - java.lang.String getVerb(); - /** - * optional string verb = 1; - */ - com.google.protobuf.ByteString - getVerbBytes(); - - // optional string path = 2; - /** - * optional string path = 2; - */ - boolean hasPath(); - /** - * optional string path = 2; - */ - java.lang.String getPath(); - /** - * optional string path = 2; - */ - com.google.protobuf.ByteString - getPathBytes(); - - // repeated string headers = 5; - /** - * repeated string headers = 5; - */ - java.util.List - getHeadersList(); - /** - * repeated string headers = 5; - */ - int getHeadersCount(); - /** - * repeated string headers = 5; - */ - java.lang.String getHeaders(int index); - /** - * repeated string headers = 5; - */ - com.google.protobuf.ByteString - getHeadersBytes(int index); - - // optional bytes body = 3; - /** - * optional bytes body = 3; - */ - boolean hasBody(); - /** - * optional bytes body = 3; - */ - com.google.protobuf.ByteString getBody(); - - // optional uint64 id = 4; - /** - * optional uint64 id = 4; - */ - boolean hasId(); - /** - * optional uint64 id = 4; - */ - long getId(); - } - /** - * Protobuf type {@code textsecure.WebSocketRequestMessage} - */ - public static final class WebSocketRequestMessage extends - com.google.protobuf.GeneratedMessage - implements WebSocketRequestMessageOrBuilder { - // Use WebSocketRequestMessage.newBuilder() to construct. - private WebSocketRequestMessage(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private WebSocketRequestMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final WebSocketRequestMessage defaultInstance; - public static WebSocketRequestMessage getDefaultInstance() { - return defaultInstance; - } - - public WebSocketRequestMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private WebSocketRequestMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - verb_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - path_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - body_ = input.readBytes(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - id_ = input.readUInt64(); - break; - } - case 42: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - headers_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000004; - } - headers_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - headers_ = new com.google.protobuf.UnmodifiableLazyStringList(headers_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketRequestMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketRequestMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public WebSocketRequestMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new WebSocketRequestMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional string verb = 1; - public static final int VERB_FIELD_NUMBER = 1; - private java.lang.Object verb_; - /** - * optional string verb = 1; - */ - public boolean hasVerb() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string verb = 1; - */ - public java.lang.String getVerb() { - java.lang.Object ref = verb_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - verb_ = s; - } - return s; - } - } - /** - * optional string verb = 1; - */ - public com.google.protobuf.ByteString - getVerbBytes() { - java.lang.Object ref = verb_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - verb_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string path = 2; - public static final int PATH_FIELD_NUMBER = 2; - private java.lang.Object path_; - /** - * optional string path = 2; - */ - public boolean hasPath() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string path = 2; - */ - public java.lang.String getPath() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - path_ = s; - } - return s; - } - } - /** - * optional string path = 2; - */ - public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - path_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated string headers = 5; - public static final int HEADERS_FIELD_NUMBER = 5; - private com.google.protobuf.LazyStringList headers_; - /** - * repeated string headers = 5; - */ - public java.util.List - getHeadersList() { - return headers_; - } - /** - * repeated string headers = 5; - */ - public int getHeadersCount() { - return headers_.size(); - } - /** - * repeated string headers = 5; - */ - public java.lang.String getHeaders(int index) { - return headers_.get(index); - } - /** - * repeated string headers = 5; - */ - public com.google.protobuf.ByteString - getHeadersBytes(int index) { - return headers_.getByteString(index); - } - - // optional bytes body = 3; - public static final int BODY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString body_; - /** - * optional bytes body = 3; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional bytes body = 3; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - - // optional uint64 id = 4; - public static final int ID_FIELD_NUMBER = 4; - private long id_; - /** - * optional uint64 id = 4; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional uint64 id = 4; - */ - public long getId() { - return id_; - } - - private void initFields() { - verb_ = ""; - path_ = ""; - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - body_ = com.google.protobuf.ByteString.EMPTY; - id_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getVerbBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getPathBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, body_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeUInt64(4, id_); - } - for (int i = 0; i < headers_.size(); i++) { - output.writeBytes(5, headers_.getByteString(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getVerbBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getPathBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, body_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(4, id_); - } - { - int dataSize = 0; - for (int i = 0; i < headers_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(headers_.getByteString(i)); - } - size += dataSize; - size += 1 * getHeadersList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code textsecure.WebSocketRequestMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketRequestMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketRequestMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder.class); - } - - // Construct using org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - verb_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - path_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - body_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - id_ = 0L; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketRequestMessage_descriptor; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage getDefaultInstanceForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance(); - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage build() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage buildPartial() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage result = new org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.verb_ = verb_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.path_ = path_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - headers_ = new com.google.protobuf.UnmodifiableLazyStringList( - headers_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.headers_ = headers_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000004; - } - result.body_ = body_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000008; - } - result.id_ = id_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage) { - return mergeFrom((org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage other) { - if (other == org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance()) return this; - if (other.hasVerb()) { - bitField0_ |= 0x00000001; - verb_ = other.verb_; - onChanged(); - } - if (other.hasPath()) { - bitField0_ |= 0x00000002; - path_ = other.path_; - onChanged(); - } - if (!other.headers_.isEmpty()) { - if (headers_.isEmpty()) { - headers_ = other.headers_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureHeadersIsMutable(); - headers_.addAll(other.headers_); - } - onChanged(); - } - if (other.hasBody()) { - setBody(other.getBody()); - } - if (other.hasId()) { - setId(other.getId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional string verb = 1; - private java.lang.Object verb_ = ""; - /** - * optional string verb = 1; - */ - public boolean hasVerb() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string verb = 1; - */ - public java.lang.String getVerb() { - java.lang.Object ref = verb_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - verb_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string verb = 1; - */ - public com.google.protobuf.ByteString - getVerbBytes() { - java.lang.Object ref = verb_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - verb_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string verb = 1; - */ - public Builder setVerb( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - verb_ = value; - onChanged(); - return this; - } - /** - * optional string verb = 1; - */ - public Builder clearVerb() { - bitField0_ = (bitField0_ & ~0x00000001); - verb_ = getDefaultInstance().getVerb(); - onChanged(); - return this; - } - /** - * optional string verb = 1; - */ - public Builder setVerbBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - verb_ = value; - onChanged(); - return this; - } - - // optional string path = 2; - private java.lang.Object path_ = ""; - /** - * optional string path = 2; - */ - public boolean hasPath() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string path = 2; - */ - public java.lang.String getPath() { - java.lang.Object ref = path_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - path_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string path = 2; - */ - public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - path_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string path = 2; - */ - public Builder setPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - path_ = value; - onChanged(); - return this; - } - /** - * optional string path = 2; - */ - public Builder clearPath() { - bitField0_ = (bitField0_ & ~0x00000002); - path_ = getDefaultInstance().getPath(); - onChanged(); - return this; - } - /** - * optional string path = 2; - */ - public Builder setPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - path_ = value; - onChanged(); - return this; - } - - // repeated string headers = 5; - private com.google.protobuf.LazyStringList headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureHeadersIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - headers_ = new com.google.protobuf.LazyStringArrayList(headers_); - bitField0_ |= 0x00000004; - } - } - /** - * repeated string headers = 5; - */ - public java.util.List - getHeadersList() { - return java.util.Collections.unmodifiableList(headers_); - } - /** - * repeated string headers = 5; - */ - public int getHeadersCount() { - return headers_.size(); - } - /** - * repeated string headers = 5; - */ - public java.lang.String getHeaders(int index) { - return headers_.get(index); - } - /** - * repeated string headers = 5; - */ - public com.google.protobuf.ByteString - getHeadersBytes(int index) { - return headers_.getByteString(index); - } - /** - * repeated string headers = 5; - */ - public Builder setHeaders( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.set(index, value); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addHeaders( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.add(value); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addAllHeaders( - java.lang.Iterable values) { - ensureHeadersIsMutable(); - super.addAll(values, headers_); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder clearHeaders() { - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addHeadersBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.add(value); - onChanged(); - return this; - } - - // optional bytes body = 3; - private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; - /** - * optional bytes body = 3; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional bytes body = 3; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - /** - * optional bytes body = 3; - */ - public Builder setBody(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - body_ = value; - onChanged(); - return this; - } - /** - * optional bytes body = 3; - */ - public Builder clearBody() { - bitField0_ = (bitField0_ & ~0x00000008); - body_ = getDefaultInstance().getBody(); - onChanged(); - return this; - } - - // optional uint64 id = 4; - private long id_ ; - /** - * optional uint64 id = 4; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional uint64 id = 4; - */ - public long getId() { - return id_; - } - /** - * optional uint64 id = 4; - */ - public Builder setId(long value) { - bitField0_ |= 0x00000010; - id_ = value; - onChanged(); - return this; - } - /** - * optional uint64 id = 4; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000010); - id_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.WebSocketRequestMessage) - } - - static { - defaultInstance = new WebSocketRequestMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.WebSocketRequestMessage) - } - - public interface WebSocketResponseMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint64 id = 1; - /** - * optional uint64 id = 1; - */ - boolean hasId(); - /** - * optional uint64 id = 1; - */ - long getId(); - - // optional uint32 status = 2; - /** - * optional uint32 status = 2; - */ - boolean hasStatus(); - /** - * optional uint32 status = 2; - */ - int getStatus(); - - // optional string message = 3; - /** - * optional string message = 3; - */ - boolean hasMessage(); - /** - * optional string message = 3; - */ - java.lang.String getMessage(); - /** - * optional string message = 3; - */ - com.google.protobuf.ByteString - getMessageBytes(); - - // repeated string headers = 5; - /** - * repeated string headers = 5; - */ - java.util.List - getHeadersList(); - /** - * repeated string headers = 5; - */ - int getHeadersCount(); - /** - * repeated string headers = 5; - */ - java.lang.String getHeaders(int index); - /** - * repeated string headers = 5; - */ - com.google.protobuf.ByteString - getHeadersBytes(int index); - - // optional bytes body = 4; - /** - * optional bytes body = 4; - */ - boolean hasBody(); - /** - * optional bytes body = 4; - */ - com.google.protobuf.ByteString getBody(); - } - /** - * Protobuf type {@code textsecure.WebSocketResponseMessage} - */ - public static final class WebSocketResponseMessage extends - com.google.protobuf.GeneratedMessage - implements WebSocketResponseMessageOrBuilder { - // Use WebSocketResponseMessage.newBuilder() to construct. - private WebSocketResponseMessage(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private WebSocketResponseMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final WebSocketResponseMessage defaultInstance; - public static WebSocketResponseMessage getDefaultInstance() { - return defaultInstance; - } - - public WebSocketResponseMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private WebSocketResponseMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - id_ = input.readUInt64(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - status_ = input.readUInt32(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - message_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - body_ = input.readBytes(); - break; - } - case 42: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - headers_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000008; - } - headers_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - headers_ = new com.google.protobuf.UnmodifiableLazyStringList(headers_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketResponseMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketResponseMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public WebSocketResponseMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new WebSocketResponseMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint64 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private long id_; - /** - * optional uint64 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 id = 1; - */ - public long getId() { - return id_; - } - - // optional uint32 status = 2; - public static final int STATUS_FIELD_NUMBER = 2; - private int status_; - /** - * optional uint32 status = 2; - */ - public boolean hasStatus() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional uint32 status = 2; - */ - public int getStatus() { - return status_; - } - - // optional string message = 3; - public static final int MESSAGE_FIELD_NUMBER = 3; - private java.lang.Object message_; - /** - * optional string message = 3; - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional string message = 3; - */ - public java.lang.String getMessage() { - java.lang.Object ref = message_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - message_ = s; - } - return s; - } - } - /** - * optional string message = 3; - */ - public com.google.protobuf.ByteString - getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated string headers = 5; - public static final int HEADERS_FIELD_NUMBER = 5; - private com.google.protobuf.LazyStringList headers_; - /** - * repeated string headers = 5; - */ - public java.util.List - getHeadersList() { - return headers_; - } - /** - * repeated string headers = 5; - */ - public int getHeadersCount() { - return headers_.size(); - } - /** - * repeated string headers = 5; - */ - public java.lang.String getHeaders(int index) { - return headers_.get(index); - } - /** - * repeated string headers = 5; - */ - public com.google.protobuf.ByteString - getHeadersBytes(int index) { - return headers_.getByteString(index); - } - - // optional bytes body = 4; - public static final int BODY_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString body_; - /** - * optional bytes body = 4; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional bytes body = 4; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - - private void initFields() { - id_ = 0L; - status_ = 0; - message_ = ""; - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - body_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt64(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(2, status_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getMessageBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, body_); - } - for (int i = 0; i < headers_.size(); i++) { - output.writeBytes(5, headers_.getByteString(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, status_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, getMessageBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, body_); - } - { - int dataSize = 0; - for (int i = 0; i < headers_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(headers_.getByteString(i)); - } - size += dataSize; - size += 1 * getHeadersList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code textsecure.WebSocketResponseMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketResponseMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketResponseMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder.class); - } - - // Construct using org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - id_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - status_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - message_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - body_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketResponseMessage_descriptor; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage getDefaultInstanceForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance(); - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage build() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage buildPartial() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage result = new org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.status_ = status_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.message_ = message_; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - headers_ = new com.google.protobuf.UnmodifiableLazyStringList( - headers_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.headers_ = headers_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000008; - } - result.body_ = body_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage) { - return mergeFrom((org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage other) { - if (other == org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasStatus()) { - setStatus(other.getStatus()); - } - if (other.hasMessage()) { - bitField0_ |= 0x00000004; - message_ = other.message_; - onChanged(); - } - if (!other.headers_.isEmpty()) { - if (headers_.isEmpty()) { - headers_ = other.headers_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureHeadersIsMutable(); - headers_.addAll(other.headers_); - } - onChanged(); - } - if (other.hasBody()) { - setBody(other.getBody()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint64 id = 1; - private long id_ ; - /** - * optional uint64 id = 1; - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 id = 1; - */ - public long getId() { - return id_; - } - /** - * optional uint64 id = 1; - */ - public Builder setId(long value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * optional uint64 id = 1; - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0L; - onChanged(); - return this; - } - - // optional uint32 status = 2; - private int status_ ; - /** - * optional uint32 status = 2; - */ - public boolean hasStatus() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional uint32 status = 2; - */ - public int getStatus() { - return status_; - } - /** - * optional uint32 status = 2; - */ - public Builder setStatus(int value) { - bitField0_ |= 0x00000002; - status_ = value; - onChanged(); - return this; - } - /** - * optional uint32 status = 2; - */ - public Builder clearStatus() { - bitField0_ = (bitField0_ & ~0x00000002); - status_ = 0; - onChanged(); - return this; - } - - // optional string message = 3; - private java.lang.Object message_ = ""; - /** - * optional string message = 3; - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional string message = 3; - */ - public java.lang.String getMessage() { - java.lang.Object ref = message_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - message_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string message = 3; - */ - public com.google.protobuf.ByteString - getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string message = 3; - */ - public Builder setMessage( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - message_ = value; - onChanged(); - return this; - } - /** - * optional string message = 3; - */ - public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000004); - message_ = getDefaultInstance().getMessage(); - onChanged(); - return this; - } - /** - * optional string message = 3; - */ - public Builder setMessageBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - message_ = value; - onChanged(); - return this; - } - - // repeated string headers = 5; - private com.google.protobuf.LazyStringList headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureHeadersIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - headers_ = new com.google.protobuf.LazyStringArrayList(headers_); - bitField0_ |= 0x00000008; - } - } - /** - * repeated string headers = 5; - */ - public java.util.List - getHeadersList() { - return java.util.Collections.unmodifiableList(headers_); - } - /** - * repeated string headers = 5; - */ - public int getHeadersCount() { - return headers_.size(); - } - /** - * repeated string headers = 5; - */ - public java.lang.String getHeaders(int index) { - return headers_.get(index); - } - /** - * repeated string headers = 5; - */ - public com.google.protobuf.ByteString - getHeadersBytes(int index) { - return headers_.getByteString(index); - } - /** - * repeated string headers = 5; - */ - public Builder setHeaders( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.set(index, value); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addHeaders( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.add(value); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addAllHeaders( - java.lang.Iterable values) { - ensureHeadersIsMutable(); - super.addAll(values, headers_); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder clearHeaders() { - headers_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - return this; - } - /** - * repeated string headers = 5; - */ - public Builder addHeadersBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHeadersIsMutable(); - headers_.add(value); - onChanged(); - return this; - } - - // optional bytes body = 4; - private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; - /** - * optional bytes body = 4; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional bytes body = 4; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - /** - * optional bytes body = 4; - */ - public Builder setBody(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - body_ = value; - onChanged(); - return this; - } - /** - * optional bytes body = 4; - */ - public Builder clearBody() { - bitField0_ = (bitField0_ & ~0x00000010); - body_ = getDefaultInstance().getBody(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.WebSocketResponseMessage) - } - - static { - defaultInstance = new WebSocketResponseMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.WebSocketResponseMessage) - } - - public interface WebSocketMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional .textsecure.WebSocketMessage.Type type = 1; - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - boolean hasType(); - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type getType(); - - // optional .textsecure.WebSocketRequestMessage request = 2; - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - boolean hasRequest(); - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage getRequest(); - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder getRequestOrBuilder(); - - // optional .textsecure.WebSocketResponseMessage response = 3; - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - boolean hasResponse(); - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage getResponse(); - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder getResponseOrBuilder(); - } - /** - * Protobuf type {@code textsecure.WebSocketMessage} - */ - public static final class WebSocketMessage extends - com.google.protobuf.GeneratedMessage - implements WebSocketMessageOrBuilder { - // Use WebSocketMessage.newBuilder() to construct. - private WebSocketMessage(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private WebSocketMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final WebSocketMessage defaultInstance; - public static WebSocketMessage getDefaultInstance() { - return defaultInstance; - } - - public WebSocketMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private WebSocketMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type value = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = value; - } - break; - } - case 18: { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = request_.toBuilder(); - } - request_ = input.readMessage(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(request_); - request_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - case 26: { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - subBuilder = response_.toBuilder(); - } - response_ = input.readMessage(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(response_); - response_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000004; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public WebSocketMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new WebSocketMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - /** - * Protobuf enum {@code textsecure.WebSocketMessage.Type} - */ - public enum Type - implements com.google.protobuf.ProtocolMessageEnum { - /** - * UNKNOWN = 0; - */ - UNKNOWN(0, 0), - /** - * REQUEST = 1; - */ - REQUEST(1, 1), - /** - * RESPONSE = 2; - */ - RESPONSE(2, 2), - ; - - /** - * UNKNOWN = 0; - */ - public static final int UNKNOWN_VALUE = 0; - /** - * REQUEST = 1; - */ - public static final int REQUEST_VALUE = 1; - /** - * RESPONSE = 2; - */ - public static final int RESPONSE_VALUE = 2; - - - public final int getNumber() { return value; } - - public static Type valueOf(int value) { - switch (value) { - case 0: return UNKNOWN; - case 1: return REQUEST; - case 2: return RESPONSE; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Type findValueByNumber(int number) { - return Type.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.getDescriptor().getEnumTypes().get(0); - } - - private static final Type[] VALUES = values(); - - public static Type valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Type(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:textsecure.WebSocketMessage.Type) - } - - private int bitField0_; - // optional .textsecure.WebSocketMessage.Type type = 1; - public static final int TYPE_FIELD_NUMBER = 1; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type type_; - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type getType() { - return type_; - } - - // optional .textsecure.WebSocketRequestMessage request = 2; - public static final int REQUEST_FIELD_NUMBER = 2; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage request_; - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public boolean hasRequest() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage getRequest() { - return request_; - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder getRequestOrBuilder() { - return request_; - } - - // optional .textsecure.WebSocketResponseMessage response = 3; - public static final int RESPONSE_FIELD_NUMBER = 3; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage response_; - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public boolean hasResponse() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage getResponse() { - return response_; - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder getResponseOrBuilder() { - return response_; - } - - private void initFields() { - type_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type.UNKNOWN; - request_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance(); - response_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, request_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, response_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, request_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, response_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code textsecure.WebSocketMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.class, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Builder.class); - } - - // Construct using org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getRequestFieldBuilder(); - getResponseFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type.UNKNOWN; - bitField0_ = (bitField0_ & ~0x00000001); - if (requestBuilder_ == null) { - request_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance(); - } else { - requestBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (responseBuilder_ == null) { - response_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance(); - } else { - responseBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.internal_static_textsecure_WebSocketMessage_descriptor; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage getDefaultInstanceForType() { - return org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.getDefaultInstance(); - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage build() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage buildPartial() { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage result = new org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (requestBuilder_ == null) { - result.request_ = request_; - } else { - result.request_ = requestBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (responseBuilder_ == null) { - result.response_ = response_; - } else { - result.response_ = responseBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage) { - return mergeFrom((org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage other) { - if (other == org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasRequest()) { - mergeRequest(other.getRequest()); - } - if (other.hasResponse()) { - mergeResponse(other.getResponse()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional .textsecure.WebSocketMessage.Type type = 1; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type type_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type.UNKNOWN; - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type getType() { - return type_; - } - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public Builder setType(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value; - onChanged(); - return this; - } - /** - * optional .textsecure.WebSocketMessage.Type type = 1; - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketMessage.Type.UNKNOWN; - onChanged(); - return this; - } - - // optional .textsecure.WebSocketRequestMessage request = 2; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage request_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder> requestBuilder_; - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public boolean hasRequest() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage getRequest() { - if (requestBuilder_ == null) { - return request_; - } else { - return requestBuilder_.getMessage(); - } - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public Builder setRequest(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage value) { - if (requestBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - request_ = value; - onChanged(); - } else { - requestBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public Builder setRequest( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder builderForValue) { - if (requestBuilder_ == null) { - request_ = builderForValue.build(); - onChanged(); - } else { - requestBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public Builder mergeRequest(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage value) { - if (requestBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - request_ != org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance()) { - request_ = - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.newBuilder(request_).mergeFrom(value).buildPartial(); - } else { - request_ = value; - } - onChanged(); - } else { - requestBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public Builder clearRequest() { - if (requestBuilder_ == null) { - request_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.getDefaultInstance(); - onChanged(); - } else { - requestBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder getRequestBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getRequestFieldBuilder().getBuilder(); - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder getRequestOrBuilder() { - if (requestBuilder_ != null) { - return requestBuilder_.getMessageOrBuilder(); - } else { - return request_; - } - } - /** - * optional .textsecure.WebSocketRequestMessage request = 2; - */ - private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder> - getRequestFieldBuilder() { - if (requestBuilder_ == null) { - requestBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketRequestMessageOrBuilder>( - request_, - getParentForChildren(), - isClean()); - request_ = null; - } - return requestBuilder_; - } - - // optional .textsecure.WebSocketResponseMessage response = 3; - private org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage response_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder> responseBuilder_; - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public boolean hasResponse() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage getResponse() { - if (responseBuilder_ == null) { - return response_; - } else { - return responseBuilder_.getMessage(); - } - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public Builder setResponse(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage value) { - if (responseBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - response_ = value; - onChanged(); - } else { - responseBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public Builder setResponse( - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder builderForValue) { - if (responseBuilder_ == null) { - response_ = builderForValue.build(); - onChanged(); - } else { - responseBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public Builder mergeResponse(org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage value) { - if (responseBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - response_ != org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance()) { - response_ = - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.newBuilder(response_).mergeFrom(value).buildPartial(); - } else { - response_ = value; - } - onChanged(); - } else { - responseBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public Builder clearResponse() { - if (responseBuilder_ == null) { - response_ = org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.getDefaultInstance(); - onChanged(); - } else { - responseBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder getResponseBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getResponseFieldBuilder().getBuilder(); - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - public org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder getResponseOrBuilder() { - if (responseBuilder_ != null) { - return responseBuilder_.getMessageOrBuilder(); - } else { - return response_; - } - } - /** - * optional .textsecure.WebSocketResponseMessage response = 3; - */ - private com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder> - getResponseFieldBuilder() { - if (responseBuilder_ == null) { - responseBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessage.Builder, org.whispersystems.websocket.messages.protobuf.SubProtocol.WebSocketResponseMessageOrBuilder>( - response_, - getParentForChildren(), - isClean()); - response_ = null; - } - return responseBuilder_; - } - - // @@protoc_insertion_point(builder_scope:textsecure.WebSocketMessage) - } - - static { - defaultInstance = new WebSocketMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.WebSocketMessage) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_WebSocketRequestMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_WebSocketRequestMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_WebSocketResponseMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_WebSocketResponseMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_WebSocketMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_WebSocketMessage_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\021SubProtocol.proto\022\ntextsecure\"`\n\027WebSo" + - "cketRequestMessage\022\014\n\004verb\030\001 \001(\t\022\014\n\004path" + - "\030\002 \001(\t\022\017\n\007headers\030\005 \003(\t\022\014\n\004body\030\003 \001(\014\022\n\n" + - "\002id\030\004 \001(\004\"f\n\030WebSocketResponseMessage\022\n\n" + - "\002id\030\001 \001(\004\022\016\n\006status\030\002 \001(\r\022\017\n\007message\030\003 \001" + - "(\t\022\017\n\007headers\030\005 \003(\t\022\014\n\004body\030\004 \001(\014\"\341\001\n\020We" + - "bSocketMessage\022/\n\004type\030\001 \001(\0162!.textsecur" + - "e.WebSocketMessage.Type\0224\n\007request\030\002 \001(\013" + - "2#.textsecure.WebSocketRequestMessage\0226\n" + - "\010response\030\003 \001(\0132$.textsecure.WebSocketRe", - "sponseMessage\".\n\004Type\022\013\n\007UNKNOWN\020\000\022\013\n\007RE" + - "QUEST\020\001\022\014\n\010RESPONSE\020\002B0\n.org.whispersyst" + - "ems.websocket.messages.protobuf" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_textsecure_WebSocketRequestMessage_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_textsecure_WebSocketRequestMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_WebSocketRequestMessage_descriptor, - new java.lang.String[] { "Verb", "Path", "Headers", "Body", "Id", }); - internal_static_textsecure_WebSocketResponseMessage_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_textsecure_WebSocketResponseMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_WebSocketResponseMessage_descriptor, - new java.lang.String[] { "Id", "Status", "Message", "Headers", "Body", }); - internal_static_textsecure_WebSocketMessage_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_textsecure_WebSocketMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_WebSocketMessage_descriptor, - new java.lang.String[] { "Type", "Request", "Response", }); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/websocket-resources/src/main/proto/WebSocketProtocol.proto b/websocket-resources/src/main/proto/WebSocketProtocol.proto new file mode 100644 index 000000000..cc28f8925 --- /dev/null +++ b/websocket-resources/src/main/proto/WebSocketProtocol.proto @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Signal Messenger, LLC + * SPDX-License-Identifier: AGPL-3.0-only + */ + +syntax = "proto2"; + +package signalservice; + +option java_package = "org.whispersystems.websocket.messages.protobuf"; +option java_outer_classname = "SubProtocol"; + +message WebSocketRequestMessage { + optional string verb = 1; + optional string path = 2; + optional bytes body = 3; + repeated string headers = 5; + optional uint64 id = 4; +} + +message WebSocketResponseMessage { + optional uint64 id = 1; + 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; + } + + optional Type type = 1; + optional WebSocketRequestMessage request = 2; + optional WebSocketResponseMessage response = 3; +}