100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Replace pre-built gRPC JARs with Gradle Protobuf generation for ChirpStack and TTS (#2576)
rainerhitz16fafa83f21d
diff --git a/agent/build.gradle b/agent/build.gradleindex 5b1d3c764..ae5623200 100644--- a/agent/build.gradle+++ b/agent/build.gradle@@ -1,7 +1,17 @@+buildscript {+ repositories {+ mavenCentral()+ }+ dependencies {+ classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion"+ }+}+apply plugin: "java-library"apply plugin: "groovy"apply plugin: "maven-publish"apply plugin: "signing"+apply plugin: "com.google.protobuf"dependencies {@@ -49,13 +59,41 @@ dependencies {implementation "io.grpc:grpc-protobuf:$grpcVersion"implementation "io.grpc:grpc-stub:$grpcVersion"+ compileOnly "javax.annotation:javax.annotation-api:$grpcAnnotationsVersion"+testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"testImplementation "org.mockito:mockito-core:$mockitoVersion"testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"testRuntimeOnly "org.junit.platform:junit-platform-launcher"+}++protobuf {+ protoc {+ artifact = "com.google.protobuf:protoc:$protobufVersion"+ }+ plugins {+ grpc {+ artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"+ }+ }+ generateProtoTasks {+ all()*.plugins {+ grpc {}+ }+ }+}- implementation files("libs/chirpstack-api-4.14.1.jar")- implementation files("libs/tts-api-3.34.3.jar")+sourceSets {+ main {+ proto {+ srcDirs.clear()+ srcDirs = [+ 'src/main/proto/chirpstack',+ 'src/main/proto/tts',+ 'src/main/proto/shared'+ ]+ }+ }}base {diff --git a/agent/libs/chirpstack-api-4.14.1.jar b/agent/libs/chirpstack-api-4.14.1.jardeleted file mode 100644index c27151ba2..000000000Binary files a/agent/libs/chirpstack-api-4.14.1.jar and /dev/null differdiff --git a/agent/libs/tts-api-3.34.3.jar b/agent/libs/tts-api-3.34.3.jardeleted file mode 100644index ffa34dcdc..000000000Binary files a/agent/libs/tts-api-3.34.3.jar and /dev/null differdiff --git a/agent/src/main/proto/chirpstack/README.md b/agent/src/main/proto/chirpstack/README.mdnew file mode 100644index 000000000..783e23ddf--- /dev/null+++ b/agent/src/main/proto/chirpstack/README.md@@ -0,0 +1,31 @@+# ChirpStack gRPC API Proto Files++This directory contains the Protocol Buffer definitions (`.proto`) required to generate Java client classes for the ChirpStack gRPC API.++## Source Information++* **Upstream Repository:** [https://github.com/chirpstack/chirpstack](https://github.com/chirpstack/chirpstack)+* **ChirpStack Version:** `v4.14.1`+* **Source Path:** `api/proto/`++## Directory List++The following directories were copied from the source:++* `api/`+* `common/`+* `gw/`+* `integration/`+* `internal/`+* `stream/`++> [!NOTE]+> The files located in `api/proto/google/api` in the upstream repository must be copied to the local `shared/google/api` directory to ensure successful compilation.++## How to Update++1. Identify the desired version tag on the [ChirpStack Releases](https://github.com/chirpstack/chirpstack/releases) page.+2. Download the folders listed above from the corresponding version branch.+3. Replace the local `.proto` files.+4. Ensure the `shared/google/api` files are updated if the upstream dependencies have changed.+5. Re-run the builddiff --git a/agent/src/main/proto/chirpstack/api/application.proto b/agent/src/main/proto/chirpstack/api/application.protonew file mode 100644index 000000000..810376b0d--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/application.proto@@ -0,0 +1,1010 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "ApplicationProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";++// ApplicationService is the service providing API methods for managing+// applications.+service ApplicationService {+ // Create creates the given application.+ rpc Create(CreateApplicationRequest) returns (CreateApplicationResponse) {+ option (google.api.http) = {+ post : "/api/applications"+ body : "*"+ };+ }++ // Get the application for the given ID.+ rpc Get(GetApplicationRequest) returns (GetApplicationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{id}"+ };+ }++ // Update updates the given application.+ rpc Update(UpdateApplicationRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{application.id}"+ body : "*"+ };+ }++ // Delete the application for the given ID.+ rpc Delete(DeleteApplicationRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{id}"+ };+ }++ // Get the list of applications.+ rpc List(ListApplicationsRequest) returns (ListApplicationsResponse) {+ option (google.api.http) = {+ get : "/api/applications"+ };+ }++ // List all configured integrations.+ rpc ListIntegrations(ListIntegrationsRequest)+ returns (ListIntegrationsResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations"+ };+ }++ // Create HTTP integration.+ rpc CreateHttpIntegration(CreateHttpIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/http"+ body : "*"+ };+ }++ // Get the configured HTTP integration.+ rpc GetHttpIntegration(GetHttpIntegrationRequest)+ returns (GetHttpIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/http"+ };+ }++ // Update the HTTP integration.+ rpc UpdateHttpIntegration(UpdateHttpIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/http"+ body : "*"+ };+ }++ // Delete the HTTP integration.+ rpc DeleteHttpIntegration(DeleteHttpIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/http"+ };+ }++ // Create InfluxDb integration.+ rpc CreateInfluxDbIntegration(CreateInfluxDbIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "influxdb"+ body : "*"+ };+ }++ // Get InfluxDb integration.+ rpc GetInfluxDbIntegration(GetInfluxDbIntegrationRequest)+ returns (GetInfluxDbIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/influxdb"+ };+ }++ // Update InfluxDb integration.+ rpc UpdateInfluxDbIntegration(UpdateInfluxDbIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "influxdb"+ body : "*"+ };+ }++ // Delete InfluxDb integration.+ rpc DeleteInfluxDbIntegration(DeleteInfluxDbIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/influxdb"+ };+ }++ // Create ThingsBoard integration.+ rpc CreateThingsBoardIntegration(CreateThingsBoardIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "thingsboard"+ body : "*"+ };+ }++ // Get ThingsBoard integration.+ rpc GetThingsBoardIntegration(GetThingsBoardIntegrationRequest)+ returns (GetThingsBoardIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/thingsboard"+ };+ }++ // Update ThingsBoard integration.+ rpc UpdateThingsBoardIntegration(UpdateThingsBoardIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "thingsboard"+ body : "*"+ };+ }++ // Delete ThingsBoard integration.+ rpc DeleteThingsBoardIntegration(DeleteThingsBoardIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/thingsboard"+ };+ }++ // Create myDevices integration.+ rpc CreateMyDevicesIntegration(CreateMyDevicesIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "mydevices"+ body : "*"+ };+ }++ // Get myDevices integration.+ rpc GetMyDevicesIntegration(GetMyDevicesIntegrationRequest)+ returns (GetMyDevicesIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/mydevices"+ };+ }++ // Update myDevices integration.+ rpc UpdateMyDevicesIntegration(UpdateMyDevicesIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "mydevices"+ body : "*"+ };+ }++ // Delete myDevices integration.+ rpc DeleteMyDevicesIntegration(DeleteMyDevicesIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/mydevices"+ };+ }++ // Create GCP Pub/Sub integration.+ rpc CreateGcpPubSubIntegration(CreateGcpPubSubIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "gcp-pub-sub"+ body : "*"+ };+ }++ // Get GCP Pub/Sub integration.+ rpc GetGcpPubSubIntegration(GetGcpPubSubIntegrationRequest)+ returns (GetGcpPubSubIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/gcp-pub-sub"+ };+ }++ // Update GCP Pub/Sub integration.+ rpc UpdateGcpPubSubIntegration(UpdateGcpPubSubIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "gcp-pub-sub"+ body : "*"+ };+ }++ // Delete GCP Pub/Sub integration.+ rpc DeleteGcpPubSubIntegration(DeleteGcpPubSubIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/gcp-pub-sub"+ };+ }++ // Create AWS SNS integration.+ rpc CreateAwsSnsIntegration(CreateAwsSnsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "aws-sns"+ body : "*"+ };+ }++ // Get AWS SNS integration.+ rpc GetAwsSnsIntegration(GetAwsSnsIntegrationRequest)+ returns (GetAwsSnsIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/aws-sns"+ };+ }++ // Update AWS SNS integration.+ rpc UpdateAwsSnsIntegration(UpdateAwsSnsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "aws-sns"+ body : "*"+ };+ }++ // Delete AWS SNS integration.+ rpc DeleteAwsSnsIntegration(DeleteAwsSnsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/aws-sns"+ };+ }++ // Create Azure Service-Bus integration.+ rpc CreateAzureServiceBusIntegration(CreateAzureServiceBusIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "azure-service-bus"+ body : "*"+ };+ }++ // Get Azure Service-Bus integration.+ rpc GetAzureServiceBusIntegration(GetAzureServiceBusIntegrationRequest)+ returns (GetAzureServiceBusIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/azure-service-bus"+ };+ }++ // Update Azure Service-Bus integration.+ rpc UpdateAzureServiceBusIntegration(UpdateAzureServiceBusIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "azure-service-bus"+ body : "*"+ };+ }++ // Delete Azure Service-Bus integration.+ rpc DeleteAzureServiceBusIntegration(DeleteAzureServiceBusIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/"+ "azure-service-bus"+ };+ }++ // Create Pilot Things integration.+ rpc CreatePilotThingsIntegration(CreatePilotThingsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/"+ "pilot-things"+ body : "*"+ };+ }++ // Get Pilot Things integration.+ rpc GetPilotThingsIntegration(GetPilotThingsIntegrationRequest)+ returns (GetPilotThingsIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/pilot-things"+ };+ }++ // Update Pilot Things integration.+ rpc UpdatePilotThingsIntegration(UpdatePilotThingsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/"+ "pilot-things"+ body : "*"+ };+ }++ // Delete Pilot Things integration.+ rpc DeletePilotThingsIntegration(DeletePilotThingsIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/pilot-things"+ };+ }++ // Create IFTTT integration.+ rpc CreateIftttIntegration(CreateIftttIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/applications/{integration.application_id}/integrations/ifttt"+ body : "*"+ };+ }++ // Get IFTTT integration.+ rpc GetIftttIntegration(GetIftttIntegrationRequest)+ returns (GetIftttIntegrationResponse) {+ option (google.api.http) = {+ get : "/api/applications/{application_id}/integrations/ifttt"+ };+ }++ // Update IFTTT integration.+ rpc UpdateIftttIntegration(UpdateIftttIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/applications/{integration.application_id}/integrations/ifttt"+ body : "*"+ };+ }++ // Delete IFTTT integration.+ rpc DeleteIftttIntegration(DeleteIftttIntegrationRequest)+ returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/applications/{application_id}/integrations/ifttt"+ };+ }++ // Generates application ID specific client-certificate.+ rpc GenerateMqttIntegrationClientCertificate(+ GenerateMqttIntegrationClientCertificateRequest)+ returns (GenerateMqttIntegrationClientCertificateResponse) {+ option (google.api.http) = {+ post : "/api/applications/{application_id}/integrations/mqtt/certificate"+ };+ }++ // List device-profiles used within the given application.+ rpc ListDeviceProfiles(ListApplicationDeviceProfilesRequest) returns (ListApplicationDeviceProfilesResponse) {+ option (google.api.http) = {+ get: "/api/applications/{application_id}/device-profiles"+ };+ }++ // List device tags used within the given application.+ rpc ListDeviceTags(ListApplicationDeviceTagsRequest) returns (ListApplicationDeviceTagsResponse) {+ option (google.api.http) = {+ get: "/api/applications/{application_id}/device-tags"+ };+ }+}++enum Encoding {+ JSON = 0;+ PROTOBUF = 1;+}++enum IntegrationKind {+ HTTP = 0;+ INFLUX_DB = 1;+ THINGS_BOARD = 2;+ MY_DEVICES = 3;+ GCP_PUB_SUB = 5;+ AWS_SNS = 6;+ AZURE_SERVICE_BUS = 7;+ PILOT_THINGS = 8;+ MQTT_GLOBAL = 9;+ IFTTT = 10;+}++message Application {+ // Application ID (UUID).+ // Note: on create this will be automatically generated.+ string id = 1;++ // Application name.+ string name = 2;++ // Application description.+ string description = 3;++ // Tenant ID (UUID).+ string tenant_id = 4;++ // Tags (user defined).+ // These tags can be used to add additional information to the application.+ // These tags are exposed in all the integration events of devices under+ // this application.+ map<string, string> tags = 5;+}++message ApplicationListItem {+ // Application ID (UUID).+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Application name.+ string name = 4;++ // Application description.+ string description = 5;+}++message CreateApplicationRequest {+ // Application object to create.+ Application application = 1;+}++message CreateApplicationResponse {+ // Application ID (UUID).+ string id = 1;+}++message GetApplicationRequest {+ // Application ID (UUID).+ string id = 1;+}++message GetApplicationResponse {+ // Application object.+ Application application = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Measurement keys.+ // This contains the measurement keys from all the device-profiles that+ // are used by the devices under this application.+ repeated string measurement_keys = 4;+}++message UpdateApplicationRequest {+ // Application object.+ Application application = 1;+}++message DeleteApplicationRequest {+ // Application ID (UUID).+ string id = 1;+}++message ListApplicationsRequest {+ // Max number of applications to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name (optional).+ string search = 3;++ // Tenant ID to list the applications for.+ string tenant_id = 4;+}++message ListApplicationsResponse {+ // Total number of applications.+ uint32 total_count = 1;++ // Result-set.+ repeated ApplicationListItem result = 2;+}++message ListIntegrationsRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message IntegrationListItem {+ // Integration kind.+ IntegrationKind kind = 1;+}++message ListIntegrationsResponse {+ // Total number of integrations available within the result-set.+ uint32 total_count = 1;++ // Integrations within result-set.+ repeated IntegrationListItem result = 2;+}++message HttpIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // HTTP headers to set when making requests.+ map<string, string> headers = 2;++ // Payload encoding.+ Encoding encoding = 3;++ // Event endpoint URL.+ // The HTTP integration will POST all events to this enpoint. The request+ // will contain a query parameters "event" containing the type of the+ // event.+ string event_endpoint_url = 4;+}++message CreateHttpIntegrationRequest {+ // Integration object to create.+ HttpIntegration integration = 1;+}++message GetHttpIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetHttpIntegrationResponse {+ // Integration object.+ HttpIntegration integration = 1;+}++message UpdateHttpIntegrationRequest {+ // Integration object to update.+ HttpIntegration integration = 1;+}++message DeleteHttpIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++enum InfluxDbPrecision {+ NS = 0;+ U = 1;+ MS = 2;+ S = 3;+ M = 4;+ H = 5;+}++enum InfluxDbVersion {+ INFLUXDB_1 = 0;+ INFLUXDB_2 = 1;+}++message InfluxDbIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // InfluxDb API write endpoint (e.g. http://localhost:8086/write).+ string endpoint = 2;++ // InfluxDb database name. (InfluxDb v1)+ string db = 3;++ // InfluxDb username. (InfluxDb v1)+ string username = 4;++ // InfluxDb password. (InfluxDb v1)+ string password = 5;++ // InfluxDb retention policy name. (InfluxDb v1)+ string retention_policy_name = 6;++ // InfluxDb timestamp precision (InfluxDb v1).+ InfluxDbPrecision precision = 7;++ // InfluxDb version.+ InfluxDbVersion version = 8;++ // Token. (InfluxDb v2)+ string token = 9;++ // Organization. (InfluxDb v2)+ string organization = 10;++ // Bucket. (InfluxDb v2)+ string bucket = 11;+}++message CreateInfluxDbIntegrationRequest {+ // Integration object to create.+ InfluxDbIntegration integration = 1;+}++message GetInfluxDbIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetInfluxDbIntegrationResponse {+ // Integration object.+ InfluxDbIntegration integration = 1;+}++message UpdateInfluxDbIntegrationRequest {+ // Integration object to update.+ InfluxDbIntegration integration = 1;+}++message DeleteInfluxDbIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message ThingsBoardIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // ThingsBoard server endpoint, e.g. https://example.com+ string server = 2;+}++message CreateThingsBoardIntegrationRequest {+ // Integration object to create.+ ThingsBoardIntegration integration = 1;+}++message GetThingsBoardIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetThingsBoardIntegrationResponse {+ // Integration object.+ ThingsBoardIntegration integration = 1;+}++message UpdateThingsBoardIntegrationRequest {+ // Integration object to update.+ ThingsBoardIntegration integration = 1;+}++message DeleteThingsBoardIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message MyDevicesIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // myDevices API endpoint.+ string endpoint = 2;+}++message CreateMyDevicesIntegrationRequest {+ // Integration object to create.+ MyDevicesIntegration integration = 1;+}++message GetMyDevicesIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetMyDevicesIntegrationResponse {+ // Integration object.+ MyDevicesIntegration integration = 1;+}++message UpdateMyDevicesIntegrationRequest {+ // Integration object to update.+ MyDevicesIntegration integration = 1;+}++message DeleteMyDevicesIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GcpPubSubIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // Encoding.+ Encoding encoding = 2;++ // Credentials file.+ // This IAM service-account credentials file (JSON) must have the following+ // Pub/Sub roles:+ // * Pub/Sub Publisher+ string credentials_file = 3;++ // Project ID.+ string project_id = 4;++ // Topic name.+ // This is the name of the Pub/Sub topic.+ string topic_name = 5;+}++message CreateGcpPubSubIntegrationRequest {+ // Integration object to create.+ GcpPubSubIntegration integration = 1;+}++message GetGcpPubSubIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetGcpPubSubIntegrationResponse {+ // Integration object.+ GcpPubSubIntegration integration = 1;+}++message UpdateGcpPubSubIntegrationRequest {+ // Integration object to update.+ GcpPubSubIntegration integration = 1;+}++message DeleteGcpPubSubIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message AwsSnsIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // Encoding.+ Encoding encoding = 2;++ // AWS region.+ string region = 3;++ // AWS Access Key ID.+ string access_key_id = 4;++ // AWS Secret Access Key.+ string secret_access_key = 5;++ // Topic ARN.+ string topic_arn = 6;+}++message CreateAwsSnsIntegrationRequest {+ // Integration object to create.+ AwsSnsIntegration integration = 1;+}++message GetAwsSnsIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetAwsSnsIntegrationResponse {+ // Integration object.+ AwsSnsIntegration integration = 1;+}++message UpdateAwsSnsIntegrationRequest {+ // Integration object to update.+ AwsSnsIntegration integration = 1;+}++message DeleteAwsSnsIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message AzureServiceBusIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // Encoding.+ Encoding encoding = 2;++ // Connection string.+ string connection_string = 3;++ // Publish name.+ // This is the name of the topic or queue.+ string publish_name = 4;+}++message CreateAzureServiceBusIntegrationRequest {+ // Integration object to create.+ AzureServiceBusIntegration integration = 1;+}++message GetAzureServiceBusIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetAzureServiceBusIntegrationResponse {+ // Integration object.+ AzureServiceBusIntegration integration = 1;+}++message UpdateAzureServiceBusIntegrationRequest {+ // Integration object to create.+ AzureServiceBusIntegration integration = 1;+}++message DeleteAzureServiceBusIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message PilotThingsIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // Server URL.+ string server = 2;++ // Authentication token.+ string token = 3;+}++message CreatePilotThingsIntegrationRequest {+ // Integration object to create.+ PilotThingsIntegration integration = 1;+}++message GetPilotThingsIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetPilotThingsIntegrationResponse {+ // Integration object.+ PilotThingsIntegration integration = 1;+}++message UpdatePilotThingsIntegrationRequest {+ // Integration object to update.+ PilotThingsIntegration integration = 1;+}++message DeletePilotThingsIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message IftttIntegration {+ // Application ID (UUID).+ string application_id = 1;++ // Key.+ // This key can be obtained from the IFTTT Webhooks documentation page.+ string key = 2;++ // Values.+ // Up to 2 values can be forwarded to IFTTT. These values must map to the+ // decoded payload keys. For example:+ // {+ // "batteryLevel": 75.3,+ // "buttons": [{"pressed": false}, {"pressed": true}]+ // }+ // You would specify the following fields:+ // uplink_values = ["batteryLevel", "buttons_0_pressed"]+ //+ // Notes: The first value is always used for the DevEUI.+ // Ignored if arbitrary_json is set to true.+ repeated string uplink_values = 3;++ // Arbitrary JSON.+ // If set to true, ChirpStack events will be sent as-is as arbitrary JSON+ // payload. If set to false (default), the 3 JSON values format will be used.+ bool arbitrary_json = 4;++ // Event prefix.+ // If set, the event name will be PREFIX_EVENT. For example if event_prefix+ // is set to weatherstation, and uplink event will be sent as+ // weatherstation_up to the IFTTT webhook.+ // Note: Only characters in the A-Z, a-z and 0-9 range are allowed.+ string event_prefix = 5;+}++message CreateIftttIntegrationRequest {+ // Integration object.+ IftttIntegration integration = 1;+}++message GetIftttIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GetIftttIntegrationResponse {+ // Integration object.+ IftttIntegration integration = 1;+}++message UpdateIftttIntegrationRequest {+ // Integration object to update.+ IftttIntegration integration = 1;+}++message DeleteIftttIntegrationRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GenerateMqttIntegrationClientCertificateRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message GenerateMqttIntegrationClientCertificateResponse {+ // TLS certificate.+ string tls_cert = 1;++ // TLS key.+ string tls_key = 2;++ // CA certificate.+ string ca_cert = 3;++ // Expires at defines the expiration date of the certificate.+ google.protobuf.Timestamp expires_at = 4;+}++message ApplicationDeviceProfileListItem {+ // Device-profile ID (UUID).+ string id = 1;++ // Name.+ string name = 2;+}++message ListApplicationDeviceProfilesRequest {+ // Application ID (UUID).+ string application_id = 1;+};++message ListApplicationDeviceProfilesResponse {+ // Device-profiles.+ repeated ApplicationDeviceProfileListItem result = 1;+}++message ApplicationDeviceTagListItem {+ // Tag key.+ string key = 1;++ // Used values.+ repeated string values = 2;+}++message ListApplicationDeviceTagsRequest {+ // Application ID (UUID).+ string application_id = 1;+}++message ListApplicationDeviceTagsResponse {+ // Device tags.+ repeated ApplicationDeviceTagListItem result = 1;+}diff --git a/agent/src/main/proto/chirpstack/api/device.proto b/agent/src/main/proto/chirpstack/api/device.protonew file mode 100644index 000000000..c5777456d--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/device.proto@@ -0,0 +1,626 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "DeviceProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "common/common.proto";+import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/empty.proto";++// DeviceService is the service providing API methods for managing devices.+service DeviceService {+ // Create the given device.+ rpc Create(CreateDeviceRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/devices"+ body : "*"+ };+ }++ // Get returns the device for the given DevEUI.+ rpc Get(GetDeviceRequest) returns (GetDeviceResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}"+ };+ }++ // Update the given device.+ rpc Update(UpdateDeviceRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/devices/{device.dev_eui}"+ body : "*"+ };+ }++ // Delete the device with the given DevEUI.+ rpc Delete(DeleteDeviceRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/devices/{dev_eui}"+ };+ }++ // Get the list of devices.+ rpc List(ListDevicesRequest) returns (ListDevicesResponse) {+ option (google.api.http) = {+ get : "/api/devices"+ };+ }++ // Create the given device-keys.+ rpc CreateKeys(CreateDeviceKeysRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/devices/{device_keys.dev_eui}/keys"+ body : "*"+ };+ }++ // Get the device-keys for the given DevEUI.+ rpc GetKeys(GetDeviceKeysRequest) returns (GetDeviceKeysResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}/keys"+ };+ }++ // Update the given device-keys.+ rpc UpdateKeys(UpdateDeviceKeysRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/devices/{device_keys.dev_eui}/keys"+ body : "*"+ };+ }++ // Delete the device-keys for the given DevEUI.+ rpc DeleteKeys(DeleteDeviceKeysRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/devices/{dev_eui}/keys"+ };+ }++ // FlushDevNonces flushes the OTAA device nonces.+ rpc FlushDevNonces(FlushDevNoncesRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/devices/{dev_eui}/dev-nonces"+ };+ }++ // Activate (re)activates the device with the given parameters (for ABP or for+ // importing OTAA activations).+ rpc Activate(ActivateDeviceRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/devices/{device_activation.dev_eui}/activate"+ body : "*"+ };+ }++ // Deactivate de-activates the device.+ rpc Deactivate(DeactivateDeviceRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/devices/{dev_eui}/activation"+ };+ }++ // GetActivation returns the current activation details of the device (OTAA or+ // ABP).+ rpc GetActivation(GetDeviceActivationRequest)+ returns (GetDeviceActivationResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}/activation"+ };+ }++ // GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into+ // account.+ rpc GetRandomDevAddr(GetRandomDevAddrRequest)+ returns (GetRandomDevAddrResponse) {+ option (google.api.http) = {+ post : "/api/devices/{dev_eui}/get-random-dev-addr"+ };+ }++ // GetMetrics returns the device metrics.+ // Note that this requires a device-profile with codec and measurements+ // configured.+ rpc GetMetrics(GetDeviceMetricsRequest) returns (GetDeviceMetricsResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}/metrics"+ };+ }++ // GetLinkMetrics returns the device link metrics.+ // This includes uplinks, downlinks, RSSI, SNR, etc...+ rpc GetLinkMetrics(GetDeviceLinkMetricsRequest)+ returns (GetDeviceLinkMetricsResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}/link-metrics"+ };+ }++ // Enqueue adds the given item to the downlink queue.+ rpc Enqueue(EnqueueDeviceQueueItemRequest)+ returns (EnqueueDeviceQueueItemResponse) {+ option (google.api.http) = {+ post : "/api/devices/{queue_item.dev_eui}/queue"+ body : "*"+ };+ }++ // FlushQueue flushes the downlink device-queue.+ rpc FlushQueue(FlushDeviceQueueRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/devices/{dev_eui}/queue"+ };+ }++ // GetQueue returns the downlink device-queue.+ rpc GetQueue(GetDeviceQueueItemsRequest)+ returns (GetDeviceQueueItemsResponse) {+ option (google.api.http) = {+ get : "/api/devices/{dev_eui}/queue"+ };+ }++ // GetNextFCntDown returns the next FCntDown to use for enqueing encrypted+ // downlinks. The difference with the DeviceActivation f_cont_down is that+ // this method takes potential existing queue-items into account.+ rpc GetNextFCntDown(GetDeviceNextFCntDownRequest)+ returns (GetDeviceNextFCntDownResponse) {+ option (google.api.http) = {+ post : "/api/devices/{dev_eui}/get-next-f-cnt-down"+ body : "*"+ };+ }+}++message Device {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Name.+ string name = 2;++ // Description.+ string description = 3;++ // Application ID (UUID).+ string application_id = 4;++ // Device-profile ID (UUID).+ string device_profile_id = 5;++ // Skip frame-counter checks (this is insecure, but could be helpful for+ // debugging).+ bool skip_fcnt_check = 6;++ // Device is disabled.+ bool is_disabled = 7;++ // Variables (user defined).+ // These variables can be used together with integrations to store tokens /+ // secrets that must be configured per device. These variables are not+ // exposed in the event payloads.+ map<string, string> variables = 8;++ // Tags (user defined).+ // These tags can be used to add additional information to the device.+ // These tags are exposed in all the integration events.+ map<string, string> tags = 9;++ // JoinEUI (optional, EUI64).+ // This field will be automatically set / updated on OTAA. However, in some+ // cases it must be pre-configured. For example to allow OTAA using a Relay.+ // In this case the Relay needs to know the JoinEUI + DevEUI combinations+ // of the devices for which it needs to forward uplinks.+ string join_eui = 10;+}++message DeviceStatus {+ // The device margin status+ // -32..32: The demodulation SNR ration in dB+ int32 margin = 1;++ // Device is connected to an external power source.+ bool external_power_source = 2;++ // Device battery level as a percentage.+ // -1 when the battery level is not available.+ float battery_level = 3;+}++message DeviceListItem {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 4;++ // Name.+ string name = 5;++ // Description.+ string description = 6;++ // Device-profile ID (UUID).+ string device_profile_id = 7;++ // Device-profile name.+ string device_profile_name = 8;++ // Device status.+ DeviceStatus device_status = 9;++ // Device tags.+ map<string, string> tags = 10;+}++message DeviceKeys {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Network root key (128 bit).+ // Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`!+ string nwk_key = 2;++ // Application root key (128 bit).+ // Note: This field only needs to be set for LoRaWAN 1.1.x devices!+ string app_key = 3;++ // Gen App Key (128 bit).+ // Note: This field only needs to be set for LoRaWAN 1.0.x devices that+ // implement TS005 (remote multicast setup).+ string gen_app_key = 4;+}++message CreateDeviceRequest {+ // Device object.+ Device device = 1;+}++message GetDeviceRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceResponse {+ // Device object.+ Device device = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 4;++ // Device status.+ DeviceStatus device_status = 5;++ // Enabled device class.+ common.DeviceClass class_enabled = 6;+}++message UpdateDeviceRequest {+ // Device object.+ Device device = 1;+}++message DeleteDeviceRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message ListDevicesRequest {+ // Max number of devices to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name (optional).+ string search = 3;++ // Application ID (UUID) to filter devices on.+ string application_id = 4;++ // Multicst-group ID (UUID) to filter devices on.+ string multicast_group_id = 5;++ enum OrderBy {+ NAME = 0;+ DEV_EUI = 1;+ LAST_SEEN_AT = 2;+ DEVICE_PROFILE_NAME = 3;+ }++ // If set, the given value will be used to sort by (optional).+ OrderBy order_by = 6;++ // If set, the sorting direction will be decending (default = ascending) (optional).+ bool order_by_desc = 7;++ // Tags to filter devices on.+ map<string, string> tags = 8;++ // Device-profile ID (UUID) to filter devices on.+ string device_profile_id = 9;+}++message ListDevicesResponse {+ // Total number of devices.+ uint32 total_count = 1;++ // Result-set.+ repeated DeviceListItem result = 2;+}++message CreateDeviceKeysRequest {+ // Device-keys object.+ DeviceKeys device_keys = 1;+}++message GetDeviceKeysRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceKeysResponse {+ // Device-keys object.+ DeviceKeys device_keys = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateDeviceKeysRequest {+ // Device-keys object.+ DeviceKeys device_keys = 1;+}++message DeleteDeviceKeysRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message DeviceActivation {+ // Device EUI (EUI64).+ string dev_eui = 1;++ // Device address (HEX encoded).+ string dev_addr = 2;++ // Application session key (HEX encoded).+ string app_s_key = 3;++ // Network session encryption key (HEX encoded).+ // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey.+ string nwk_s_enc_key = 4;++ // Serving network session integrity key (HEX encoded).+ // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey.+ string s_nwk_s_int_key = 8;++ // Forwarding network session integrity key (HEX encoded).+ // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey.+ string f_nwk_s_int_key = 9;++ // Uplink frame-counter.+ uint32 f_cnt_up = 5;++ // Downlink network frame-counter.+ uint32 n_f_cnt_down = 6;++ // Downlink application frame-counter.+ uint32 a_f_cnt_down = 10;+}++message ActivateDeviceRequest {+ // Device activation object.+ DeviceActivation device_activation = 1;+}++message DeactivateDeviceRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceActivationRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceActivationResponse {+ // Device activation object.+ DeviceActivation device_activation = 1;++ // Join-Server context.+ // A non-empty value indicatest that ChirpStack does not have access to+ // the AppSKey and that the encryption / decryption of the payloads is+ // the responsibility of the end-application.+ common.JoinServerContext join_server_context = 2;+}++message GetRandomDevAddrRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;+}++message GetRandomDevAddrResponse {+ // DevAddr.+ string dev_addr = 1;+}++message GetDeviceMetricsRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Interval start timestamp.+ google.protobuf.Timestamp start = 2;++ // Interval end timestamp.+ google.protobuf.Timestamp end = 3;++ // Aggregation.+ common.Aggregation aggregation = 4;+}++message GetDeviceMetricsResponse {+ map<string, common.Metric> metrics = 1;++ map<string, DeviceState> states = 2;+}++message DeviceState {+ // Name.+ string name = 2;++ // Value.+ string value = 3;+}++message GetDeviceLinkMetricsRequest {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Interval start timestamp.+ google.protobuf.Timestamp start = 2;++ // Interval end timestamp.+ google.protobuf.Timestamp end = 3;++ // Aggregation.+ common.Aggregation aggregation = 4;+}++message GetDeviceLinkMetricsResponse {+ // Packets received from the device.+ common.Metric rx_packets = 1;++ // RSSI (as reported by the gateway(s)).+ common.Metric gw_rssi = 2;++ // SNR (as reported by the gateway(s)).+ common.Metric gw_snr = 3;++ // Packets received by frequency.+ common.Metric rx_packets_per_freq = 4;++ // Packets received by DR.+ common.Metric rx_packets_per_dr = 5;++ // Errors.+ common.Metric errors = 6;+}++message DeviceQueueItem {+ // ID (UUID).+ // This is automatically generated on enqueue.+ string id = 1;++ // Device EUI (EUI64).+ string dev_eui = 2;++ // Confirmed.+ bool confirmed = 3;++ // FPort (must be > 0).+ // On enqueue and if using a JavaScript codec, this value might be+ // automatically set by the codec function.+ uint32 f_port = 4;++ // Data.+ // Or use the json_object field when a codec has been configured.+ bytes data = 5;++ // Only use this when a codec has been configured that can encode this+ // object to bytes.+ google.protobuf.Struct object = 6;++ // Is pending.+ // This is set by ChirpStack to true when the downlink is pending (e.g. it+ // has been sent, but a confirmation is still pending).+ bool is_pending = 7;++ // Downlink frame-counter.+ // Do not set this for plain-text data payloads. It will be automatically set+ // by ChirpStack when the payload has been sent as downlink.+ uint32 f_cnt_down = 8;++ // Is encrypted.+ // This must be set to true if the end-application has already encrypted+ // the data payload. In this case, the f_cnt_down field must be set to+ // the corresponding frame-counter which has been used during the encryption.+ bool is_encrypted = 9;++ // Expires at (optional).+ // Expired queue-items will be automatically removed from the queue.+ google.protobuf.Timestamp expires_at = 10;+}++message EnqueueDeviceQueueItemRequest {+ // Item to enqueue.+ DeviceQueueItem queue_item = 1;++ // Flush queue before enqueue.+ bool flush_queue = 2;+}++message EnqueueDeviceQueueItemResponse {+ // ID (UUID).+ string id = 1;+}++message FlushDeviceQueueRequest {+ // Device EUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceQueueItemsRequest {+ // Device EUI (EUI64).+ string dev_eui = 1;++ // Return only the count, not the result-set.+ bool count_only = 2;+}++message GetDeviceQueueItemsResponse {+ // Total number of queue items.+ uint32 total_count = 1;++ // Result-set.+ repeated DeviceQueueItem result = 2;+}++message FlushDevNoncesRequest {+ // Device EUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceNextFCntDownRequest {+ // Device EUI (EUI64).+ string dev_eui = 1;+}++message GetDeviceNextFCntDownResponse {+ // FCntDown.+ uint32 f_cnt_down = 1;+}diff --git a/agent/src/main/proto/chirpstack/api/device_profile.proto b/agent/src/main/proto/chirpstack/api/device_profile.protonew file mode 100644index 000000000..dcebe2346--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/device_profile.proto@@ -0,0 +1,599 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "DeviceProfileProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";++enum CodecRuntime {+ // None.+ NONE = 0;++ // Cayenne LPP.+ CAYENNE_LPP = 1;++ // JavaScript.+ JS = 2;+}++enum MeasurementKind {+ // Unknown (in which case it is not tracked).+ UNKNOWN = 0;++ // Incrementing counters that never decrease (these are not reset on each+ // reading).+ COUNTER = 1;++ // Counters that do get reset upon reading.+ ABSOLUTE = 2;++ // E.g. a temperature value.+ GAUGE = 3;++ // E.g. a firmware version, true / false value.+ STRING = 4;+}++enum CadPeriodicity {+ // 1 second.+ SEC_1 = 0;++ // 500 milliseconds+ MS_500 = 1;++ // 250 milliseconds+ MS_250 = 2;++ // 100 milliseconds+ MS_100 = 3;++ // 50 milliseconds+ MS_50 = 4;++ // 20 milliseconds+ MS_20 = 5;+}++enum SecondChAckOffset {+ // 0 kHz.+ KHZ_0 = 0;++ // 200 kHz.+ KHZ_200 = 1;++ // 400 kHz.+ KHZ_400 = 2;++ // 800 kHz.+ KHZ_800 = 3;++ // 1600 kHz.+ KHZ_1600 = 4;++ // 3200 kHz.+ KHZ_3200 = 5;+}++enum RelayModeActivation {+ // Disable the relay mode.+ DISABLE_RELAY_MODE = 0;++ // Enable the relay model.+ ENABLE_RELAY_MODE = 1;++ // Dynamic.+ DYNAMIC = 2;++ // End-device controlled.+ END_DEVICE_CONTROLLED = 3;+}++enum Ts003Version {+ // Not implemented.+ TS003_NOT_IMPLEMENTED = 0;++ // v1.0.0.+ TS003_V100 = 1;++ // v2.0.0+ TS003_v200 = 2;+}++enum Ts004Version {+ // Not implemented.+ TS004_NOT_IMPLEMENTED = 0;++ // v1.0.0.+ TS004_V100 = 1;++ // v2.0.0+ TS004_V200 = 2;+}++enum Ts005Version {+ // Not implemented.+ TS005_NOT_IMPLEMENTED = 0;++ // v1.0.0.+ TS005_V100 = 1;++ // v2.0.0+ TS005_V200 = 2;+}++// DeviceProfileService is the service providing API methods for managing+// device-profiles.+service DeviceProfileService {+ // Create the given device-profile.+ rpc Create(CreateDeviceProfileRequest) returns (CreateDeviceProfileResponse) {+ option (google.api.http) = {+ post : "/api/device-profiles"+ body : "*"+ };+ }++ // Get the device-profile for the given ID.+ rpc Get(GetDeviceProfileRequest) returns (GetDeviceProfileResponse) {+ option (google.api.http) = {+ get : "/api/device-profiles/{id}"+ };+ }++ // Update the given device-profile.+ rpc Update(UpdateDeviceProfileRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/device-profiles/{device_profile.id}"+ body : "*"+ };+ }++ // Delete the device-profile with the given ID.+ rpc Delete(DeleteDeviceProfileRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/device-profiles/{id}"+ };+ }++ // List the available device-profiles.+ rpc List(ListDeviceProfilesRequest) returns (ListDeviceProfilesResponse) {+ option (google.api.http) = {+ get : "/api/device-profiles"+ };+ }++ // List available ADR algorithms.+ rpc ListAdrAlgorithms(google.protobuf.Empty)+ returns (ListDeviceProfileAdrAlgorithmsResponse) {+ option (google.api.http) = {+ get : "/api/device-profiles/adr-algorithms"+ };+ }+}++message DeviceProfile {+ // Device-profile ID (UUID).+ // Note: on create this will be automatically generated.+ string id = 1;++ // Tenant ID (UUID).+ string tenant_id = 2;++ // Name.+ string name = 3;++ // Description.+ string description = 26;++ // Region.+ common.Region region = 4;++ // LoRaWAN mac-version.+ common.MacVersion mac_version = 5;++ // Regional parameters revision.+ common.RegParamsRevision reg_params_revision = 6;++ // ADR algorithm ID.+ string adr_algorithm_id = 7;++ // Payload codec runtime.+ CodecRuntime payload_codec_runtime = 8;++ // Payload codec script.+ string payload_codec_script = 9;++ // Flush queue on device activation.+ bool flush_queue_on_activate = 10;++ // Uplink interval (seconds).+ // This defines the expected uplink interval which the device uses for+ // communication. If the uplink interval has expired and no uplink has+ // been received, the device is considered inactive.+ uint32 uplink_interval = 11;++ // Device-status request interval (times / day).+ // This defines the times per day that ChirpStack will request the+ // device-status from the device.+ uint32 device_status_req_interval = 12;++ // Supports OTAA.+ bool supports_otaa = 13;++ // Supports Class B.+ bool supports_class_b = 14;++ // Supports Class-C.+ bool supports_class_c = 15;++ // Class-B timeout (seconds).+ // This is the maximum time ChirpStack will wait to receive an acknowledgement+ // from the device (if requested).+ uint32 class_b_timeout = 16;++ // Class-B ping-slot periodicity.+ // Valid options are: 0 - 7.+ //+ // Number of ping-slots per beacon-period:+ // pingNb = 2^(7-periodicity)+ //+ // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec+ // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec+ uint32 class_b_ping_slot_periodicity = 17;++ // Class-B ping-slot DR.+ uint32 class_b_ping_slot_dr = 18;++ // Class-B ping-slot freq (Hz).+ uint32 class_b_ping_slot_freq = 19;++ // Class-C timeout (seconds).+ // This is the maximum time ChirpStack will wait to receive an acknowledgement+ // from the device (if requested).+ uint32 class_c_timeout = 20;++ // RX1 delay (for ABP).+ uint32 abp_rx1_delay = 21;++ // RX1 DR offset (for ABP).+ uint32 abp_rx1_dr_offset = 22;++ // RX2 DR (for ABP).+ uint32 abp_rx2_dr = 23;++ // RX2 frequency (for ABP, Hz).+ uint32 abp_rx2_freq = 24;++ // Tags (user defined).+ // These tags can be used to add additional information the the+ // device-profile. These tags are exposed in all the integration events of+ // devices using this device-profile.+ map<string, string> tags = 25;++ // Measurements.+ // If defined, ChirpStack will visualize these metrics in the web-interface.+ map<string, Measurement> measurements = 27;++ // Auto-detect measurements.+ // If set to true, measurements will be automatically added based on the+ // keys of the decoded payload. In cases where the decoded payload contains+ // random keys in the data, you want to set this to false.+ bool auto_detect_measurements = 28;++ // Region configuration ID.+ // If set, devices will only use the associated region. If let blank, then+ // devices will use all regions matching the selected common-name. Note+ // that multiple region configurations can exist for the same common-name,+ // e.g. to provide an 8 channel and 16 channel configuration for the US915+ // band.+ string region_config_id = 29;++ // Device is a Relay device.+ // Enable this in case the device is a Relay. A Relay device implements TS011+ // and is able to relay data from relay capable devices.+ // See for more information the TS011 specification.+ bool is_relay = 30;++ // Device is a Relay end-device.+ // Enable this in case the device is an end-device that can operate under a+ // Relay. Please refer to the TS011 specification for more information.+ bool is_relay_ed = 31;++ // End-device only accept data through relay.+ // Only accept data for this device through a relay. This setting is useful+ // for testing as in case of a test-setup, the end-device is usually within+ // range of the gateway.+ bool relay_ed_relay_only = 32;++ // Relay must be enabled.+ bool relay_enabled = 33;++ // Relay CAD periodicity.+ CadPeriodicity relay_cad_periodicity = 34;++ // Relay default channel index.+ // Valid values are 0 and 1, please refer to the RP002 specification for+ // the meaning of these values.+ uint32 relay_default_channel_index = 35;++ // Relay second channel frequency (Hz).+ uint32 relay_second_channel_freq = 36;++ // Relay second channel DR.+ uint32 relay_second_channel_dr = 37;++ // Relay second channel ACK offset.+ SecondChAckOffset relay_second_channel_ack_offset = 38;++ // Relay end-device activation mode.+ RelayModeActivation relay_ed_activation_mode = 39;++ // Relay end-device smart-enable level.+ uint32 relay_ed_smart_enable_level = 40;++ // Relay end-device back-off (in case it does not receive WOR ACK frame).+ // 0 = Always send a LoRaWAN uplink+ // 1..63 = Send a LoRaWAN uplink after X WOR frames without a WOR ACK+ uint32 relay_ed_back_off = 41;++ // Relay end-device uplink limit bucket size.+ //+ // This field indicates the multiplier to determine the bucket size+ // according to the following formula:+ // BucketSize TOKEN = _reload_rate x _bucket_size+ //+ // Valid values (0 - 3):+ // 0 = 1+ // 1 = 2+ // 2 = 4+ // 3 = 12+ uint32 relay_ed_uplink_limit_bucket_size = 42;++ // Relay end-device uplink limit reload rate.+ //+ // Valid values:+ // * 0 - 62 = X tokens every hour+ // * 63 = no limitation+ uint32 relay_ed_uplink_limit_reload_rate = 43;++ // Relay join-request limit reload rate.+ //+ // Valid values:+ // * 0 - 126 = X tokens every hour+ // * 127 = no limitation+ uint32 relay_join_req_limit_reload_rate = 44;++ // Relay notify limit reload rate.+ //+ // Valid values:+ // * 0 - 126 = X tokens every hour+ // * 127 = no limitation+ uint32 relay_notify_limit_reload_rate = 45;++ // Relay global uplink limit reload rate.+ //+ // Valid values:+ // * 0 - 126 = X tokens every hour+ // * 127 = no limitation+ uint32 relay_global_uplink_limit_reload_rate = 46;++ // Relay overall limit reload rate.+ //+ // Valid values:+ // * 0 - 126 = X tokens every hour+ // * 127 = no limitation+ uint32 relay_overall_limit_reload_rate = 47;++ // Relay join-request limit bucket size.+ //+ // This field indicates the multiplier to determine the bucket size+ // according to the following formula:+ // BucketSize TOKEN = _reload_rate x _bucket_size+ //+ // Valid values (0 - 3):+ // 0 = 1+ // 1 = 2+ // 2 = 4+ // 3 = 12+ uint32 relay_join_req_limit_bucket_size = 48;++ // Relay notify limit bucket size.+ //+ // This field indicates the multiplier to determine the bucket size+ // according to the following formula:+ // BucketSize TOKEN = _reload_rate x _bucket_size+ //+ // Valid values (0 - 3):+ // 0 = 1+ // 1 = 2+ // 2 = 4+ // 3 = 12+ uint32 relay_notify_limit_bucket_size = 49;++ // Relay globak uplink limit bucket size.+ //+ // This field indicates the multiplier to determine the bucket size+ // according to the following formula:+ // BucketSize TOKEN = _reload_rate x _bucket_size+ //+ // Valid values (0 - 3):+ // 0 = 1+ // 1 = 2+ // 2 = 4+ // 3 = 12+ uint32 relay_global_uplink_limit_bucket_size = 50;++ // Relay overall limit bucket size.+ //+ // This field indicates the multiplier to determine the bucket size+ // according to the following formula:+ // BucketSize TOKEN = _reload_rate x _bucket_size+ //+ // Valid values (0 - 3):+ // 0 = 1+ // 1 = 2+ // 2 = 4+ // 3 = 12+ uint32 relay_overall_limit_bucket_size = 51;++ // Allow roaming.+ //+ // If set to true, it means that the device is allowed to use roaming.+ bool allow_roaming = 52;++ // RX1 Delay.+ //+ // This makes it possible to override the system RX1 Delay. Please note that+ // this values only has effect in case it is higher than the system value.+ // In other words, it can be used to increase the RX1 Delay but not to decrease+ // it.+ // Valid options are 1 - 15 (0 = always use system RX1 Delay).+ uint32 rx1_delay = 53;++ // Application Layer parameters.+ AppLayerParams app_layer_params = 54;+}++message Measurement {+ // Name (user defined).+ string name = 2;++ // Kind.+ MeasurementKind kind = 3;+}++message AppLayerParams {+ // TS003 version (Application Layer Clock Sync).+ Ts003Version ts003_version = 1;++ // TS003 fPort.+ uint32 ts003_f_port = 2;++ // TS004 version (Fragmented Data Block Transport).+ Ts004Version ts004_version = 3;++ // TS004 fPort.+ uint32 ts004_f_port = 4;++ // TS005 version (Remote Multicast Setup).+ Ts005Version ts005_version = 5;++ // TS005 fPort.+ uint32 ts005_f_port = 6;+}++message DeviceProfileListItem {+ // Device-profile ID (UUID).+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Name.+ string name = 4;++ // Region.+ common.Region region = 5;++ // LoRaWAN mac-version.+ common.MacVersion mac_version = 6;++ // Regional parameters revision.+ common.RegParamsRevision reg_params_revision = 7;++ // Supports OTAA.+ bool supports_otaa = 8;++ // Supports Class-B.+ bool supports_class_b = 9;++ // Supports Class-C.+ bool supports_class_c = 10;+}++message CreateDeviceProfileRequest {+ // Object to create.+ DeviceProfile device_profile = 1;+}++message CreateDeviceProfileResponse {+ // ID (UUID).+ string id = 1;+}++message GetDeviceProfileRequest {+ // ID (UUID).+ string id = 1;+}++message GetDeviceProfileResponse {+ // Device-profile object.+ DeviceProfile device_profile = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateDeviceProfileRequest {+ // Device-profile object.+ DeviceProfile device_profile = 1;+}++message DeleteDeviceProfileRequest {+ // ID (UUID).+ string id = 1;+}++message ListDeviceProfilesRequest {+ // Max number of device-profiles to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name.+ string search = 3;++ // Tenant ID to list the device-profiles for.+ string tenant_id = 4;+}++message ListDeviceProfilesResponse {+ // Total number of device-profiles.+ uint32 total_count = 1;++ // Result-set.+ repeated DeviceProfileListItem result = 2;+}++message ListDeviceProfileAdrAlgorithmsResponse {+ // Total number of algorithms.+ uint32 total_count = 1;++ // Result-set.+ repeated AdrAlgorithmListItem result = 2;+}++message AdrAlgorithmListItem {+ // Algorithm ID.+ string id = 1;++ // Algorithm name.+ string name = 2;+}diff --git a/agent/src/main/proto/chirpstack/api/device_profile_template.proto b/agent/src/main/proto/chirpstack/api/device_profile_template.protonew file mode 100644index 000000000..f3641c9ac--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/device_profile_template.proto@@ -0,0 +1,251 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "DeviceProfileTemplateProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";+import "api/device_profile.proto";++// DeviceProfileTemplateService is the service providing API methods for managing device-profile templates.+service DeviceProfileTemplateService {+ // Create the given device-profile template.+ rpc Create(CreateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/device-profile-templates"+ body: "*"+ };+ }++ // Get the device-profile template for the given ID.+ rpc Get(GetDeviceProfileTemplateRequest) returns (GetDeviceProfileTemplateResponse) {+ option(google.api.http) = {+ get: "/api/device-profile-templates/{id}"+ };+ }++ // Update the given device-profile template.+ rpc Update(UpdateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ put: "/api/device-profile-templates/{device_profile_template.id}"+ body: "*"+ };+ }++ // Delete the device-profile template with the given ID.+ rpc Delete(DeleteDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/device-profile-templates/{id}"+ };+ }++ // List the available device-profile templates.+ rpc List(ListDeviceProfileTemplatesRequest) returns (ListDeviceProfileTemplatesResponse) {+ option(google.api.http) = {+ get: "/api/device-profile-templates"+ };+ }+}++message DeviceProfileTemplate {+ // Device-profile template ID.+ string id = 1;++ // Name.+ string name = 2;++ // Description.+ string description = 3;++ // Vendor.+ string vendor = 4;++ // Firmware.+ string firmware = 5;++ // Region.+ common.Region region = 6;++ // LoRaWAN mac-version.+ common.MacVersion mac_version = 7;++ // Regional parameters revision.+ common.RegParamsRevision reg_params_revision = 8;++ // ADR algorithm ID.+ string adr_algorithm_id = 9;++ // Payload codec runtime.+ CodecRuntime payload_codec_runtime = 10;++ // Payload codec script.+ string payload_codec_script = 11;++ // Flush queue on device activation.+ bool flush_queue_on_activate = 12;++ // Uplink interval (seconds).+ // This defines the expected uplink interval which the device uses for+ // communication. When the uplink interval has expired and no uplink has+ // been received, the device is considered inactive.+ uint32 uplink_interval = 13;++ // Device-status request interval (times / day).+ // This defines the times per day that ChirpStack will request the device-status+ // from the device.+ uint32 device_status_req_interval = 14;++ // Supports OTAA.+ bool supports_otaa = 15;++ // Supports Class B.+ bool supports_class_b = 16;++ // Supports Class-C.+ bool supports_class_c = 17;++ // Class-B timeout (seconds).+ // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).+ uint32 class_b_timeout = 18;++ // Class-B ping-slot periodicity (only for Class-B).+ // Valid options are: 0 - 7.+ //+ // Number of ping-slots per beacon-period:+ // pingNb = 2^(7-periodicity)+ //+ // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec+ // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec+ uint32 class_b_ping_slot_periodicity = 19;++ // Class-B ping-slot DR.+ uint32 class_b_ping_slot_dr = 20;++ // Class-B ping-slot freq (Hz).+ uint32 class_b_ping_slot_freq = 21;++ // Class-C timeout (seconds).+ // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).+ uint32 class_c_timeout = 22;++ // RX1 delay (for ABP).+ uint32 abp_rx1_delay = 23;++ // RX1 DR offset (for ABP).+ uint32 abp_rx1_dr_offset = 24;++ // RX2 DR (for ABP).+ uint32 abp_rx2_dr = 25;++ // RX2 frequency (for ABP, Hz).+ uint32 abp_rx2_freq = 26;++ // User defined tags.+ map<string, string> tags = 27;++ // Measurements.+ // If defined, ChirpStack will visualize these metrics in the web-interface.+ map<string, Measurement> measurements = 28;++ // Auto-detect measurements.+ // If set to true, measurements will be automatically added based on the+ // keys of the decoded payload. In cases where the decoded payload contains+ // random keys in the data, you want to set this to false.+ bool auto_detect_measurements = 29;+}++message DeviceProfileTemplateListItem {+ // Device-profile template ID.+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Name.+ string name = 4;++ // Vendor.+ string vendor = 5;++ // Firmware.+ string firmware = 6;++ // Region.+ common.Region region = 7;++ // LoRaWAN mac-version.+ common.MacVersion mac_version = 8;++ // Regional parameters revision.+ common.RegParamsRevision reg_params_revision = 9;++ // Supports OTAA.+ bool supports_otaa = 10;++ // Supports Class-B.+ bool supports_class_b = 11;++ // Supports Class-C.+ bool supports_class_c = 12;++}++message CreateDeviceProfileTemplateRequest {+ // Object to create.+ DeviceProfileTemplate device_profile_template = 1;+}++message GetDeviceProfileTemplateRequest {+ // ID.+ string id = 1;+}++message GetDeviceProfileTemplateResponse {+ // Device-profile template object.+ DeviceProfileTemplate device_profile_template = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateDeviceProfileTemplateRequest {+ // Object to update.+ DeviceProfileTemplate device_profile_template = 1;+}++message DeleteDeviceProfileTemplateRequest {+ // ID.+ string id = 1;+}++message ListDeviceProfileTemplatesRequest {+ // Max number of device-profile templates to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;+}++message ListDeviceProfileTemplatesResponse {+ // Total number of device-profile templates.+ uint32 total_count = 1;++ // Result-set.+ repeated DeviceProfileTemplateListItem result = 2;+}diff --git a/agent/src/main/proto/chirpstack/api/fuota.proto b/agent/src/main/proto/chirpstack/api/fuota.protonew file mode 100644index 000000000..fe56eb2cb--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/fuota.proto@@ -0,0 +1,408 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "FuotaProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";+import "api/multicast_group.proto";++// FuotaService is the service providing API methods for FUOTA deployments.+service FuotaService {+ // Create the given FUOTA deployment.+ rpc CreateDeployment(CreateFuotaDeploymentRequest) returns (CreateFuotaDeploymentResponse) {}++ // Get the FUOTA deployment for the given ID.+ rpc GetDeployment(GetFuotaDeploymentRequest) returns (GetFuotaDeploymentResponse) {}++ // Update the given FUOTA deployment.+ rpc UpdateDeployment(UpdateFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // Delete the FUOTA deployment for the given ID.+ rpc DeleteDeployment(DeleteFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // Start the FUOTA deployment.+ rpc StartDeployment(StartFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // List the FUOTA deployments.+ rpc ListDeployments(ListFuotaDeploymentsRequest) returns (ListFuotaDeploymentsResponse) {}++ // Add the given DevEUIs to the FUOTA deployment.+ rpc AddDevices(AddDevicesToFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // Remove the given DevEUIs from the FUOTA deployment.+ rpc RemoveDevices(RemoveDevicesFromFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // List FUOTA Deployment devices.+ rpc ListDevices(ListFuotaDeploymentDevicesRequest) returns (ListFuotaDeploymentDevicesResponse) {}++ // Add the given Gateway IDs to the FUOTA deployment.+ // By default, ChirpStack will automatically select the minimum amount of+ // gateways needed to cover all devices within the multicast-group. Setting+ // the gateways manually overrides this behaviour.+ rpc AddGateways(AddGatewaysToFuotaDeploymentRequest) returns (google.protobuf.Empty) {}++ // List the gateways added to the FUOTA deployment.+ rpc ListGateways(ListFuotaDeploymentGatewaysRequest) returns (ListFuotaDeploymentGatewaysResponse) {}++ // Remove the given Gateway IDs from the FUOTA deployment.+ rpc RemoveGateways(RemoveGatewaysFromFuotaDeploymentRequest) returns (google.protobuf.Empty) {}+ // GetLogs returns the logs for the FUOTA deployment.++ // List jobs for the given FUOTA deployment.+ rpc ListJobs(ListFuotaDeploymentJobsRequest) returns (ListFuotaDeploymentJobsResponse) {}+}++enum RequestFragmentationSessionStatus {+ // Do not request the fragmentation-session status.+ NO_REQUEST = 0;++ // Enqueue the fragmentation-session status request command directly after+ // enqueueing the fragmentation-session fragments. This is the recommended+ // option for Class-A devices as the status request will stay in the+ // downlink queue until the device sends its next uplink.+ AFTER_FRAGMENT_ENQUEUE = 1;++ // Enqueue the fragmentation-session status request after the multicast+ // session-timeout. This is the recommended option for Class-B and -C+ // devices as selecting AFTER_FRAGMENT_ENQUEUE will likely cause the NS+ // to schedule the downlink frame during the FUOTA multicast-session.+ AFTER_SESSION_TIMEOUT = 2;++}++message FuotaDeployment {+ // Deployment ID.+ // This value is automatically set on create.+ string id = 1;++ // Application ID.+ string application_id = 2;++ // Device-profile ID.+ string device_profile_id = 3;++ // Deployment name.+ string name = 4;++ // Multicast-group type.+ MulticastGroupType multicast_group_type = 5;++ // Multicast-group scheduling type (Class-C only).+ MulticastGroupSchedulingType multicast_class_c_scheduling_type = 6;++ // Multicast data-rate.+ uint32 multicast_dr = 7;++ // Multicast ping-slot period (Class-B only).+ // Valid options are: 0 - 7.+ //+ // Number of ping-slots per beacon-period:+ // pingNb = 2^(7-periodicity)+ //+ // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec+ // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec+ uint32 multicast_class_b_ping_slot_periodicity = 8;++ // Multicast frequency (Hz).+ uint32 multicast_frequency = 9;++ // Multicast timeout.+ // This defines the timeout of the multicast-session.+ // Please refer to the Remote Multicast Setup specification as this field+ // has a different meaning for Class-B and Class-C groups.+ uint32 multicast_timeout = 10;++ // Calculate multicast timeout.+ // If set to true, ChirpStack will calculate the multicast-timeout.+ bool calculate_multicast_timeout = 11;++ // The number of times ChirpStack will retry an unicast command+ // before it considers it to be failed.+ uint32 unicast_max_retry_count = 12;++ // Fragmentation size.+ // This defines the size of each payload fragment. Please refer to the+ // Regional Parameters specification for the maximum payload sizes+ // per data-rate and region.+ uint32 fragmentation_fragment_size = 13;++ // Calculate fragmentation size.+ // If set to true, ChirpStack will calculate the fragmentation size.+ bool calculate_fragmentation_fragment_size = 14;++ // Fragmentation redundancy percentage.+ // The number represents the percentage (0 - 100) of redundant messages+ // to send.+ uint32 fragmentation_redundancy_percentage = 15;++ // Fragmentation session index.+ uint32 fragmentation_session_index = 16;++ // Fragmentation matrix.+ uint32 fragmentation_matrix = 17;++ // Block ack delay.+ uint32 fragmentation_block_ack_delay = 18;++ // Descriptor (4 bytes).+ bytes fragmentation_descriptor = 19;++ // Request fragmentation session status.+ RequestFragmentationSessionStatus request_fragmentation_session_status = 20;++ // Payload.+ // The FUOTA payload to send.+ bytes payload = 21;++ // Set device tags on complete.+ map<string, string> on_complete_set_device_tags = 22;+}++message FuotaDeploymentListItem {+ // ID.+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Updated at timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Started at timestamp.+ google.protobuf.Timestamp started_at = 4;++ // Completed at timestamp.+ google.protobuf.Timestamp completed_at = 5;++ // Name.+ string name = 6;+}++message FuotaDeploymentDeviceListItem {+ // ID.+ string fuota_deployment_id = 1;++ // DevEUI.+ string dev_eui = 2;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 3;++ // Completed at timestamp.+ google.protobuf.Timestamp completed_at = 4;++ // McGroupSetup completed at timestamp.+ google.protobuf.Timestamp mc_group_setup_completed_at = 5;++ // McSession completed at timestamp.+ google.protobuf.Timestamp mc_session_completed_at = 6;++ // FragSessionSetup completed at timestamp.+ google.protobuf.Timestamp frag_session_setup_completed_at = 7;++ // FragStatus completed at timestamp.+ google.protobuf.Timestamp frag_status_completed_at = 8;++ // Error message.+ string error_msg = 9;+}++message FuotaDeploymentGatewayListItem {+ // ID.+ string fuota_deployment_id = 1;++ // Gateway ID.+ string gateway_id = 2;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 3;+}++message CreateFuotaDeploymentRequest {+ // Deployment.+ FuotaDeployment deployment = 1;+}++message CreateFuotaDeploymentResponse {+ // ID of the created deployment.+ string id = 1;+}++message GetFuotaDeploymentRequest {+ // FUOTA Deployment ID.+ string id = 1;+}++message GetFuotaDeploymentResponse {+ // FUOTA Deployment.+ FuotaDeployment deployment = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Updated at timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Started at timestamp.+ google.protobuf.Timestamp started_at = 4;++ // Completed at timestamp.+ google.protobuf.Timestamp completed_at = 5;+}++message UpdateFuotaDeploymentRequest {+ // Deployment.+ FuotaDeployment deployment = 1;+}++message DeleteFuotaDeploymentRequest {+ // FUOTA deployment ID.+ string id = 1;+}++message StartFuotaDeploymentRequest {+ // FUOTA deployment ID.+ string id = 1;+}++message ListFuotaDeploymentsRequest {+ // Max number of FUOTA deployments to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // Application ID to list the FUOTA Deployments for.+ // This filter is mandatory.+ string application_id = 3;+}++message ListFuotaDeploymentsResponse {+ // Total number of FUOTA Deployments.+ uint32 total_count = 1;++ // Result-test.+ repeated FuotaDeploymentListItem result = 2;+}++message AddDevicesToFuotaDeploymentRequest {+ // FUOTA Deployment ID.+ string fuota_deployment_id = 1;++ // DevEUIs.+ // Note that the DevEUIs must share the same device-profile as assigned to+ // the FUOTA Deployment.+ repeated string dev_euis = 2;+}++message RemoveDevicesFromFuotaDeploymentRequest {+ // FUOTA Deployment ID.+ string fuota_deployment_id = 1;++ // DevEUIs.+ repeated string dev_euis = 2;+}++message ListFuotaDeploymentDevicesRequest {+ // Max number of devices to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // FUOTA Deployment ID.+ string fuota_deployment_id = 3;+}++message ListFuotaDeploymentDevicesResponse {+ // Total number of devices.+ uint32 total_count = 1;++ // Result-set.+ repeated FuotaDeploymentDeviceListItem result = 2;+}++message AddGatewaysToFuotaDeploymentRequest {+ // FUOTA Deployment ID.+ string fuota_deployment_id = 1;++ // Gateway IDs.+ // Note that the Gateways must be under the same tenant as the FUOTA Deployment.+ repeated string gateway_ids = 2;+}++message RemoveGatewaysFromFuotaDeploymentRequest {+ // FUOTA Deployment ID.+ string fuota_deployment_id = 1;++ // Gateway IDs.+ repeated string gateway_ids = 2;+}++message ListFuotaDeploymentGatewaysRequest {+ // Max number of gateways to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // FUOTA Deployment ID.+ string fuota_deployment_id = 3;+}++message ListFuotaDeploymentGatewaysResponse {+ // Total number of gateways.+ uint32 total_count = 1;++ // Result-set.+ repeated FuotaDeploymentGatewayListItem result = 2;+}++message ListFuotaDeploymentJobsRequest {+ // FUOTA Deployment ID.+ string fuota_deployment_id = 1;+}++message ListFuotaDeploymentJobsResponse {+ // Jobs.+ repeated FuotaDeploymentJob jobs = 1;+}++message FuotaDeploymentJob {+ // Job identifier.+ string job = 1;++ // Created at.+ google.protobuf.Timestamp created_at = 2;++ // Completed at.+ google.protobuf.Timestamp completed_at = 3;++ // Max. retry count.+ uint32 max_retry_count = 4;++ // Attempt count.+ uint32 attempt_count = 5;++ // Scheduler run after.+ google.protobuf.Timestamp scheduler_run_after = 6;++ // Warning message.+ string warning_msg = 7;++ // Error message.+ string error_msg = 8;+}diff --git a/agent/src/main/proto/chirpstack/api/gateway.proto b/agent/src/main/proto/chirpstack/api/gateway.protonew file mode 100644index 000000000..739d99cfd--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/gateway.proto@@ -0,0 +1,437 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "GatewayProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";++// GatewayService is the service providing API methods for managing gateways.+service GatewayService {+ // Create creates the given gateway.+ rpc Create(CreateGatewayRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/gateways"+ body: "*"+ };+ }++ // Get returns the gateway for the given Gateway ID.+ rpc Get(GetGatewayRequest) returns (GetGatewayResponse) {+ option(google.api.http) = {+ get: "/api/gateways/{gateway_id}"+ };+ }++ // Update updates the given gateway.+ rpc Update(UpdateGatewayRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ put: "/api/gateways/{gateway.gateway_id}"+ body: "*"+ };+ }++ // Delete deletes the gateway matching the given Gateway ID.+ rpc Delete(DeleteGatewayRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/gateways/{gateway_id}"+ };+ }++ // Get the list of gateways.+ rpc List(ListGatewaysRequest) returns (ListGatewaysResponse) {+ option(google.api.http) = {+ get: "/api/gateways"+ };+ }++ // Generate client-certificate for the gateway.+ rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {+ option(google.api.http) = {+ post: "/api/gateways/{gateway_id}/generate-certificate"+ };+ }++ // GetMetrics returns the gateway metrics.+ rpc GetMetrics(GetGatewayMetricsRequest) returns (GetGatewayMetricsResponse) {+ option(google.api.http) = {+ get: "/api/gateways/{gateway_id}/metrics"+ };+ }++ // GetDutyCycleMetrics returns the duty-cycle metrics.+ // Note that only the last 2 hours of data are stored. Currently only per minute aggregation is available.+ rpc GetDutyCycleMetrics(GetGatewayDutyCycleMetricsRequest) returns (GetGatewayDutyCycleMetricsResponse) {+ option(google.api.http) = {+ get: "/api/gateways/{gateway_id}/duty-cycle-metrics"+ };+ }++ // Get the given Relay Gateway.+ rpc GetRelayGateway(GetRelayGatewayRequest) returns (GetRelayGatewayResponse) {+ option(google.api.http) = {+ get: "/api/gateways/relay-gateways/{tenant_id}/{relay_id}"+ };+ }++ // List the detected Relay Gateways.+ rpc ListRelayGateways(ListRelayGatewaysRequest) returns (ListRelayGatewaysResponse) {+ option(google.api.http) = {+ get: "/api/gateways/relay-gateways"+ };+ }++ // Update the given Relay Gateway.+ rpc UpdateRelayGateway(UpdateRelayGatewayRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ put: "/api/gateways/relay-gateways/{relay_gateway.tenant_id}/{relay_gateway.relay_id}"+ body: "*"+ };+ }++ // Delete the given Relay Gateway.+ rpc DeleteRelayGateway(DeleteRelayGatewayRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/gateways/relay-gateways/{tenant_id}/{relay_id}"+ };+ }+}++enum GatewayState {+ // The gateway has never sent any stats.+ NEVER_SEEN = 0;++ // Online.+ ONLINE = 1;++ // Offline.+ OFFLINE = 2;+}++message Gateway {+ // Gateway ID (EUI64).+ string gateway_id = 1;++ // Name.+ string name = 2;++ // Description.+ string description = 3;++ // Gateway location.+ common.Location location = 4;++ // Tenant ID (UUID).+ string tenant_id = 5;++ // Tags.+ map<string, string> tags = 6;++ // Metadata (provided by the gateway).+ map<string, string> metadata = 7;++ // Stats interval (seconds).+ // This defines the expected interval in which the gateway sends its+ // statistics.+ uint32 stats_interval = 8;+}++message GatewayListItem {+ // Tenant ID.+ string tenant_id = 1;++ // Gateway ID (EUI64).+ string gateway_id = 2;++ // Name.+ string name = 3;++ // Description.+ string description = 4;++ // Location.+ common.Location location = 5;++ // Gateway properties.+ map<string, string> properties = 6;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 7;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 8;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 9;++ // Gateway state.+ // Please note that the state of the gateway is driven by the stats+ // packages that are sent by the gateway.+ GatewayState state = 10;+}++message CreateGatewayRequest {+ // Gateway object.+ Gateway gateway = 1;+}++message GetGatewayRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;+}++message GetGatewayResponse {+ // Gateway object.+ Gateway gateway = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 4;+}++message UpdateGatewayRequest {+ // Gateway object.+ Gateway gateway = 1;+}++message DeleteGatewayRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;+}++message ListGatewaysRequest {+ // Max number of gateways to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name (optional).+ string search = 3;++ // Tenant ID (UUID) to filter gateways on.+ // To list all gateways as a global admin user, this field can be left blank.+ string tenant_id = 4;++ // Multicast-group ID (UUID) to filter gateways on.+ string multicast_group_id = 5;++ enum OrderBy {+ NAME = 0;+ GATEWAY_ID = 1;+ LAST_SEEN_AT = 2;+ }++ // If set, the given value will be used to sort by (optional).+ OrderBy order_by = 6;++ // If set, the sorting direction will be decending (default = ascending) (optional).+ bool order_by_desc = 7;+}++message ListGatewaysResponse {+ // Total number of gateways.+ uint32 total_count = 1;++ // Result-set.+ repeated GatewayListItem result = 2;+}++message GenerateGatewayClientCertificateRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;+}++message GenerateGatewayClientCertificateResponse {+ // TLS certificate.+ string tls_cert = 1;++ // TLS key.+ string tls_key = 2;++ // CA certificate.+ string ca_cert = 3;++ // Expires at defines the expiration date of the certificate.+ google.protobuf.Timestamp expires_at = 4;+}++message GetGatewayMetricsRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;++ // Interval start timestamp.+ google.protobuf.Timestamp start = 2;++ // Interval end timestamp.+ google.protobuf.Timestamp end = 3;++ // Aggregation.+ common.Aggregation aggregation = 4;+}++message GetGatewayMetricsResponse {+ // RX packets.+ common.Metric rx_packets = 1;++ // TX packets.+ common.Metric tx_packets = 2;++ // TX packets / frequency.+ common.Metric tx_packets_per_freq = 3;++ // RX packets / frequency.+ common.Metric rx_packets_per_freq = 4;++ // TX packets / DR.+ common.Metric tx_packets_per_dr = 5;++ // RX packets / DR.+ common.Metric rx_packets_per_dr = 6;++ // TX packets per status.+ common.Metric tx_packets_per_status = 7;+}++message GetGatewayDutyCycleMetricsRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;++ // Interval start timestamp.+ google.protobuf.Timestamp start = 2;++ // Interval end timestamp.+ google.protobuf.Timestamp end = 3;+}++message GetGatewayDutyCycleMetricsResponse {+ // Percentage relative to max load.+ common.Metric max_load_percentage = 1;++ // Percentage relative to tracking window.+ common.Metric window_percentage = 2;+}++message GetRelayGatewayRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // Relay ID (4 byte HEX).+ string relay_id = 2;+}++message GetRelayGatewayResponse {+ // Relay Gateway object.+ RelayGateway relay_gateway = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 4;+}++message ListRelayGatewaysRequest {+ // Max number of relay-gateways to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // Tenant ID (UUID) to filter relay-gateways on.+ // To list all relay-gateways as a global admin user, this field can be left blank.+ string tenant_id = 3;+}++message ListRelayGatewaysResponse {+ // Total number of relay-gateways.+ uint32 total_count = 1;++ // Result-set.+ repeated RelayGatewayListItem result = 2;+}++message RelayGatewayListItem {+ // Tenant ID.+ string tenant_id = 1;++ // Relay ID (4 byte HEX).+ string relay_id = 2;++ // Name.+ string name = 3;++ // Description.+ string description = 4;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 5;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 6;++ // Last seen at timestamp.+ google.protobuf.Timestamp last_seen_at = 7;++ // Gateway state.+ // Please note that the state of the relay is driven by the last+ // received stats packet sent by the relay-gateway.+ GatewayState state = 10;++ // Region configuration ID.+ string region_config_id = 11;+}++message UpdateRelayGatewayRequest {+ // Relay Gateway object.+ RelayGateway relay_gateway = 1;+}++message DeleteRelayGatewayRequest {+ // Tenant ID.+ string tenant_id = 1;++ // Relay ID (4 byte HEX).+ string relay_id = 2;+}++message RelayGateway {+ // Tenant ID.+ string tenant_id = 1;++ // Relay ID (4 byte HEX).+ string relay_id = 2;++ // Name.+ string name = 3;++ // Description.+ string description = 4;++ // Stats interval (seconds).+ // This defines the expected interval in which the gateway sends its+ // statistics.+ uint32 stats_interval = 5;++ // Region configuration ID.+ string region_config_id = 6;+}diff --git a/agent/src/main/proto/chirpstack/api/internal.proto b/agent/src/main/proto/chirpstack/api/internal.protonew file mode 100644index 000000000..b1c8704c9--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/internal.proto@@ -0,0 +1,434 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "InternalProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";+import "api/user.proto";++// InternalService is the service providing API endpoints for internal usage.+service InternalService {+ // Log in a user+ rpc Login(LoginRequest) returns (LoginResponse) {}++ // Get the current user's profile+ rpc Profile(google.protobuf.Empty) returns (ProfileResponse) {}++ // Perform a global search.+ rpc GlobalSearch(GlobalSearchRequest) returns (GlobalSearchResponse) {}++ // CreateApiKey creates the given API key.+ rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {}++ // DeleteApiKey deletes the API key.+ rpc DeleteApiKey(DeleteApiKeyRequest) returns (google.protobuf.Empty) {}++ // ListApiKeys lists the available API keys.+ rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {}++ // Get the global settings.+ rpc Settings(google.protobuf.Empty) returns (SettingsResponse) {}++ // OpenId Connect login.+ rpc OpenIdConnectLogin(OpenIdConnectLoginRequest)+ returns (OpenIdConnectLoginResponse) {}++ // OAuth2 login.+ rpc OAuth2Login(OAuth2LoginRequest) returns (OAuth2LoginResponse) {}++ // GetDevicesSummary returns an aggregated summary of the devices.+ rpc GetDevicesSummary(GetDevicesSummaryRequest)+ returns (GetDevicesSummaryResponse) {}++ // GetGatewaysSummary returns an aggregated summary of the gateways.+ rpc GetGatewaysSummary(GetGatewaysSummaryRequest)+ returns (GetGatewaysSummaryResponse) {}++ // Stream frame for the given Gateway ID.+ rpc StreamGatewayFrames(StreamGatewayFramesRequest) returns (stream LogItem) {+ }++ // Stream frames for the given Device EUI.+ rpc StreamDeviceFrames(StreamDeviceFramesRequest) returns (stream LogItem) {}++ // Stream events for the given Device EUI.+ rpc StreamDeviceEvents(StreamDeviceEventsRequest) returns (stream LogItem) {}++ // ListRegions lists the available (configured) regions.+ rpc ListRegions(google.protobuf.Empty) returns (ListRegionsResponse) {}++ // GetRegion returns the region details for the given region.+ rpc GetRegion(GetRegionRequest) returns (GetRegionResponse) {}++ // GetVersion returns the ChirpStack version.+ rpc GetVersion(google.protobuf.Empty) returns (GetVersionResponse) {}+}++message ApiKey {+ // API key ID.+ // This value will be automatically generated on create.+ string id = 1;++ // Name.+ string name = 2;++ // Is global admin key.+ bool is_admin = 3;++ // Tenant ID.+ // In case the API key is intended to manage resources under a single tenant.+ string tenant_id = 4;+}++message CreateApiKeyRequest {+ // The API key to create.+ ApiKey api_key = 1;+}++message CreateApiKeyResponse {+ // API key ID.+ string id = 1;++ // API token for authentication API requests.+ string token = 2;+}++message DeleteApiKeyRequest {+ // API key ID.+ string id = 1;+}++message ListApiKeysRequest {+ // Max number of items to return.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // Return only admin keys.+ bool is_admin = 3;++ // Filter on tenant ID.+ string tenant_id = 4;+}++message ListApiKeysResponse {+ // Total number of API keys.+ uint32 total_count = 1;++ repeated ApiKey result = 2;+}++// Defines a tenant to which the user is associated.+message UserTenantLink {+ // Created at timestamp.+ google.protobuf.Timestamp created_at = 1;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 2;++ // Tenant ID.+ string tenant_id = 3;++ // User is admin within the context of this tenant.+ // There is no need to set the is_device_admin and is_gateway_admin flags.+ bool is_admin = 4;++ // User is able to modify device related resources (applications,+ // device-profiles, devices, multicast-groups).+ bool is_device_admin = 5;++ // User is able to modify gateways.+ bool is_gateway_admin = 6;+}++message LoginRequest {+ // Email of the user.+ string email = 1;++ // Password of the user.+ string password = 2;+}++message LoginResponse {+ // The JWT tag to be used to access chirpstack-application-server interfaces.+ string jwt = 1;+}++message ProfileResponse {+ // User object.+ User user = 1;++ // Tenants to which the user is associated.+ repeated UserTenantLink tenants = 3;+}++message GlobalSearchRequest {+ // Search query.+ string search = 1;++ // Max number of results to return.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ int64 limit = 2;++ // Offset offset of the result-set (for pagination).+ int64 offset = 3;+}++message GlobalSearchResponse { repeated GlobalSearchResult result = 1; }++message GlobalSearchResult {+ // Record kind.+ string kind = 1;++ // Search score.+ float score = 2;++ // Organization id.+ string tenant_id = 3;++ // Organization name.+ string tenant_name = 4;++ // Application id.+ string application_id = 5;++ // Application name.+ string application_name = 6;++ // Device DevEUI (hex encoded).+ string device_dev_eui = 7;++ // Device name.+ string device_name = 8;++ // Gateway MAC (hex encoded).+ string gateway_id = 9;++ // Gateway name.+ string gateway_name = 10;+}++message SettingsResponse {+ // OpenId Connect settings.+ OpenIdConnect openid_connect = 1;++ // OAuth2 settings.+ OAuth2 oauth2 = 2;++ // Tileserver URL.+ string tileserver_url = 3;++ // Map attribution.+ string map_attribution = 4;+}++message OpenIdConnect {+ // Enable OpenId Connect authentication.+ bool enabled = 1;++ // Login url.+ string login_url = 2;++ // Login label.+ string login_label = 3;++ // Logout url.+ string logout_url = 4;++ // Login redirect.+ bool login_redirect = 5;+}++message OAuth2 {+ // OAuth2 is enabled.+ bool enabled = 1;++ // Login url.+ string login_url = 2;++ // Login label.+ string login_label = 3;++ // Logout url.+ string logout_url = 4;++ // Login redirect.+ bool login_redirect = 5;+}++message OpenIdConnectLoginRequest {+ // OpenId Connect callback code.+ string code = 1;++ // OpenId Connect callback state.+ string state = 2;+}++message OpenIdConnectLoginResponse {+ // Token to use for authentication.+ string token = 1;+}++message OAuth2LoginRequest {+ // OAuth2 callback code.+ string code = 1;++ // OAuth2 callback state.+ string state = 2;+}++message OAuth2LoginResponse {+ // Token to use for authentication.+ string token = 1;+}++message GetDevicesSummaryRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;+}++message GetDevicesSummaryResponse {+ // Active count.+ uint32 active_count = 1;++ // Inactive count.+ uint32 inactive_count = 2;++ // per data-rate count.+ // Devices that have never been seen are excluded.+ map<uint32, uint32> dr_count = 3;++ // Never seen count.+ uint32 never_seen_count = 4;+}++message GetGatewaysSummaryRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;+}++message GetGatewaysSummaryResponse {+ // Online count.+ uint32 online_count = 1;++ // Offline count.+ uint32 offline_count = 2;++ // Never seen count.+ uint32 never_seen_count = 3;+}++message LogItem {+ // ID.+ string id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Message.+ string description = 3;++ // Body.+ string body = 4;++ // Properties.+ map<string, string> properties = 5;+}++message StreamGatewayFramesRequest {+ // Gateway ID (EUI64).+ string gateway_id = 1;+}++message StreamDeviceFramesRequest {+ // Device EUI.+ string dev_eui = 1;+}++message StreamDeviceEventsRequest {+ // Device EUI.+ string dev_eui = 1;+}++message ListRegionsResponse {+ // Configured regions.+ repeated RegionListItem regions = 1;+}++message RegionListItem {+ // ID.+ string id = 1;++ // Region.+ common.Region region = 2;++ // Description.+ string description = 3;+}++message GetRegionRequest {+ // Region ID.+ string id = 1;+}++message GetRegionResponse {+ // ID.+ string id = 1;++ // Region.+ common.Region region = 2;++ // User information.+ string user_info = 3;++ // Uplink channels.+ repeated RegionChannel uplink_channels = 4;++ // RX1 delay.+ uint32 rx1_delay = 5;++ // RX1 data-rate offset.+ uint32 rx1_dr_offset = 6;++ // RX2 DR.+ uint32 rx2_dr = 7;++ // RX2 frequency.+ uint32 rx2_frequency = 8;++ // Class-B ping-slot DR.+ uint32 class_b_ping_slot_dr = 9;++ // Class-B ping-slot frequency.+ uint32 class_b_ping_slot_frequency = 10;++ // Region description.+ string description = 11;+}++message RegionChannel {+ // Frequency (Hz).+ uint32 frequency = 1;++ // Min DR.+ uint32 dr_min = 2;++ // Max DR.+ uint32 dr_max = 3;+}++message GetVersionResponse {+ // version+ string version = 1;+}diff --git a/agent/src/main/proto/chirpstack/api/multicast_group.proto b/agent/src/main/proto/chirpstack/api/multicast_group.protonew file mode 100644index 000000000..62ae67572--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/multicast_group.proto@@ -0,0 +1,334 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "MulticastGroupProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+import "common/common.proto";+++// MulticastGroupService is the service managing multicast-groups.+service MulticastGroupService {+ // Create the given multicast group.+ rpc Create(CreateMulticastGroupRequest) returns (CreateMulticastGroupResponse) {+ option(google.api.http) = {+ post: "/api/multicast-groups"+ body: "*"+ };+ }++ // Get returns the multicast group for the given ID.+ rpc Get(GetMulticastGroupRequest) returns (GetMulticastGroupResponse) {+ option(google.api.http) = {+ get: "/api/multicast-groups/{id}"+ };+ }++ // Update the given multicast group.+ rpc Update(UpdateMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ put: "/api/multicast-groups/{multicast_group.id}"+ body: "*"+ };+ }++ // Delete the multicast-group with the given ID.+ rpc Delete(DeleteMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/multicast-groups/{id}"+ };+ }++ // List the available multicast groups.+ rpc List(ListMulticastGroupsRequest) returns (ListMulticastGroupsResponse) {+ option(google.api.http) = {+ get: "/api/multicast-groups"+ };+ }++ // Add a device to the multicast group.+ rpc AddDevice(AddDeviceToMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/multicast-groups/{multicast_group_id}/devices"+ body: "*"+ };+ }++ // Remove a device from the multicast group.+ rpc RemoveDevice(RemoveDeviceFromMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/multicast-groups/{multicast_group_id}/devices/{dev_eui}"+ };+ }++ // Add a gateway to the multicast group.+ rpc AddGateway(AddGatewayToMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/multicast-groups/{multicast_group_id}/gateways"+ body: "*"+ };+ }++ // Remove a gateway from the multicast group.+ rpc RemoveGateway(RemoveGatewayFromMulticastGroupRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/multicast-groups/{multicast_group_id}/gateways/{gateway_id}"+ };+ }++ // Add the given item to the multicast group queue.+ rpc Enqueue(EnqueueMulticastGroupQueueItemRequest) returns (EnqueueMulticastGroupQueueItemResponse) {+ option(google.api.http) = {+ post: "/api/multicast-groups/{queue_item.multicast_group_id}/queue"+ body: "*"+ };+ }++ // Flush the queue for the given multicast group.+ rpc FlushQueue(FlushMulticastGroupQueueRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/multicast-groups/{multicast_group_id}/queue"+ };+ }++ // List the items in the multicast group queue.+ rpc ListQueue(ListMulticastGroupQueueRequest) returns (ListMulticastGroupQueueResponse) {+ option(google.api.http) = {+ get: "/api/multicast-groups/{multicast_group_id}/queue"+ };+ }+}++enum MulticastGroupType {+ // Class C.+ CLASS_C = 0;++ // Class-B.+ CLASS_B = 1;+}++enum MulticastGroupSchedulingType {+ // Delay.+ // If multicast downlinks must be sent through multiple gateways, then+ // these will be sent one by one with a delay between each gateway.+ DELAY = 0;++ // Time.+ // If multicast downlinks must be sent through multiple gateways, then+ // these will be sent simultaneously using GPS time synchronization.+ // Note that this does require GPS time-synchronized LoRa gateways.+ GPS_TIME = 1;+}++message MulticastGroup {+ // ID (UUID).+ // This will be generated automatically on create.+ string id = 1;++ // Name.+ string name = 2;++ // Application ID.+ // After creation, this can not be updated.+ string application_id = 3;++ // Region.+ common.Region region = 4;++ // Multicast address (HEX encoded DevAddr).+ string mc_addr = 5;++ // Multicast network session key (HEX encoded AES128 key).+ string mc_nwk_s_key = 6;++ // Multicast application session key (HEX encoded AES128 key).+ string mc_app_s_key = 7;++ // Frame-counter.+ uint32 f_cnt = 8;++ // Multicast group type.+ MulticastGroupType group_type = 9;++ // Data-rate.+ uint32 dr = 10;++ // Frequency (Hz).+ uint32 frequency = 11;++ // Class-B ping-slot periodicity (only for Class-B).+ // Valid options are: 0 - 7.+ //+ // Number of ping-slots per beacon-period:+ // pingNb = 2^(7-periodicity)+ //+ // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec+ // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec+ uint32 class_b_ping_slot_periodicity = 14;++ // Scheduling type (only for Class-C).+ MulticastGroupSchedulingType class_c_scheduling_type = 13;+}++message MulticastGroupListItem {+ // ID.+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Name.+ string name = 4;++ // Region.+ common.Region region = 5;++ // Multicast group type.+ MulticastGroupType group_type = 6;+}++message CreateMulticastGroupRequest {+ // Multicast group to create.+ MulticastGroup multicast_group = 1;+}++message CreateMulticastGroupResponse {+ // ID of created multicast group (UUID).+ string id = 1;+}++message GetMulticastGroupRequest {+ // Multicast group ID.+ string id = 1;+}++message GetMulticastGroupResponse {+ // Multicast group object.+ MulticastGroup multicast_group = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateMulticastGroupRequest {+ // Multicast group object to update.+ MulticastGroup multicast_group = 1;+}++message DeleteMulticastGroupRequest {+ // Multicast group iD.+ string id = 1;+}++message ListMulticastGroupsRequest {+ // Max number of multicast groups to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name.+ string search = 3;++ // Application ID to list the multicast groups for.+ string application_id = 4;+}++message ListMulticastGroupsResponse {+ // Total number of multicast groups.+ uint32 total_count = 1;++ // Result-test.+ repeated MulticastGroupListItem result = 2;+}++message AddDeviceToMulticastGroupRequest {+ // Multicast group ID.+ string multicast_group_id = 1;++ // Device EUI (HEX encoded).+ string dev_eui = 2;+}++message RemoveDeviceFromMulticastGroupRequest {+ // Multicast group ID.+ string multicast_group_id = 1;++ // Device EUI (HEX encoded).+ string dev_eui = 2;+}++message AddGatewayToMulticastGroupRequest {+ // Multicast group ID.+ string multicast_group_id = 1;++ // Gateway ID (HEX encoded).+ string gateway_id = 2;+}++message RemoveGatewayFromMulticastGroupRequest {+ // Multicast group ID.+ string multicast_group_id = 1;++ // Gateway ID (HEX encoded).+ string gateway_id = 2;+}++message MulticastGroupQueueItem {+ // Multicast group ID.+ string multicast_group_id = 1;++ // Downlink frame-counter.+ // This will be automatically set on enqueue.+ uint32 f_cnt = 2;++ // FPort (must be > 0).+ uint32 f_port = 3;++ // Payload.+ bytes data = 4;++ // Expires at (optional).+ // Expired queue-items will be automatically removed from the queue.+ google.protobuf.Timestamp expires_at = 5;+}++message EnqueueMulticastGroupQueueItemRequest {+ // Multicast queue-item to enqueue.+ MulticastGroupQueueItem queue_item = 1;+}++message EnqueueMulticastGroupQueueItemResponse {+ // Frame-counter of the enqueued payload.+ uint32 f_cnt = 1;+}++message FlushMulticastGroupQueueRequest {+ // Multicast group ID.+ string multicast_group_id = 1;+}++message ListMulticastGroupQueueRequest {+ // Multicast group ID.+ string multicast_group_id = 1;+}++message ListMulticastGroupQueueResponse {+ repeated MulticastGroupQueueItem items = 1;+}diff --git a/agent/src/main/proto/chirpstack/api/relay.proto b/agent/src/main/proto/chirpstack/api/relay.protonew file mode 100644index 000000000..81a76fb5d--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/relay.proto@@ -0,0 +1,123 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "RelayProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";++// RelayService is the service providing API methos for managing relays.+service RelayService {+ // List lists the relays for the given application id.+ rpc List(ListRelaysRequest) returns (ListRelaysResponse) {+ option(google.api.http) = {+ get: "/api/relays"+ };+ }++ // AddDevice adds the given device to the relay.+ rpc AddDevice(AddRelayDeviceRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/relays/{relay_dev_eui}/devices"+ body: "*"+ };+ }++ // RemoveDevice removes the given device from the relay.+ rpc RemoveDevice(RemoveRelayDeviceRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/relays/{relay_dev_eui}/devices/{dev_eui}"+ };+ };++ // ListDevices lists the devices for the given relay.+ rpc ListDevices(ListRelayDevicesRequest) returns (ListRelayDevicesResponse) {+ option(google.api.http) = {+ get: "/api/relays/{relay_dev_eui}/devices"+ };+ };+}++message RelayListItem {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Name.+ string name = 2;+}++message ListRelaysRequest {+ // Max number of devices to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // Application ID (UUID).+ string application_id = 3;+}++message ListRelaysResponse {+ // Total number of relays.+ uint32 total_count = 1;++ // Result-set.+ repeated RelayListItem result = 2;+}++message AddRelayDeviceRequest {+ // Relay DevEUI (EUI64).+ string relay_dev_eui = 1;++ // Device DevEUI (EUI64).+ string device_dev_eui = 2;++}++message RemoveRelayDeviceRequest {+ // Relay DevEUI (EUI64).+ string relay_dev_eui = 1;++ // Device DevEUI (EUI64).+ string device_dev_eui = 2;+}++message ListRelayDevicesRequest {+ // Max number of multicast groups to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // Relay DevEUI (EUI64).+ string relay_dev_eui = 3;+}++message RelayDeviceListItem {+ // DevEUI (EUI64).+ string dev_eui = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Device name.+ string name = 3;+}++message ListRelayDevicesResponse {+ // Total number of devices.+ uint32 total_count = 1;++ // Result-set.+ repeated RelayDeviceListItem result = 2;+}diff --git a/agent/src/main/proto/chirpstack/api/tenant.proto b/agent/src/main/proto/chirpstack/api/tenant.protonew file mode 100644index 000000000..4f0576ddf--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/tenant.proto@@ -0,0 +1,330 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "TenantProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";++// TenantService is the service providing API methods for managing tenants.+service TenantService {+ // Create a new tenant.+ rpc Create(CreateTenantRequest) returns (CreateTenantResponse) {+ option (google.api.http) = {+ post : "/api/tenants"+ body : "*"+ };+ }++ // Get the tenant for the given ID.+ rpc Get(GetTenantRequest) returns (GetTenantResponse) {+ option (google.api.http) = {+ get : "/api/tenants/{id}"+ };+ }++ // Update the given tenant.+ rpc Update(UpdateTenantRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/tenants/{tenant.id}"+ body : "*"+ };+ }++ // Delete the tenant with the given ID.+ rpc Delete(DeleteTenantRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/tenants/{id}"+ };+ }++ // Get the list of tenants.+ rpc List(ListTenantsRequest) returns (ListTenantsResponse) {+ option (google.api.http) = {+ get : "/api/tenants"+ };+ }++ // Add an user to the tenant.+ // Note: the user must already exist.+ rpc AddUser(AddTenantUserRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post : "/api/tenants/{tenant_user.tenant_id}/users"+ body : "*"+ };+ }++ // Get the the tenant user for the given tenant and user IDs.+ rpc GetUser(GetTenantUserRequest) returns (GetTenantUserResponse) {+ option (google.api.http) = {+ get : "/api/tenants/{tenant_id}/users/{user_id}"+ };+ }++ // Update the given tenant user.+ rpc UpdateUser(UpdateTenantUserRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put : "/api/tenants/{tenant_user.tenant_id}/users/{tenant_user.user_id}"+ body : "*"+ };+ }++ // Delete the given tenant user.+ rpc DeleteUser(DeleteTenantUserRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete : "/api/tenants/{tenant_id}/users/{user_id}"+ };+ }++ // Get the list of tenant users.+ rpc ListUsers(ListTenantUsersRequest) returns (ListTenantUsersResponse) {+ option (google.api.http) = {+ get : "/api/tenants/{tenant_id}/users"+ };+ }+}++message Tenant {+ // Tenant ID (UUID).+ // Note: this value will be automatically generated on create.+ string id = 1;++ // Tenant name,+ string name = 2;++ // Tenant description.+ string description = 3;++ // Can the tenant create and "own" Gateways?+ bool can_have_gateways = 4;++ // Max. gateway count for tenant.+ // When set to 0, the tenant can have unlimited gateways.+ uint32 max_gateway_count = 5;++ // Max. device count for tenant.+ // When set to 0, the tenant can have unlimited devices.+ uint32 max_device_count = 6;++ // Private gateways (uplink).+ // If enabled, then uplink messages will not be shared with other tenants.+ bool private_gateways_up = 7;++ // Private gateways (downlink).+ // If enabled, then other tenants will not be able to schedule downlink+ // messages through the gateways of this tenant. For example, in case you+ // do want to share uplinks with other tenants (private_gateways_up=false),+ // but you want to prevent other tenants from using gateway airtime.+ bool private_gateways_down = 8;++ // Tags (user defined).+ // These tags can be used to add additional information to the tenant. These+ // tags are NOT exposed in the integration events.+ map<string, string> tags = 9;+}++message TenantListItem {+ // Tenant ID (UUID).+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Tenant name.+ string name = 4;++ // Can the tenant create and "own" Gateways?+ bool can_have_gateways = 5;++ // Private gateways (uplink).+ bool private_gateways_up = 6;++ // Private gateways (downlink).+ bool private_gateways_down = 9;++ // Max gateway count.+ // 0 = unlimited.+ uint32 max_gateway_count = 7;++ // Max device count.+ // 0 = unlimited.+ uint32 max_device_count = 8;+}++message CreateTenantRequest {+ // Tenant object to create.+ Tenant tenant = 1;+}++message CreateTenantResponse {+ // Tenant ID.+ string id = 1;+}++message GetTenantRequest {+ // Tenant ID.+ string id = 1;+}++message GetTenantResponse {+ // Tenant object.+ Tenant tenant = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateTenantRequest {+ // Tenant object.+ Tenant tenant = 1;+}++message DeleteTenantRequest {+ // Tenant ID.+ string id = 1;+}++message ListTenantsRequest {+ // Max number of tenants to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;++ // If set, the given string will be used to search on name.+ string search = 3;++ // If set, filters the result set to the tenants of the user.+ // Only global API keys are able to filter by this field.+ string user_id = 4;+}++message ListTenantsResponse {+ // Total number of tenants.+ uint32 total_count = 1;++ // Result-set.+ repeated TenantListItem result = 2;+}++message TenantUser {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // User ID (UUID).+ string user_id = 2;++ // User is admin within the context of the tenant.+ // There is no need to set the is_device_admin and is_gateway_admin flags.+ bool is_admin = 3;++ // User is able to modify device related resources (applications,+ // device-profiles, devices, multicast-groups).+ bool is_device_admin = 4;++ // User is able to modify gateways.+ bool is_gateway_admin = 5;++ // Email (only used on get and when adding a user to a tenant).+ string email = 6;+}++message TenantUserListItem {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // User ID (UUID).+ string user_id = 2;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 3;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 4;++ // Email.+ string email = 5;++ // User is admin within the context of the tenant.+ // There is no need to set the is_device_admin and is_gateway_admin flags.+ bool is_admin = 6;++ // User is able to modify device related resources (applications,+ // device-profiles, devices, multicast-groups).+ bool is_device_admin = 7;++ // User is able to modify gateways.+ bool is_gateway_admin = 8;+}++message AddTenantUserRequest {+ // Tenant user object.+ TenantUser tenant_user = 1;+}++message GetTenantUserRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // User ID (UUID).+ string user_id = 2;+}++message GetTenantUserResponse {+ // Tenant user object.+ TenantUser tenant_user = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateTenantUserRequest {+ // Tenant user object.+ TenantUser tenant_user = 1;+}++message DeleteTenantUserRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // User ID (UUID).+ string user_id = 2;+}++message ListTenantUsersRequest {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // Max number of tenants to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 2;++ // Offset in the result-set (for pagination).+ uint32 offset = 3;+}++message ListTenantUsersResponse {+ // Total number of tenants.+ uint32 total_count = 1;++ // Result-set.+ repeated TenantUserListItem result = 2;+}diff --git a/agent/src/main/proto/chirpstack/api/user.proto b/agent/src/main/proto/chirpstack/api/user.protonew file mode 100644index 000000000..93255a377--- /dev/null+++ b/agent/src/main/proto/chirpstack/api/user.proto@@ -0,0 +1,185 @@+syntax = "proto3";++package api;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "UserProto";+option csharp_namespace = "Chirpstack.Api";+option php_namespace = "Chirpstack\\Api";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";++import "google/api/annotations.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/empty.proto";+++// UserService is the service providing API methods for managing users.+service UserService {+ // Create a new user.+ rpc Create(CreateUserRequest) returns (CreateUserResponse) {+ option(google.api.http) = {+ post: "/api/users"+ body: "*"+ };+ }++ // Get the user for the given ID.+ rpc Get(GetUserRequest) returns (GetUserResponse) {+ option(google.api.http) = {+ get: "/api/users/{id}"+ };+ }++ // Update the given user.+ rpc Update(UpdateUserRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ put: "/api/users/{user.id}"+ body: "*"+ };+ }++ // Delete the user with the given ID.+ rpc Delete(DeleteUserRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ delete: "/api/users/{id}"+ };+ }++ // Get the list of users.+ rpc List(ListUsersRequest) returns (ListUsersResponse) {+ option(google.api.http) = {+ get: "/api/users"+ };+ }++ // Update the password for the given user.+ rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {+ option(google.api.http) = {+ post: "/api/users/{user_id}/password"+ body: "*"+ };+ }+}++message User {+ // User ID (UUID).+ // Will be set automatically on create.+ string id = 1;++ // Set to true to make the user a global administrator.+ bool is_admin = 4;++ // Set to false to disable the user.+ bool is_active = 5;++ // E-mail of the user.+ string email = 6;++ // Optional note to store with the user.+ string note = 7;+}++message UserListItem {+ // User ID (UUID).+ string id = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;++ // Email of the user.+ string email = 4;++ // Set to true to make the user a global administrator.+ bool is_admin = 5;++ // Set to false to disable the user.+ bool is_active = 6;+}++message UserTenant {+ // Tenant ID.+ string tenant_id = 1;++ // User is admin within the context of the tenant.+ // There is no need to set the is_device_admin and is_gateway_admin flags.+ bool is_admin = 2;++ // User is able to modify device related resources (applications,+ // device-profiles, devices, multicast-groups).+ bool is_device_admin = 3;++ // User is able to modify gateways.+ bool is_gateway_admin = 4;+}++message CreateUserRequest {+ // User object to create.+ User user = 1;++ // Password to set for the user.+ string password = 2;++ // Add the user to the following tenants.+ repeated UserTenant tenants = 3;+}++message CreateUserResponse {+ // User ID.+ string id = 1;+}++message GetUserRequest {+ // User ID.+ string id = 1;+}++message GetUserResponse {+ // User object.+ User user = 1;++ // Created at timestamp.+ google.protobuf.Timestamp created_at = 2;++ // Last update timestamp.+ google.protobuf.Timestamp updated_at = 3;+}++message UpdateUserRequest {+ // User object.+ User user = 1;+}++message DeleteUserRequest {+ // User ID.+ string id = 1;+}++message ListUsersRequest {+ // Max number of tenants to return in the result-set.+ // If not set, it will be treated as 0, and the response will only return the total_count.+ uint32 limit = 1;++ // Offset in the result-set (for pagination).+ uint32 offset = 2;+}++message ListUsersResponse {+ // Total number of users.+ uint32 total_count = 1;++ // Result-set.+ repeated UserListItem result = 2;+}++message UpdateUserPasswordRequest {+ // User ID.+ string user_id = 1;++ // Password to set.+ string password = 2;+}diff --git a/agent/src/main/proto/chirpstack/common/common.proto b/agent/src/main/proto/chirpstack/common/common.protonew file mode 100644index 000000000..e2dc4de2b--- /dev/null+++ b/agent/src/main/proto/chirpstack/common/common.proto@@ -0,0 +1,238 @@+syntax = "proto3";++package common;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/common";+option java_package = "io.chirpstack.api";+option java_multiple_files = true;+option java_outer_classname = "CommonProto";+option csharp_namespace = "Chirpstack.Common";+option php_namespace = "Chirpstack\\Common";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Common";++import "google/protobuf/timestamp.proto";++enum Modulation {+ // LoRa+ LORA = 0;++ // FSK+ FSK = 1;++ // LR-FHSS+ LR_FHSS = 2;+}++enum Region {+ // EU868+ EU868 = 0;++ // US915+ US915 = 2;++ // CN779+ CN779 = 3;++ // EU433+ EU433 = 4;++ // AU915+ AU915 = 5;++ // CN470+ CN470 = 6;++ // AS923+ AS923 = 7;++ // AS923 with -1.80 MHz frequency offset+ AS923_2 = 12;++ // AS923 with -6.60 MHz frequency offset+ AS923_3 = 13;++ // (AS923 with -5.90 MHz frequency offset).+ AS923_4 = 14;++ // KR920+ KR920 = 8;++ // IN865+ IN865 = 9;++ // RU864+ RU864 = 10;++ // ISM2400 (LoRaWAN 2.4 GHz)+ ISM2400 = 11;+}++enum FType {+ // JoinRequest.+ JOIN_REQUEST = 0;++ // JoinAccept.+ JOIN_ACCEPT = 1;++ // UnconfirmedDataUp.+ UNCONFIRMED_DATA_UP = 2;++ // UnconfirmedDataDown.+ UNCONFIRMED_DATA_DOWN = 3;++ // ConfirmedDataUp.+ CONFIRMED_DATA_UP = 4;++ // ConfirmedDataDown.+ CONFIRMED_DATA_DOWN = 5;++ // RejoinRequest.+ REJOIN_REQUEST = 6;++ // Proprietary.+ PROPRIETARY = 7;+}++enum MacVersion {+ LORAWAN_1_0_0 = 0;+ LORAWAN_1_0_1 = 1;+ LORAWAN_1_0_2 = 2;+ LORAWAN_1_0_3 = 3;+ LORAWAN_1_0_4 = 4;+ LORAWAN_1_1_0 = 5;+}++enum RegParamsRevision {+ A = 0;+ B = 1;+ RP002_1_0_0 = 2;+ RP002_1_0_1 = 3;+ RP002_1_0_2 = 4;+ RP002_1_0_3 = 5;+ RP002_1_0_4 = 6;+}++enum LocationSource {+ // Unknown.+ UNKNOWN = 0;++ // GPS.+ GPS = 1;++ // Manually configured.+ CONFIG = 2;++ // Geo resolver (TDOA).+ GEO_RESOLVER_TDOA = 3;++ // Geo resolver (RSSI).+ GEO_RESOLVER_RSSI = 4;++ // Geo resolver (GNSS).+ GEO_RESOLVER_GNSS = 5;++ // Geo resolver (WIFI).+ GEO_RESOLVER_WIFI = 6;+}++enum Aggregation {+ // Hour.+ HOUR = 0;++ // Day.+ DAY = 1;++ // Month.+ MONTH = 2;++ // Minute.+ MINUTE = 3;+}++enum MetricKind {+ // Incrementing counters that never decrease (these are not reset on each+ // reading).+ COUNTER = 0;++ // Counters that do get reset upon reading.+ ABSOLUTE = 1;++ // E.g. a temperature value.+ GAUGE = 2;+}++enum Regulation {+ // Unknown.+ REGULATION_UNKNOWN = 0;++ // ETSI EN 300 220.+ ETSI_EN_300_220 = 1;+}++message Location {+ // Latitude.+ double latitude = 1;++ // Longitude.+ double longitude = 2;++ // Altitude.+ double altitude = 3;++ // Location source.+ LocationSource source = 4;++ // Accuracy.+ float accuracy = 5;+}++message KeyEnvelope {+ // KEK label.+ string kek_label = 1;++ // AES key (when the kek_label is set, this value must first be decrypted).+ bytes aes_key = 2;+}++message Metric {+ // Name.+ string name = 1;++ // Timestamps.+ repeated google.protobuf.Timestamp timestamps = 2;++ // Datasets.+ repeated MetricDataset datasets = 3;++ // Kind.+ MetricKind kind = 4;+}++message MetricDataset {+ // Label.+ string label = 1;++ // Data.+ // Each value index corresponds with the same timestamp index of the Metric.+ repeated float data = 2;+}++enum DeviceClass {+ // Class-A.+ CLASS_A = 0;++ // Class-B.+ CLASS_B = 1;++ // Class-C.+ CLASS_C = 2;+}++// Join-Server context.+message JoinServerContext {+ // Session-key ID.+ string session_key_id = 1;++ // AppSKey envelope.+ KeyEnvelope app_s_key = 2;+}diff --git a/agent/src/main/proto/chirpstack/gw/gw.proto b/agent/src/main/proto/chirpstack/gw/gw.protonew file mode 100644index 000000000..4e1488c18--- /dev/null+++ b/agent/src/main/proto/chirpstack/gw/gw.proto@@ -0,0 +1,880 @@+syntax = "proto3";++package gw;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/gw";+option java_package = "io.chirpstack.api.gw";+option java_multiple_files = true;+option java_outer_classname = "GatewayProto";+option csharp_namespace = "Chirpstack.Gateway";+option php_namespace = "Chirpstack\\Gateway";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Gateway";++import "common/common.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/struct.proto";++enum CodeRate {+ CR_UNDEFINED = 0;+ CR_4_5 = 1; // LoRa+ CR_4_6 = 2;+ CR_4_7 = 3;+ CR_4_8 = 4;+ CR_3_8 = 5; // LR-FHSS+ CR_2_6 = 6;+ CR_1_4 = 7;+ CR_1_6 = 8;+ CR_5_6 = 9;+ CR_LI_4_5 = 10; // LoRa 2.4 gHz+ CR_LI_4_6 = 11;+ CR_LI_4_8 = 12;+}++enum DownlinkTiming {+ // Send the downlink immediately.+ IMMEDIATELY = 0;++ // Send downlink at the given delay (based on provided context).+ DELAY = 1;++ // Send at given GPS epoch value.+ GPS_EPOCH = 2;+}++enum FineTimestampType {+ // No fine-timestamp available.+ NONE = 0;++ // Encrypted fine-timestamp.+ ENCRYPTED = 1;++ // Plain fine-timestamp.+ PLAIN = 2;+}++enum CRCStatus {+ // No CRC.+ NO_CRC = 0;++ // Bad CRC.+ BAD_CRC = 1;++ // CRC OK.+ CRC_OK = 2;+}++enum TxAckStatus {+ // Ignored (when a previous item was already emitted).+ IGNORED = 0;++ // Packet has been programmed for downlink.+ OK = 1;++ // Rejected because it was already too late to program this packet for+ // downlink.+ TOO_LATE = 2;++ // Rejected because downlink packet timestamp is too much in advance.+ TOO_EARLY = 3;++ // Rejected because there was already a packet programmed in requested+ // timeframe.+ COLLISION_PACKET = 4;++ // Rejected because there was already a beacon planned in requested timeframe.+ COLLISION_BEACON = 5;++ // Rejected because requested frequency is not supported by TX RF chain.+ TX_FREQ = 6;++ // Rejected because requested power is not supported by gateway.+ TX_POWER = 7;++ // Rejected because GPS is unlocked, so GPS timestamp cannot be used.+ GPS_UNLOCKED = 8;++ // Downlink queue is full.+ QUEUE_FULL = 9;++ // Internal error.+ INTERNAL_ERROR = 10;++ // Duty-cycle overflow.+ DUTY_CYCLE_OVERFLOW = 11;+}++// Gateway events as reported by the ChirpStack Concentratord ZMQ interface.+message Event {+ oneof event {+ // Uplink frame.+ UplinkFrame uplink_frame = 1;++ // Gateway stats.+ GatewayStats gateway_stats = 2;++ // Gateway Mesh Event.+ MeshEvent mesh = 3;+ }+}++// Commands that can be sent to the ChirpStack Concentratord ZMQ interface.+message Command {+ oneof command {+ // Downlink frame.+ DownlinkFrame send_downlink_frame = 1;++ // Gateway configuration.+ GatewayConfiguration set_gateway_configuration = 2;++ // Get Gateway ID.+ GetGatewayIdRequest get_gateway_id = 3;++ // Get location.+ GetLocationRequest get_location = 4;++ // Gateway Mesh Command.+ MeshCommand mesh = 5;+ }+}++message MeshEvent {+ // Gateway ID (of the Border Gateway).+ string gateway_id = 1;++ // Relay ID.+ string relay_id = 2;++ // Timestamp (second precision).+ google.protobuf.Timestamp time = 3;++ // Mesh events.+ repeated MeshEventItem events = 4;+}++message MeshEventItem {+ oneof event {+ // Proprietary Mesh event.+ MeshEventProprietary proprietary = 1;++ // Mesh heartbeat.+ MeshEventHeartbeat heartbeat = 2;+ }+}++message MeshCommand {+ // Gateway ID (of the Border Gateway).+ string gateway_id = 1;++ // Relay ID.+ string relay_id = 2;++ // Mesh events.+ repeated MeshCommandItem commands = 3;+}++message MeshCommandItem {+ oneof command {+ // Proprietary Mesh command.+ MeshCommandProprietary proprietary = 1;+ }+}++message Modulation {+ oneof parameters {+ // LoRa modulation information.+ LoraModulationInfo lora = 3;++ // FSK modulation information.+ FskModulationInfo fsk = 4;++ // LR-FHSS modulation information.+ LrFhssModulationInfo lr_fhss = 5;+ }+}++message UplinkTxInfoLegacy {+ // Frequency (Hz).+ uint32 frequency = 1;++ // Modulation.+ common.Modulation modulation = 2;++ oneof modulation_info {+ // LoRa modulation information.+ LoraModulationInfo lora_modulation_info = 3;++ // FSK modulation information.+ FskModulationInfo fsk_modulation_info = 4;++ // LR-FHSS modulation information.+ LrFhssModulationInfo lr_fhss_modulation_info = 5;+ }+}++message UplinkTxInfo {+ // Frequency (Hz).+ uint32 frequency = 1;++ // Modulation.+ Modulation modulation = 2;+}++message LoraModulationInfo {+ // Bandwidth.+ uint32 bandwidth = 1;++ // Speading-factor.+ uint32 spreading_factor = 2;++ // Code-rate.+ string code_rate_legacy = 3;++ // Code-rate.+ CodeRate code_rate = 5;++ // Polarization inversion.+ bool polarization_inversion = 4;++ // Preamble length (for TX).+ uint32 preamble = 6;++ // No CRC (for TX).+ // If true, do not send a CRC in the packet.+ bool no_crc = 7;+}++message FskModulationInfo {+ // Frequency deviation.+ uint32 frequency_deviation = 1;++ // FSK datarate (bits / sec).+ uint32 datarate = 2;+}++message LrFhssModulationInfo {+ // Operating channel width (OCW) in Hz.+ uint32 operating_channel_width = 1;++ // Code-rate.+ // Deprecated: use code_rate.+ string code_rate_legacy = 2;++ // Code-rate.+ CodeRate code_rate = 4;++ // Hopping grid number of steps.+ uint32 grid_steps = 3;+}++message EncryptedFineTimestamp {+ // AES key index used for encrypting the fine timestamp.+ uint32 aes_key_index = 1;++ // Encrypted 'main' fine-timestamp (ns precision part of the timestamp).+ bytes encrypted_ns = 2;++ // FPGA ID.+ bytes fpga_id = 3;+}++message PlainFineTimestamp {+ // Full timestamp.+ google.protobuf.Timestamp time = 1;+}++message GatewayStats {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 17;++ // Gateway time.+ google.protobuf.Timestamp time = 2;++ // Gateway location.+ common.Location location = 3;++ // Gateway configuration version (this maps to the config_version sent+ // by ChirpStack to the gateway).+ string config_version = 4;++ // Number of radio packets received.+ uint32 rx_packets_received = 5;++ // Number of radio packets received with valid PHY CRC.+ uint32 rx_packets_received_ok = 6;++ // Number of downlink packets received for transmission.+ uint32 tx_packets_received = 7;++ // Number of downlink packets emitted.+ uint32 tx_packets_emitted = 8;++ // Additional gateway meta-data.+ map<string, string> metadata = 10;++ // Tx packets per frequency.+ map<uint32, uint32> tx_packets_per_frequency = 12;++ // Rx packets per frequency.+ map<uint32, uint32> rx_packets_per_frequency = 13;++ // Tx packets per modulation parameters.+ repeated PerModulationCount tx_packets_per_modulation = 14;++ // Rx packets per modulation parameters.+ repeated PerModulationCount rx_packets_per_modulation = 15;++ // Tx packets per status.+ map<string, uint32> tx_packets_per_status = 16;++ // Duty-cycle statistics (Concentratord only).+ DutyCycleStats duty_cycle_stats = 18;+}++message PerModulationCount {+ // Modulation.+ Modulation modulation = 1;++ // Count.+ uint32 count = 2;+}++message DutyCycleStats {+ // Implemented regulation.+ common.Regulation regulation = 1;++ // Tracking window.+ google.protobuf.Duration window = 2;++ // Bands.+ repeated DutyCycleBand bands = 3;+}++message DutyCycleBand {+ // Band name.+ string name = 1;++ // Min frequency for this band.+ uint32 frequency_min = 2;++ // Max frequency for this band.+ uint32 frequency_max = 3;++ // Max. allowed load.+ google.protobuf.Duration load_max = 4;++ // Tracked load (within the window of the regionlation).+ google.protobuf.Duration load_tracked = 5;+}++message UplinkRxInfoLegacy {+ // Gateway ID.+ bytes gateway_id = 1;++ // RX time (only set when the gateway has a GPS module).+ google.protobuf.Timestamp time = 2;++ // RX time since GPS epoch (only set when the gateway has a GPS module).+ google.protobuf.Duration time_since_gps_epoch = 3;++ // RSSI.+ int32 rssi = 5;++ // LoRa SNR.+ double lora_snr = 6;++ // Channel.+ uint32 channel = 7;++ // RF Chain.+ uint32 rf_chain = 8;++ // Board.+ uint32 board = 9;++ // Antenna.+ uint32 antenna = 10;++ // Location.+ common.Location location = 11;++ // Fine-timestamp type.+ FineTimestampType fine_timestamp_type = 12;++ // Fine-timestamp data.+ oneof fine_timestamp {+ // Encrypted fine-timestamp data.+ EncryptedFineTimestamp encrypted_fine_timestamp = 13;++ // Plain fine-timestamp data.+ PlainFineTimestamp plain_fine_timestamp = 14;+ }++ // Gateway specific context.+ bytes context = 15;++ // Uplink ID (UUID bytes).+ // Unique and random ID which can be used to correlate the uplink across+ // multiple logs.+ bytes uplink_id = 16;++ // CRC status.+ CRCStatus crc_status = 17;++ // Optional meta-data map.+ map<string, string> metadata = 18;+}++message UplinkRxInfo {+ // Gateway ID.+ string gateway_id = 1;++ // Uplink ID.+ uint32 uplink_id = 2;++ // Gateway RX time (set if the gateway has a GNSS module).+ google.protobuf.Timestamp gw_time = 3;++ // Network Server RX time (set by the NS on receiving the uplink).+ google.protobuf.Timestamp ns_time = 17;++ // RX time as time since GPS epoch (set if the gateway has a GNSS module).+ google.protobuf.Duration time_since_gps_epoch = 4;++ // Fine-timestamp.+ // This timestamp can be used for TDOA based geolocation.+ google.protobuf.Duration fine_time_since_gps_epoch = 5;++ // RSSI.+ int32 rssi = 6;++ // SNR.+ // Note: only available for LoRa modulation.+ float snr = 7;++ // Channel.+ uint32 channel = 8;++ // RF chain.+ uint32 rf_chain = 9;++ // Board.+ uint32 board = 10;++ // Antenna.+ uint32 antenna = 11;++ // Location.+ common.Location location = 12;++ // Gateway specific context.+ // This value must be returned to the gateway on (Class-A) downlink.+ bytes context = 13;++ // Additional gateway meta-data.+ map<string, string> metadata = 15;++ // CRC status.+ CRCStatus crc_status = 16;+}++message DownlinkTxInfoLegacy {+ // Gateway ID.+ // Deprecated: replaced by gateway_id in DownlinkFrame.+ bytes gateway_id = 1;++ // TX frequency (in Hz).+ uint32 frequency = 5;++ // TX power (in dBm EIRP).+ int32 power = 6;++ // Modulation.+ common.Modulation modulation = 7;++ oneof modulation_info {+ // LoRa modulation information.+ LoraModulationInfo lora_modulation_info = 8;++ // FSK modulation information.+ FskModulationInfo fsk_modulation_info = 9;+ }++ // The board identifier for emitting the frame.+ uint32 board = 10;++ // The antenna identifier for emitting the frame.+ uint32 antenna = 11;++ // Timing defines the downlink timing to use.+ DownlinkTiming timing = 12;++ oneof timing_info {+ // Immediately timing information.+ ImmediatelyTimingInfo immediately_timing_info = 13;++ // Context based delay timing information.+ DelayTimingInfo delay_timing_info = 14;++ // GPS Epoch timing information.+ GPSEpochTimingInfo gps_epoch_timing_info = 15;+ }++ // Gateway specific context.+ // In case of a Class-A downlink, this contains a copy of the uplink context.+ bytes context = 16;+}++message DownlinkTxInfo {+ // TX frequency (in Hz).+ uint32 frequency = 1;++ // TX power (in dBm EIRP).+ int32 power = 2;++ // Modulation.+ Modulation modulation = 3;++ // The board identifier for emitting the frame.+ uint32 board = 4;++ // The antenna identifier for emitting the frame.+ uint32 antenna = 5;++ // Timing.+ Timing timing = 6;++ // Gateway specific context.+ // In case of a Class-A downlink, this contains a copy of the uplink context.+ bytes context = 7;+}++message Timing {+ oneof parameters {+ // Immediately timing information.+ ImmediatelyTimingInfo immediately = 1;++ // Context based delay timing information.+ DelayTimingInfo delay = 2;++ // GPS Epoch timing information.+ GPSEpochTimingInfo gps_epoch = 3;+ }+}++message ImmediatelyTimingInfo {+ // Not implemented yet.+}++message DelayTimingInfo {+ // Delay (duration).+ // The delay will be added to the gateway internal timing, provided by the+ // context object.+ google.protobuf.Duration delay = 1;+}++message GPSEpochTimingInfo {+ // Duration since GPS Epoch.+ google.protobuf.Duration time_since_gps_epoch = 1;+}++message UplinkFrame {+ // PHYPayload.+ bytes phy_payload = 1;++ // TX meta-data (deprecated).+ UplinkTxInfoLegacy tx_info_legacy = 2;++ // RX meta-data (deprecated).+ UplinkRxInfoLegacy rx_info_legacy = 3;++ // Tx meta-data.+ UplinkTxInfo tx_info = 4;++ // Rx meta-data.+ UplinkRxInfo rx_info = 5;+}++message UplinkFrameSet {+ // PHYPayload.+ bytes phy_payload = 1;++ // TX meta-data.+ UplinkTxInfo tx_info = 2;++ // RX meta-data set.+ repeated UplinkRxInfo rx_info = 3;+}++message DownlinkFrame {+ // Downlink ID.+ uint32 downlink_id = 3;++ // Downlink ID (UUID).+ // Deprecated: use downlink_id.+ bytes downlink_id_legacy = 4;++ // Downlink frame items.+ // This makes it possible to send multiple downlink opportunities to the+ // gateway at once (e.g. RX1 and RX2 in LoRaWAN). The first item has the+ // highest priority, the last the lowest. The gateway will emit at most+ // one item.+ repeated DownlinkFrameItem items = 5;++ // Gateway ID.+ // Deprecated: use gateway_id+ bytes gateway_id_legacy = 6;++ // Gateway ID.+ string gateway_id = 7;+}++message DownlinkFrameItem {+ // PHYPayload.+ bytes phy_payload = 1;++ // TX meta-data (deprecated).+ DownlinkTxInfoLegacy tx_info_legacy = 2;++ // Tx meta-data.+ DownlinkTxInfo tx_info = 3;+}++message DownlinkTxAck {+ // Gateway ID (deprecated).+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 6;++ // Downlink ID.+ uint32 downlink_id = 2;++ // Downlink ID (deprecated).+ bytes downlink_id_legacy = 4;++ // Downlink frame items.+ // This list has the same length as the request and indicates which+ // downlink frame has been emitted of the requested list (or why it failed).+ // Note that at most one item has a positive acknowledgement.+ repeated DownlinkTxAckItem items = 5;+}++message DownlinkTxAckItem {+ // The Ack status of this item.+ TxAckStatus status = 1;+}++message GatewayConfiguration {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 5;++ // Configuration version.+ string version = 2;++ // Channels.+ repeated ChannelConfiguration channels = 3;++ // Stats interval.+ google.protobuf.Duration stats_interval = 4;+}++message GetGatewayIdRequest {}++message GetGatewayIdResponse {+ // Gateway ID.+ string gateway_id = 1;+}++message GetLocationRequest {}++message GetLocationResponse {+ // Location.+ common.Location location = 1;++ // Last updated at.+ google.protobuf.Timestamp updated_at = 2;+}++message ChannelConfiguration {+ // Frequency (Hz).+ uint32 frequency = 1;++ // Modulation (deprecated).+ common.Modulation modulation_legacy = 2;++ oneof modulation_config {+ // LoRa modulation config.+ LoraModulationConfig lora_modulation_config = 3;++ // FSK modulation config.+ FskModulationConfig fsk_modulation_config = 4;+ }++ // Board index.+ uint32 board = 5;++ // Demodulator index (of the given board).+ uint32 demodulator = 6;+}++message LoraModulationConfig {+ // Bandwidth (kHz).+ // Deprecated: use bandwidth.+ uint32 bandwidth_legacy = 1;++ // Bandwidth (Hz).+ uint32 bandwidth = 3;++ // Spreading-factors.+ repeated uint32 spreading_factors = 2;+}++message FskModulationConfig {+ // Bandwidth (kHz).+ // Deprecated: use bandwidth.+ uint32 bandwidth_legacy = 1;++ // Bandwidth (Hz).+ uint32 bandwidth = 3;++ // Bitrate.+ uint32 bitrate = 2;+}++message GatewayCommandExecRequest {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 6;++ // Command to execute.+ // This command must be pre-configured in the LoRa Gateway Bridge+ // configuration.+ string command = 2;++ // Execution request ID.+ // The same will be returned when the execution of the command has+ // completed.+ uint32 exec_id = 7;++ // Standard input.+ bytes stdin = 4;++ // Environment variables.+ map<string, string> environment = 5;+}++message GatewayCommandExecResponse {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 6;++ // Execution request ID.+ uint32 exec_id = 7;++ // Standard output.+ bytes stdout = 3;++ // Standard error.+ bytes stderr = 4;++ // Error message.+ string error = 5;+}++// RawPacketForwarderEvent contains a raw packet-forwarder event.+// It can be used to access packet-forwarder features that are not (fully)+// integrated with the ChirpStack Gateway Bridge.+message RawPacketForwarderEvent {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 4;++ // Payload contains the raw payload.+ bytes payload = 3;+}++// RawPacketForwarderEvent contains a raw packet-forwarder command.+// It can be used to access packet-forwarder features that are not (fully)+// integrated with the ChirpStack Gateway Bridge.+message RawPacketForwarderCommand {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 4;++ // Payload contains the raw payload.+ bytes payload = 3;+}++// ConnState contains the connection state of a gateway.+message ConnState {+ // Gateway ID.+ // Deprecated: use gateway_id.+ bytes gateway_id_legacy = 1;++ // Gateway ID.+ string gateway_id = 3;++ enum State {+ OFFLINE = 0;+ ONLINE = 1;+ }++ State state = 2;+}++// Gateway Mesh heartbeat (sent periodically by the Relay Gateways).+message MeshEventHeartbeat {++ // Relay path.+ repeated MeshEventHeartbeatRelayPath relay_path = 4;+}++message MeshEventHeartbeatRelayPath {+ // Relay ID.+ string relay_id = 1;++ // RSSI.+ int32 rssi = 2;++ // SNR.+ int32 snr = 3;+}++// Proprietary mesh event.+message MeshEventProprietary {+ // Event type.+ uint32 event_type = 1;++ // Payload.+ bytes payload = 2;+}++// Proprietary mesh command.+message MeshCommandProprietary {+ // Command type.+ uint32 command_type = 1;++ // Payload.+ bytes payload = 2;+}diff --git a/agent/src/main/proto/chirpstack/integration/integration.proto b/agent/src/main/proto/chirpstack/integration/integration.protonew file mode 100644index 000000000..8d703f2aa--- /dev/null+++ b/agent/src/main/proto/chirpstack/integration/integration.proto@@ -0,0 +1,367 @@+syntax = "proto3";++package integration;++option go_package = "github.com/brocaar/chirpstack/api/go/v4/integration";+option java_package = "io.chirpstack.api.integration";+option java_multiple_files = true;+option java_outer_classname = "IntegrationProto";+option csharp_namespace = "Chirpstack.Integration";+option php_namespace = "Chirpstack\\Integration";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Integration";++import "common/common.proto";+import "gw/gw.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/struct.proto";++enum LogLevel {+ // Info.+ INFO = 0;++ // Warning.+ WARNING = 1;++ // Error.+ ERROR = 2;+}++enum LogCode {+ // Unknown type.+ UNKNOWN = 0;++ // Error related to the downlink payload size.+ // Usually seen when the payload exceeded the maximum allowed payload size.+ DOWNLINK_PAYLOAD_SIZE = 1;++ // Uplink codec error.+ UPLINK_CODEC = 2;++ // Downlink codec error.+ DOWNLINK_CODEC = 3;++ // OTAA error.+ OTAA = 4;++ // Uplink frame-counter was reset.+ UPLINK_F_CNT_RESET = 5;++ // Uplink MIC error.+ UPLINK_MIC = 6;++ // Uplink frame-counter retransmission.+ UPLINK_F_CNT_RETRANSMISSION = 7;++ // Downlink gateway error.+ DOWNLINK_GATEWAY = 8;++ // Relay new end-device.+ RELAY_NEW_END_DEVICE = 9;++ // Downlink frame-counter.+ F_CNT_DOWN = 10;++ // Downlink has expired.+ EXPIRED = 11;+}++// Device information.+message DeviceInfo {+ // Tenant ID (UUID).+ string tenant_id = 1;++ // Tenant name.+ string tenant_name = 2;++ // Application ID (UUID).+ string application_id = 3;++ // Application name.+ string application_name = 4;++ // Device-profile ID (UUID).+ string device_profile_id = 5;++ // Device-profile name.+ string device_profile_name = 6;++ // Device name.+ string device_name = 7;++ // Device EUI.+ string dev_eui = 8;++ // Device class.+ common.DeviceClass device_class_enabled = 10;++ // Device-profile and device tags.+ map<string, string> tags = 9;+}++// Uplink relay RX information.+message UplinkRelayRxInfo {+ // Relay DevEUI.+ string dev_eui = 1;++ // Frequency.+ uint32 frequency = 2;++ // Data-rate.+ uint32 dr = 3;++ // SNR.+ int32 snr = 4;++ // RSSI.+ int32 rssi = 5;++ // WOR channel.+ uint32 wor_channel = 6;+}++// UplinkEvent is the message sent when an uplink payload has been received.+message UplinkEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device information.+ DeviceInfo device_info = 3;++ // Device address.+ string dev_addr = 4;++ // Device has ADR bit set.+ bool adr = 5;++ // Data-rate.+ uint32 dr = 6;++ // Frame counter.+ uint32 f_cnt = 7;++ // Frame port.+ uint32 f_port = 8;++ // Uplink was of type confirmed.+ bool confirmed = 9;++ // FRMPayload data.+ bytes data = 10;++ // Note that this is only set when a codec is configured in the Device+ // Profile.+ google.protobuf.Struct object = 11;++ // Receiving gateway RX info.+ repeated gw.UplinkRxInfo rx_info = 12;++ // TX info.+ gw.UplinkTxInfo tx_info = 13;++ // Relay info.+ UplinkRelayRxInfo relay_rx_info = 14;++ // Join-Server context.+ // A non-empty value indicatest that ChirpStack does not have access to+ // the AppSKey and that the encryption / decryption of the payloads is+ // the responsibility of the end-application.+ common.JoinServerContext join_server_context = 15;++ // Region config ID.+ // This contains the region config ID which reported the uplink.+ string region_config_id = 16;+}++// JoinEvent is the message sent when a device joined the network.+// Note: this event is sent at the first uplink after OTAA.+message JoinEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // Device address.+ string dev_addr = 4;++ // Relay info.+ UplinkRelayRxInfo relay_rx_info = 5;++ // Join-Server context.+ // A non-empty value indicatest that ChirpStack does not have access to+ // the AppSKey and that the encryption / decryption of the payloads is+ // the responsibility of the end-application.+ common.JoinServerContext join_server_context = 6;++ // Region config ID.+ // This contains the region config ID which reported the uplink.+ string region_config_id = 7;+}++// AckEvent is the message sent when a confirmation on a confirmed downlink+// has been received -or- when the downlink timed out.+message AckEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // Downlink queue item ID (UUID).+ string queue_item_id = 4;++ // Frame was acknowledged.+ bool acknowledged = 5;++ // Downlink frame counter to which the acknowledgement relates.+ uint32 f_cnt_down = 6;+}++// TxAckEvent is the message sent when a downlink was acknowledged by the+// gateway for transmission. As a downlink can be scheduled in the future, this+// event does not confirm that the message has already been transmitted.+message TxAckEvent {+ // Downlink ID.+ uint32 downlink_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // Downlink queue item ID (UUID).+ string queue_item_id = 4;++ // Downlink frame-counter.+ uint32 f_cnt_down = 5;++ // Gateway ID.+ string gateway_id = 6;++ // TX info.+ gw.DownlinkTxInfo tx_info = 7;+}++// LogEvent is the message sent when a device-related log was sent.+message LogEvent {+ // Timestamp.+ google.protobuf.Timestamp time = 1;++ // Device info.+ DeviceInfo device_info = 2;++ // Log level.+ LogLevel level = 3;++ // Log code.+ LogCode code = 4;++ // Description message.+ string description = 5;++ // Context map.+ map<string, string> context = 6;+}++// StatusEvent is the message sent when a device-status mac-command was sent+// by the device.+message StatusEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // The demodulation signal-to-noise ratio in dB for the last successfully+ // received device-status request by the Network Server.+ int32 margin = 5;++ // Device is connected to an external power source.+ bool external_power_source = 6;++ // Battery level is not available.+ bool battery_level_unavailable = 7;++ // Battery level.+ float battery_level = 8;+}++// LocationEvent is the message sent when a geolocation resolve was returned.+message LocationEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // Location.+ common.Location location = 4;+}++// IntegrationEvent is the message that can be sent by an integration.+// It allows for sending events which are provided by an external integration+// which are "not native" to ChirpStack.+message IntegrationEvent {+ // Deduplication ID (UUID).+ string deduplication_id = 1;++ // Timestamp.+ google.protobuf.Timestamp time = 2;++ // Device info.+ DeviceInfo device_info = 3;++ // Integration name.+ string integration_name = 4;++ // Event type.+ string event_type = 5;++ // Struct containing the event object.+ google.protobuf.Struct object = 6;+}++// DownlinkCommand is the command to enqueue a downlink payload for the given+// device.+message DownlinkCommand {+ // ID (UUID).+ // If left blank, a random UUID will be generated.+ string id = 1;++ // Device EUI (EUI64).+ string dev_eui = 2;++ // Confirmed.+ bool confirmed = 3;++ // FPort (must be > 0).+ uint32 f_port = 4;++ // Data.+ // Or use the json_object field when a codec has been configured.+ bytes data = 5;++ // Only use this when a codec has been configured that can encode this+ // object to bytes.+ google.protobuf.Struct object = 6;++ // Expires at (optional).+ // Expired queue-items will be automatically removed from the queue.+ google.protobuf.Timestamp expires_at = 7;+}diff --git a/agent/src/main/proto/chirpstack/internal/internal.proto b/agent/src/main/proto/chirpstack/internal/internal.protonew file mode 100644index 000000000..1b8e93d89--- /dev/null+++ b/agent/src/main/proto/chirpstack/internal/internal.proto@@ -0,0 +1,413 @@+syntax = "proto3";++package internal;++import "common/common.proto";+import "gw/gw.proto";+import "google/protobuf/timestamp.proto";++message DeviceSession {+ // Device address.+ bytes dev_addr = 2;++ // LoRaWAN mac-version.+ common.MacVersion mac_version = 4;++ // FNwkSIntKey.+ bytes f_nwk_s_int_key = 5;++ // SNwkSIntKey.+ bytes s_nwk_s_int_key = 6;++ // NwkSEncKey.+ bytes nwk_s_enc_key = 7;++ // AppSKey envelope.+ common.KeyEnvelope app_s_key = 8;++ // JS Session Key ID.+ bytes js_session_key_id = 42;++ // Uplink frame-counter.+ uint32 f_cnt_up = 9;++ // Downlink frame-counter (ns).+ uint32 n_f_cnt_down = 10;++ // Downlink frame-counter (as).+ uint32 a_f_cnt_down = 11;++ // Frame-counter holding the last confirmed downlink frame (n_f_cnt_down or+ // a_f_cnt_down).+ uint32 conf_f_cnt = 12;++ // Skip uplink frame-counter validation.+ bool skip_f_cnt_check = 13;++ // RX1 delay.+ uint32 rx1_delay = 14;++ // RX1 data-rate offset.+ uint32 rx1_dr_offset = 15;++ // RX2 data-rate.+ uint32 rx2_dr = 16;++ // RX2 frequency.+ uint32 rx2_frequency = 17;++ // Enabled uplink channels.+ repeated uint32 enabled_uplink_channel_indices = 18;++ // Extra user-defined uplink channels.+ map<uint32, DeviceSessionChannel> extra_uplink_channels = 19;++ // Class-B ping-slot data-rate.+ uint32 class_b_ping_slot_dr = 20;++ // Class-B ping-slot frequency.+ uint32 class_b_ping_slot_freq = 21;++ // Class-B ping-slot nb.+ uint32 class_b_ping_slot_nb = 22;++ // Nb. transmissions.+ uint32 nb_trans = 23;++ // TXPowerIndex which the node is using. The possible values are defined+ // by the lorawan/band package and are region specific. By default it is+ // assumed that the node is using TXPower 0. This value is controlled by+ // the ADR engine.+ uint32 tx_power_index = 24;++ // DR defines the (last known) data-rate at which the node is operating.+ // This value is controlled by the ADR engine.+ uint32 dr = 25;++ // ADR defines if the device has ADR enabled.+ bool adr = 26;++ // MaxSupportedTXPowerIndex defines the maximum supported tx-power index+ // by the node, or 0 when not set.+ uint32 max_supported_tx_power_index = 27;++ // MinSupportedTXPowerIndex defines the minimum supported tx-power index+ // by the node (default 0).+ uint32 min_supported_tx_power_index = 28;++ // Pending rejoin device-session contains a device-session which has not+ // yet been activated by the device (by sending a first uplink).+ DeviceSession pending_rejoin_device_session = 29;++ // Uplink history for ADR (last 20 uplink transmissions).+ // This table is reset in case one of parameters has changed:+ // * DR+ // * TxPower+ // * NbTrans+ repeated UplinkAdrHistory uplink_adr_history = 30;++ // Mac-command error count.+ map<uint32, uint32> mac_command_error_count = 31;++ // Last device-status request.+ google.protobuf.Timestamp last_device_status_request = 32;++ // RejoinRequestEnabled defines if the rejoin-request is enabled on the+ // device.+ bool rejoin_request_enabled = 33;++ // RejoinRequestMaxCountN defines the 2^(C+4) uplink message interval for+ // the rejoin-request.+ uint32 rejoin_request_max_count_n = 34;++ // RejoinRequestMaxTimeN defines the 2^(T+10) time interval (seconds)+ // for the rejoin-request.+ uint32 rejoin_request_max_time_n = 35;++ // Rejoin counter (RJCount0).+ // This counter is reset to 0 after each successful join-accept.+ uint32 rejoin_count_0 = 36;++ // Uplink dwell time.+ bool uplink_dwell_time_400ms = 37;++ // Downlink dwell time.+ bool downlink_dwell_time_400ms = 38;++ // Uplink max. EIRP index.+ uint32 uplink_max_eirp_index = 39;++ // Region configuration ID.+ string region_config_id = 40;++ // Relay state.+ Relay relay = 41;++ // Pending mac-commands.+ map<uint32, bytes> mac_command_pending = 43;+}++message UplinkAdrHistory {+ // Uplink frame-counter.+ uint32 f_cnt = 1;++ // Max SNR (of deduplicated frames received by one or multiple gateways).+ float max_snr = 2;++ // Max RSSI.+ int32 max_rssi = 5;++ // TX Power (as known by the network-server).+ uint32 tx_power_index = 3;++ // Number of receiving gateways.+ uint32 gateway_count = 4;+}++message Relay {+ // Devices provisioned on the relay.+ repeated RelayDevice devices = 1;++ // Filter list.+ repeated RelayFilter filters = 2;++ // Relay is enabled.+ bool enabled = 3;++ // CAD periodicity.+ uint32 cad_periodicity = 4;++ // Default channel index.+ uint32 default_channel_index = 5;++ // Second channel freq.+ uint32 second_channel_freq = 6;++ // Second channel DR.+ uint32 second_channel_dr = 7;++ // Second channel ACK offset.+ uint32 second_channel_ack_offset = 8;++ // End-device activation mode.+ uint32 ed_activation_mode = 9;++ // End-device smart-enable level.+ uint32 ed_smart_enable_level = 10;++ // End-device back-off.+ uint32 ed_back_off = 11;++ // Join-request limit reload rate.+ uint32 join_req_limit_reload_rate = 12;++ // Notify limit reload rate.+ uint32 notify_limit_reload_rate = 13;++ // Global uplink limit reload rate.+ uint32 global_uplink_limit_reload_rate = 14;++ // Overall limit reload rate.+ uint32 overall_limit_reload_rate = 15;++ // Join-request limit bucket size.+ uint32 join_req_limit_bucket_size = 16;++ // Notify limit bucket size.+ uint32 notify_limit_bucket_size = 17;++ // Global uplink limit bucket size.+ uint32 global_uplink_limit_bucket_size = 18;++ // Overall limit bucket size.+ uint32 overall_limit_bucket_size = 19;++ // End-device must communicate through relay only.+ // This is stored in the device-session as we need to validate on retrieving+ // the device-session.+ bool ed_relay_only = 20;++ // End-device WFCnt.+ // This holds the last known WFCnt value. ChirpStack will periodically read+ // this value from the Relay.+ uint32 w_f_cnt = 21;+}++message RelayDevice {+ // Index (used for filter and uplink filters).+ // This must be between 0 - 15.+ uint32 index = 1;++ // JoinEUI (EUI64).+ bytes join_eui = 2;++ // DevEUI (EUI64).+ bytes dev_eui = 3;++ // DevAddr.+ bytes dev_addr = 4;++ // RootWorSKey.+ bytes root_wor_s_key = 5;++ // Provisioned.+ bool provisioned = 6;++ // Uplink limit bucket size.+ uint32 uplink_limit_bucket_size = 7;++ // Uplink limit reload rate.+ uint32 uplink_limit_reload_rate = 8;++ // Timestamp of the last WFCnt request.+ // Note that ChirpStack periodically requests the WFCnt from the relay.+ google.protobuf.Timestamp w_f_cnt_last_request = 9;+}++message RelayFilter {+ // Index.+ // This must be between 0 - 15.+ uint32 index = 1;++ // Action.+ // * 0: No Rule+ // * 1: Forward+ // * 2: Filter+ uint32 action = 2;++ // DevEUI (EUI64).+ bytes dev_eui = 3;++ // JoinEUI (EUI64).+ bytes join_eui = 4;++ // Provisioned.+ bool provisioned = 5;+}++message DeviceSessionChannel {+ // Frequency Hz.+ uint32 frequency = 1;++ // Min. data-rate.+ uint32 min_dr = 2;++ // Max. data-rate.+ uint32 max_dr = 3;+}++message DeviceGatewayRxInfo {+ // DevEUI (EUI64).+ bytes dev_eui = 1;++ // Data-rate.+ uint32 dr = 2;++ // Gateway RxInfo elements.+ repeated DeviceGatewayRxInfoItem items = 3;+}++message DeviceGatewayRxInfoItem {+ // Gateway ID (EUI64).+ bytes gateway_id = 1;++ // RSSI.+ int32 rssi = 2;++ // LoRa SNR.+ float lora_snr = 3;++ // Antenna.+ uint32 antenna = 4;++ // Board.+ uint32 board = 5;++ // Context blob.+ bytes context = 6;++ // Gateway is private (uplink).+ bool is_private_up = 7;++ // Gateway is private (downlink).+ bool is_private_down = 8;++ // Tenant ID (UUID).+ bytes tenant_id = 9;+}++message DownlinkFrame {+ // Downlink ID.+ uint32 downlink_id = 1;++ // DevEUI.+ bytes dev_eui = 2;++ // Device queue item ID.+ bytes device_queue_item_id = 3;++ // Multicast Group ID.+ bytes multicast_group_id = 4;++ // Multicast queue item ID.+ bytes multicast_group_queue_item_id = 5;++ // Downlink frames.+ gw.DownlinkFrame downlink_frame = 6;++ // Encrypted FOpts (LoRaWAN 1.1).+ bool encrypted_fopts = 8;++ // Network session encryption key (for FOpts and FRMPayload mac-commands).+ bytes nwk_s_enc_key = 9;++ // NFCntDown (for decrypting mac-commands).+ uint32 n_f_cnt_down = 10;++ // AFCntDown (for decrypting FRMPayload in case of Relay).+ uint32 a_f_cnt_down = 11;++ // DevEUI of relayed device.+ bytes dev_eui_relayed = 12;+}++message LoraCloudGeolocBuffer {+ // Uplinks in buffer.+ repeated LoraCloudGeolocBufferUplink uplinks = 1;+}++message LoraCloudGeolocBufferUplink {+ // RxInfo set for a single uplink.+ repeated gw.UplinkRxInfo rx_info = 1;+}++message PassiveRoamingDeviceSession {+ // Session ID (UUID).+ // Unfortunately we can not use the DevEUI as unique identifier+ // as the PRStartAns DevEUI field is optional.+ bytes session_id = 1;++ // NetID of the hNS.+ bytes net_id = 2;++ // DevAddr of the device.+ bytes dev_addr = 3;++ // DevEUI of the device (optional).+ bytes dev_eui = 4;++ // LoRaWAN 1.1.+ bool lorawan_1_1 = 5;++ // LoRaWAN 1.0 NwkSKey / LoRaWAN 1.1 FNwkSIntKey.+ bytes f_nwk_s_int_key = 6;++ // Lifetime.+ google.protobuf.Timestamp lifetime = 7;++ // Uplink frame-counter.+ uint32 f_cnt_up = 8;++ // Validate MIC.+ bool validate_mic = 9;+}diff --git a/agent/src/main/proto/chirpstack/stream/api_request.proto b/agent/src/main/proto/chirpstack/stream/api_request.protonew file mode 100644index 000000000..765da7298--- /dev/null+++ b/agent/src/main/proto/chirpstack/stream/api_request.proto@@ -0,0 +1,26 @@+syntax = "proto3";++package stream;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";+option java_package = "io.chirpstack.api.stream";+option java_multiple_files = true;+option java_outer_classname = "ApiRequestProto";+option csharp_namespace = "Chirpstack.Stream";+option php_namespace = "Chirpstack\\Stream";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Stream";++import "google/protobuf/timestamp.proto";+import "common/common.proto";+import "gw/gw.proto";++message ApiRequestLog {+ // API service name.+ string service = 1;++ // API method name.+ string method = 2;++ // Metadata.+ map<string, string> metadata = 3;+}diff --git a/agent/src/main/proto/chirpstack/stream/backend_interfaces.proto b/agent/src/main/proto/chirpstack/stream/backend_interfaces.protonew file mode 100644index 000000000..cb59d510c--- /dev/null+++ b/agent/src/main/proto/chirpstack/stream/backend_interfaces.proto@@ -0,0 +1,42 @@+syntax = "proto3";++package stream;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";+option java_package = "io.chirpstack.api.stream";+option java_multiple_files = true;+option java_outer_classname = "BackendInterfacesProto";+option csharp_namespace = "Chirpstack.Stream";+option php_namespace = "Chirpstack\\Stream";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Stream";++import "google/protobuf/timestamp.proto";++message BackendInterfacesRequest {+ // Sender ID.+ string sender_id = 1;++ // Receiver ID.+ string receiver_id = 2;++ // Timestamp.+ google.protobuf.Timestamp time = 3;++ // Transaction ID.+ uint32 transaction_id = 4;++ // Message-type.+ string message_type = 5;++ // Result code.+ string result_code = 6;++ // Request body.+ string request_body = 7;++ // Request error.+ string request_error = 8;++ // Response body.+ string response_body = 9;+}diff --git a/agent/src/main/proto/chirpstack/stream/frame.proto b/agent/src/main/proto/chirpstack/stream/frame.protonew file mode 100644index 000000000..22af2af7e--- /dev/null+++ b/agent/src/main/proto/chirpstack/stream/frame.proto@@ -0,0 +1,76 @@+syntax = "proto3";++package stream;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";+option java_package = "io.chirpstack.api.stream";+option java_multiple_files = true;+option java_outer_classname = "FrameProto";+option csharp_namespace = "Chirpstack.Stream";+option php_namespace = "Chirpstack\\Stream";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Stream";++import "google/protobuf/timestamp.proto";+import "common/common.proto";+import "gw/gw.proto";++message UplinkFrameLog {+ // PHYPayload.+ bytes phy_payload = 1;++ // TX meta-data.+ gw.UplinkTxInfo tx_info = 2;++ // RX meta-data.+ repeated gw.UplinkRxInfo rx_info = 3;++ // Frame type.+ common.FType f_type = 4;++ // Device address (optional).+ string dev_addr = 5;++ // Device EUI (optional).+ string dev_eui = 6;++ // Time.+ google.protobuf.Timestamp time = 7;++ // Plaintext f_opts mac-commands.+ bool plaintext_f_opts = 8;++ // Plaintext frm_payload.+ bool plaintext_frm_payload = 9;+}++message DownlinkFrameLog {+ // Time.+ google.protobuf.Timestamp time = 1;++ // PHYPayload.+ bytes phy_payload = 2;++ // TX meta-data.+ gw.DownlinkTxInfo tx_info = 3;++ // Downlink ID.+ uint32 downlink_id = 4;++ // Gateway ID (EUI64).+ string gateway_id = 5;++ // Frame type.+ common.FType f_type = 6;++ // Device address (optional).+ string dev_addr = 7;++ // Device EUI (optional).+ string dev_eui = 8;++ // Plaintext f_opts mac-commands.+ bool plaintext_f_opts = 9;++ // Plaintext frm_payload.+ bool plaintext_frm_payload = 10;+}diff --git a/agent/src/main/proto/chirpstack/stream/meta.proto b/agent/src/main/proto/chirpstack/stream/meta.protonew file mode 100644index 000000000..226bf6e8d--- /dev/null+++ b/agent/src/main/proto/chirpstack/stream/meta.proto@@ -0,0 +1,63 @@+syntax = "proto3";++package stream;++option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";+option java_package = "io.chirpstack.api.stream";+option java_multiple_files = true;+option java_outer_classname = "MetaProto";+option csharp_namespace = "Chirpstack.Stream";+option php_namespace = "Chirpstack\\Stream";+option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Stream";++import "common/common.proto";+import "gw/gw.proto";++message UplinkMeta {+ // Device EUI (EUI64).+ string dev_eui = 1;++ // TX meta-data.+ gw.UplinkTxInfo tx_info = 2;++ // RX meta-data.+ repeated gw.UplinkRxInfo rx_info = 3;++ // PHYPayload byte count.+ uint32 phy_payload_byte_count = 4;++ // MAC-Command byte count.+ uint32 mac_command_byte_count = 5;++ // Application payload byte count.+ uint32 application_payload_byte_count = 6;++ // Frame type.+ common.FType frame_type = 7;+}++message DownlinkMeta {+ // Device EUI (EUI64).+ string dev_eui = 1;++ // Multicast Group ID (UUID).+ string multicast_group_id = 2;++ // TX meta-data.+ gw.DownlinkTxInfo tx_info = 3;++ // PHYPayload byte count.+ uint32 phy_payload_byte_count = 4;++ // MAC-Command byte count.+ uint32 mac_command_byte_count = 5;++ // Application payload byte count.+ uint32 application_payload_byte_count = 6;++ // Frame type.+ common.FType frame_type = 7;++ // Gateway ID (EUI64).+ string gateway_id = 8;+}diff --git a/agent/src/main/proto/shared/google/api/annotations.proto b/agent/src/main/proto/shared/google/api/annotations.protonew file mode 100644index 000000000..efdab3db6--- /dev/null+++ b/agent/src/main/proto/shared/google/api/annotations.proto@@ -0,0 +1,31 @@+// Copyright 2015 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package google.api;++import "google/api/http.proto";+import "google/protobuf/descriptor.proto";++option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";+option java_multiple_files = true;+option java_outer_classname = "AnnotationsProto";+option java_package = "com.google.api";+option objc_class_prefix = "GAPI";++extend google.protobuf.MethodOptions {+ // See `HttpRule`.+ HttpRule http = 72295728;+}diff --git a/agent/src/main/proto/shared/google/api/http.proto b/agent/src/main/proto/shared/google/api/http.protonew file mode 100644index 000000000..31d867a27--- /dev/null+++ b/agent/src/main/proto/shared/google/api/http.proto@@ -0,0 +1,379 @@+// Copyright 2023 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package google.api;++option cc_enable_arenas = true;+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";+option java_multiple_files = true;+option java_outer_classname = "HttpProto";+option java_package = "com.google.api";+option objc_class_prefix = "GAPI";++// Defines the HTTP configuration for an API service. It contains a list of+// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method+// to one or more HTTP REST API methods.+message Http {+ // A list of HTTP configuration rules that apply to individual API methods.+ //+ // **NOTE:** All service configuration rules follow "last one wins" order.+ repeated HttpRule rules = 1;++ // When set to true, URL path parameters will be fully URI-decoded except in+ // cases of single segment matches in reserved expansion, where "%2F" will be+ // left encoded.+ //+ // The default behavior is to not decode RFC 6570 reserved characters in multi+ // segment matches.+ bool fully_decode_reserved_expansion = 2;+}++// # gRPC Transcoding+//+// gRPC Transcoding is a feature for mapping between a gRPC method and one or+// more HTTP REST endpoints. It allows developers to build a single API service+// that supports both gRPC APIs and REST APIs. Many systems, including [Google+// APIs](https://github.com/googleapis/googleapis),+// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC+// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),+// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature+// and use it for large scale production services.+//+// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies+// how different portions of the gRPC request message are mapped to the URL+// path, URL query parameters, and HTTP request body. It also controls how the+// gRPC response message is mapped to the HTTP response body. `HttpRule` is+// typically specified as an `google.api.http` annotation on the gRPC method.+//+// Each mapping specifies a URL path template and an HTTP method. The path+// template may refer to one or more fields in the gRPC request message, as long+// as each field is a non-repeated field with a primitive (non-message) type.+// The path template controls how fields of the request message are mapped to+// the URL path.+//+// Example:+//+// service Messaging {+// rpc GetMessage(GetMessageRequest) returns (Message) {+// option (google.api.http) = {+// get: "/v1/{name=messages/*}"+// };+// }+// }+// message GetMessageRequest {+// string name = 1; // Mapped to URL path.+// }+// message Message {+// string text = 1; // The resource content.+// }+//+// This enables an HTTP REST to gRPC mapping as below:+//+// HTTP | gRPC+// -----|-----+// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`+//+// Any fields in the request message which are not bound by the path template+// automatically become HTTP query parameters if there is no HTTP request body.+// For example:+//+// service Messaging {+// rpc GetMessage(GetMessageRequest) returns (Message) {+// option (google.api.http) = {+// get:"/v1/messages/{message_id}"+// };+// }+// }+// message GetMessageRequest {+// message SubMessage {+// string subfield = 1;+// }+// string message_id = 1; // Mapped to URL path.+// int64 revision = 2; // Mapped to URL query parameter `revision`.+// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.+// }+//+// This enables a HTTP JSON to RPC mapping as below:+//+// HTTP | gRPC+// -----|-----+// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |+// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:+// "foo"))`+//+// Note that fields which are mapped to URL query parameters must have a+// primitive type or a repeated primitive type or a non-repeated message type.+// In the case of a repeated type, the parameter can be repeated in the URL+// as `...?param=A¶m=B`. In the case of a message type, each field of the+// message is mapped to a separate parameter, such as+// `...?foo.a=A&foo.b=B&foo.c=C`.+//+// For HTTP methods that allow a request body, the `body` field+// specifies the mapping. Consider a REST update method on the+// message resource collection:+//+// service Messaging {+// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {+// option (google.api.http) = {+// patch: "/v1/messages/{message_id}"+// body: "message"+// };+// }+// }+// message UpdateMessageRequest {+// string message_id = 1; // mapped to the URL+// Message message = 2; // mapped to the body+// }+//+// The following HTTP JSON to RPC mapping is enabled, where the+// representation of the JSON in the request body is determined by+// protos JSON encoding:+//+// HTTP | gRPC+// -----|-----+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:+// "123456" message { text: "Hi!" })`+//+// The special name `*` can be used in the body mapping to define that+// every field not bound by the path template should be mapped to the+// request body. This enables the following alternative definition of+// the update method:+//+// service Messaging {+// rpc UpdateMessage(Message) returns (Message) {+// option (google.api.http) = {+// patch: "/v1/messages/{message_id}"+// body: "*"+// };+// }+// }+// message Message {+// string message_id = 1;+// string text = 2;+// }+//+//+// The following HTTP JSON to RPC mapping is enabled:+//+// HTTP | gRPC+// -----|-----+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:+// "123456" text: "Hi!")`+//+// Note that when using `*` in the body mapping, it is not possible to+// have HTTP parameters, as all fields not bound by the path end in+// the body. This makes this option more rarely used in practice when+// defining REST APIs. The common usage of `*` is in custom methods+// which don't use the URL at all for transferring data.+//+// It is possible to define multiple HTTP methods for one RPC by using+// the `additional_bindings` option. Example:+//+// service Messaging {+// rpc GetMessage(GetMessageRequest) returns (Message) {+// option (google.api.http) = {+// get: "/v1/messages/{message_id}"+// additional_bindings {+// get: "/v1/users/{user_id}/messages/{message_id}"+// }+// };+// }+// }+// message GetMessageRequest {+// string message_id = 1;+// string user_id = 2;+// }+//+// This enables the following two alternative HTTP JSON to RPC mappings:+//+// HTTP | gRPC+// -----|-----+// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`+// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:+// "123456")`+//+// ## Rules for HTTP mapping+//+// 1. Leaf request fields (recursive expansion nested messages in the request+// message) are classified into three categories:+// - Fields referred by the path template. They are passed via the URL path.+// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They+// are passed via the HTTP+// request body.+// - All other fields are passed via the URL query parameters, and the+// parameter name is the field path in the request message. A repeated+// field can be represented as multiple query parameters under the same+// name.+// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL+// query parameter, all fields+// are passed via URL path and HTTP request body.+// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP+// request body, all+// fields are passed via URL path and URL query parameters.+//+// ### Path template syntax+//+// Template = "/" Segments [ Verb ] ;+// Segments = Segment { "/" Segment } ;+// Segment = "*" | "**" | LITERAL | Variable ;+// Variable = "{" FieldPath [ "=" Segments ] "}" ;+// FieldPath = IDENT { "." IDENT } ;+// Verb = ":" LITERAL ;+//+// The syntax `*` matches a single URL path segment. The syntax `**` matches+// zero or more URL path segments, which must be the last part of the URL path+// except the `Verb`.+//+// The syntax `Variable` matches part of the URL path as specified by its+// template. A variable template must not contain other variables. If a variable+// matches a single path segment, its template may be omitted, e.g. `{var}`+// is equivalent to `{var=*}`.+//+// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`+// contains any reserved character, such characters should be percent-encoded+// before the matching.+//+// If a variable contains exactly one path segment, such as `"{var}"` or+// `"{var=*}"`, when such a variable is expanded into a URL path on the client+// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The+// server side does the reverse decoding. Such variables show up in the+// [Discovery+// Document](https://developers.google.com/discovery/v1/reference/apis) as+// `{var}`.+//+// If a variable contains multiple path segments, such as `"{var=foo/*}"`+// or `"{var=**}"`, when such a variable is expanded into a URL path on the+// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.+// The server side does the reverse decoding, except "%2F" and "%2f" are left+// unchanged. Such variables show up in the+// [Discovery+// Document](https://developers.google.com/discovery/v1/reference/apis) as+// `{+var}`.+//+// ## Using gRPC API Service Configuration+//+// gRPC API Service Configuration (service config) is a configuration language+// for configuring a gRPC service to become a user-facing product. The+// service config is simply the YAML representation of the `google.api.Service`+// proto message.+//+// As an alternative to annotating your proto file, you can configure gRPC+// transcoding in your service config YAML files. You do this by specifying a+// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same+// effect as the proto annotation. This can be particularly useful if you+// have a proto that is reused in multiple services. Note that any transcoding+// specified in the service config will override any matching transcoding+// configuration in the proto.+//+// Example:+//+// http:+// rules:+// # Selects a gRPC method and applies HttpRule to it.+// - selector: example.v1.Messaging.GetMessage+// get: /v1/messages/{message_id}/{sub.subfield}+//+// ## Special notes+//+// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the+// proto to JSON conversion must follow the [proto3+// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).+//+// While the single segment variable follows the semantics of+// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String+// Expansion, the multi segment variable **does not** follow RFC 6570 Section+// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion+// does not expand special characters like `?` and `#`, which would lead+// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding+// for multi segment variables.+//+// The path variables **must not** refer to any repeated or mapped field,+// because client libraries are not capable of handling such variable expansion.+//+// The path variables **must not** capture the leading "/" character. The reason+// is that the most common use case "{var}" does not capture the leading "/"+// character. For consistency, all path variables must share the same behavior.+//+// Repeated message fields must not be mapped to URL query parameters, because+// no client library can support such complicated mapping.+//+// If an API needs to use a JSON array for request or response body, it can map+// the request or response body to a repeated field. However, some gRPC+// Transcoding implementations may not support this feature.+message HttpRule {+ // Selects a method to which this rule applies.+ //+ // Refer to [selector][google.api.DocumentationRule.selector] for syntax+ // details.+ string selector = 1;++ // Determines the URL pattern is matched by this rules. This pattern can be+ // used with any of the {get|put|post|delete|patch} methods. A custom method+ // can be defined using the 'custom' field.+ oneof pattern {+ // Maps to HTTP GET. Used for listing and getting information about+ // resources.+ string get = 2;++ // Maps to HTTP PUT. Used for replacing a resource.+ string put = 3;++ // Maps to HTTP POST. Used for creating a resource or performing an action.+ string post = 4;++ // Maps to HTTP DELETE. Used for deleting a resource.+ string delete = 5;++ // Maps to HTTP PATCH. Used for updating a resource.+ string patch = 6;++ // The custom pattern is used for specifying an HTTP method that is not+ // included in the `pattern` field, such as HEAD, or "*" to leave the+ // HTTP method unspecified for this rule. The wild-card rule is useful+ // for services that provide content to Web (HTML) clients.+ CustomHttpPattern custom = 8;+ }++ // The name of the request field whose value is mapped to the HTTP request+ // body, or `*` for mapping all request fields not captured by the path+ // pattern to the HTTP body, or omitted for not having any HTTP request body.+ //+ // NOTE: the referred field must be present at the top-level of the request+ // message type.+ string body = 7;++ // Optional. The name of the response field whose value is mapped to the HTTP+ // response body. When omitted, the entire response message will be used+ // as the HTTP response body.+ //+ // NOTE: The referred field must be present at the top-level of the response+ // message type.+ string response_body = 12;++ // Additional HTTP bindings for the selector. Nested bindings must+ // not contain an `additional_bindings` field themselves (that is,+ // the nesting may only be one level deep).+ repeated HttpRule additional_bindings = 11;+}++// A custom pattern is used for defining custom HTTP verb.+message CustomHttpPattern {+ // The name of this custom HTTP verb.+ string kind = 1;++ // The path matched by this custom verb.+ string path = 2;+}diff --git a/agent/src/main/proto/tts/README.md b/agent/src/main/proto/tts/README.mdnew file mode 100644index 000000000..cc6605d2c--- /dev/null+++ b/agent/src/main/proto/tts/README.md@@ -0,0 +1,38 @@+# The Things Stack gRPC API Proto Files++This directory contains the Protocol Buffer definitions (`.proto`) required to generate Java client classes for The Things Stack (TTN V3) gRPC API.++## Source Information++* **Upstream Repository:** [https://github.com/TheThingsNetwork/lorawan-stack](https://github.com/TheThingsNetwork/lorawan-stack)+* **Release Version:** `v3.34.3`+* **Source:** Files extracted from the `api/` directory of the official release source.++## Directory List++The following directory was copied directly from `api/`:++* `ttn/lorawan/v3/`++## Third-Party Dependencies (Flattened)++Dependencies located under `api/third_party/` in the upstream repository have been flattened into the local project structure as follows:++| Upstream Source Path (under api/third_party/) | Local Destination Path |+| :--- | :--- |+| `protoc-gen-openapiv2/options` | `protoc-gen-openapiv2/options/` |+| `thethings/flags` | `thethings/flags/` |+| `thethings/json` | `thethings/json/` |+| `validate` | `validate/` |++> [!NOTE]+> The files from **`api/third_party/google/api`** have been moved to the local **`shared/google/api`** directory to align with the project's shared resource structure.++## How to Update++1. Go to the [The Things Stack Releases](https://github.com/TheThingsNetwork/lorawan-stack/releases) page.+2. Download the Source Code for the target version.+3. Extract the `.proto` files from the `api/` folder.+4. Update the local files according to the flattened mapping table above.+5. Ensure `shared/google/api` is updated if the upstream Google dependencies have changed.+6. Re-run the builddiff --git a/agent/src/main/proto/tts/protoc-gen-openapiv2/options/annotations.proto b/agent/src/main/proto/tts/protoc-gen-openapiv2/options/annotations.protonew file mode 100644index 000000000..d63d3c87e--- /dev/null+++ b/agent/src/main/proto/tts/protoc-gen-openapiv2/options/annotations.proto@@ -0,0 +1,44 @@+syntax = "proto3";++package grpc.gateway.protoc_gen_openapiv2.options;++import "google/protobuf/descriptor.proto";+import "protoc-gen-openapiv2/options/openapiv2.proto";++option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options";++extend google.protobuf.FileOptions {+ // ID assigned by [email protected] for gRPC-Gateway project.+ //+ // All IDs are the same, as assigned. It is okay that they are the same, as they extend+ // different descriptor messages.+ Swagger openapiv2_swagger = 1042;+}+extend google.protobuf.MethodOptions {+ // ID assigned by [email protected] for gRPC-Gateway project.+ //+ // All IDs are the same, as assigned. It is okay that they are the same, as they extend+ // different descriptor messages.+ Operation openapiv2_operation = 1042;+}+extend google.protobuf.MessageOptions {+ // ID assigned by [email protected] for gRPC-Gateway project.+ //+ // All IDs are the same, as assigned. It is okay that they are the same, as they extend+ // different descriptor messages.+ Schema openapiv2_schema = 1042;+}+extend google.protobuf.ServiceOptions {+ // ID assigned by [email protected] for gRPC-Gateway project.+ //+ // All IDs are the same, as assigned. It is okay that they are the same, as they extend+ // different descriptor messages.+ Tag openapiv2_tag = 1042;+}+extend google.protobuf.FieldOptions {+ // ID assigned by [email protected] for gRPC-Gateway project.+ //+ // All IDs are the same, as assigned. It is okay that they are the same, as they extend+ // different descriptor messages.+ JSONSchema openapiv2_field = 1042;+}diff --git a/agent/src/main/proto/tts/protoc-gen-openapiv2/options/openapiv2.proto b/agent/src/main/proto/tts/protoc-gen-openapiv2/options/openapiv2.protonew file mode 100644index 000000000..36a2b978f--- /dev/null+++ b/agent/src/main/proto/tts/protoc-gen-openapiv2/options/openapiv2.proto@@ -0,0 +1,659 @@+syntax = "proto3";++package grpc.gateway.protoc_gen_openapiv2.options;++import "google/protobuf/struct.proto";++option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options";++// Scheme describes the schemes supported by the OpenAPI Swagger+// and Operation objects.+enum Scheme {+ UNKNOWN = 0;+ HTTP = 1;+ HTTPS = 2;+ WS = 3;+ WSS = 4;+}++// `Swagger` is a representation of OpenAPI v2 specification's Swagger object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject+//+// Example:+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {+// info: {+// title: "Echo API";+// version: "1.0";+// description: "";+// contact: {+// name: "gRPC-Gateway project";+// url: "https://github.com/grpc-ecosystem/grpc-gateway";+// email: "[email protected]";+// };+// license: {+// name: "BSD 3-Clause License";+// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt";+// };+// };+// schemes: HTTPS;+// consumes: "application/json";+// produces: "application/json";+// };+//+message Swagger {+ // Specifies the OpenAPI Specification version being used. It can be+ // used by the OpenAPI UI and other clients to interpret the API listing. The+ // value MUST be "2.0".+ string swagger = 1;+ // Provides metadata about the API. The metadata can be used by the+ // clients if needed.+ Info info = 2;+ // The host (name or ip) serving the API. This MUST be the host only and does+ // not include the scheme nor sub-paths. It MAY include a port. If the host is+ // not included, the host serving the documentation is to be used (including+ // the port). The host does not support path templating.+ string host = 3;+ // The base path on which the API is served, which is relative to the host. If+ // it is not included, the API is served directly under the host. The value+ // MUST start with a leading slash (/). The basePath does not support path+ // templating.+ // Note that using `base_path` does not change the endpoint paths that are+ // generated in the resulting OpenAPI file. If you wish to use `base_path`+ // with relatively generated OpenAPI paths, the `base_path` prefix must be+ // manually removed from your `google.api.http` paths and your code changed to+ // serve the API from the `base_path`.+ string base_path = 4;+ // The transfer protocol of the API. Values MUST be from the list: "http",+ // "https", "ws", "wss". If the schemes is not included, the default scheme to+ // be used is the one used to access the OpenAPI definition itself.+ repeated Scheme schemes = 5;+ // A list of MIME types the APIs can consume. This is global to all APIs but+ // can be overridden on specific API calls. Value MUST be as described under+ // Mime Types.+ repeated string consumes = 6;+ // A list of MIME types the APIs can produce. This is global to all APIs but+ // can be overridden on specific API calls. Value MUST be as described under+ // Mime Types.+ repeated string produces = 7;+ // field 8 is reserved for 'paths'.+ reserved 8;+ // field 9 is reserved for 'definitions', which at this time are already+ // exposed as and customizable as proto messages.+ reserved 9;+ // An object to hold responses that can be used across operations. This+ // property does not define global responses for all operations.+ map<string, Response> responses = 10;+ // Security scheme definitions that can be used across the specification.+ SecurityDefinitions security_definitions = 11;+ // A declaration of which security schemes are applied for the API as a whole.+ // The list of values describes alternative security schemes that can be used+ // (that is, there is a logical OR between the security requirements).+ // Individual operations can override this definition.+ repeated SecurityRequirement security = 12;+ // field 13 is reserved for 'tags', which are supposed to be exposed as and+ // customizable as proto services. TODO(ivucica): add processing of proto+ // service objects into OpenAPI v2 Tag objects.+ reserved 13;+ // Additional external documentation.+ ExternalDocumentation external_docs = 14;+ map<string, google.protobuf.Value> extensions = 15;+}++// `Operation` is a representation of OpenAPI v2 specification's Operation object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject+//+// Example:+//+// service EchoService {+// rpc Echo(SimpleMessage) returns (SimpleMessage) {+// option (google.api.http) = {+// get: "/v1/example/echo/{id}"+// };+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {+// summary: "Get a message.";+// operation_id: "getMessage";+// tags: "echo";+// responses: {+// key: "200"+// value: {+// description: "OK";+// }+// }+// };+// }+// }+message Operation {+ // A list of tags for API documentation control. Tags can be used for logical+ // grouping of operations by resources or any other qualifier.+ repeated string tags = 1;+ // A short summary of what the operation does. For maximum readability in the+ // swagger-ui, this field SHOULD be less than 120 characters.+ string summary = 2;+ // A verbose explanation of the operation behavior. GFM syntax can be used for+ // rich text representation.+ string description = 3;+ // Additional external documentation for this operation.+ ExternalDocumentation external_docs = 4;+ // Unique string used to identify the operation. The id MUST be unique among+ // all operations described in the API. Tools and libraries MAY use the+ // operationId to uniquely identify an operation, therefore, it is recommended+ // to follow common programming naming conventions.+ string operation_id = 5;+ // A list of MIME types the operation can consume. This overrides the consumes+ // definition at the OpenAPI Object. An empty value MAY be used to clear the+ // global definition. Value MUST be as described under Mime Types.+ repeated string consumes = 6;+ // A list of MIME types the operation can produce. This overrides the produces+ // definition at the OpenAPI Object. An empty value MAY be used to clear the+ // global definition. Value MUST be as described under Mime Types.+ repeated string produces = 7;+ // field 8 is reserved for 'parameters'.+ reserved 8;+ // The list of possible responses as they are returned from executing this+ // operation.+ map<string, Response> responses = 9;+ // The transfer protocol for the operation. Values MUST be from the list:+ // "http", "https", "ws", "wss". The value overrides the OpenAPI Object+ // schemes definition.+ repeated Scheme schemes = 10;+ // Declares this operation to be deprecated. Usage of the declared operation+ // should be refrained. Default value is false.+ bool deprecated = 11;+ // A declaration of which security schemes are applied for this operation. The+ // list of values describes alternative security schemes that can be used+ // (that is, there is a logical OR between the security requirements). This+ // definition overrides any declared top-level security. To remove a top-level+ // security declaration, an empty array can be used.+ repeated SecurityRequirement security = 12;+ map<string, google.protobuf.Value> extensions = 13;+}++// `Header` is a representation of OpenAPI v2 specification's Header object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject+//+message Header {+ // `Description` is a short description of the header.+ string description = 1;+ // The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported.+ string type = 2;+ // `Format` The extending format for the previously mentioned type.+ string format = 3;+ // field 4 is reserved for 'items', but in OpenAPI-specific way.+ reserved 4;+ // field 5 is reserved `Collection Format` Determines the format of the array if type array is used.+ reserved 5;+ // `Default` Declares the value of the header that the server will use if none is provided.+ // See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.+ // Unlike JSON Schema this value MUST conform to the defined type for the header.+ string default = 6;+ // field 7 is reserved for 'maximum'.+ reserved 7;+ // field 8 is reserved for 'exclusiveMaximum'.+ reserved 8;+ // field 9 is reserved for 'minimum'.+ reserved 9;+ // field 10 is reserved for 'exclusiveMinimum'.+ reserved 10;+ // field 11 is reserved for 'maxLength'.+ reserved 11;+ // field 12 is reserved for 'minLength'.+ reserved 12;+ // 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.+ string pattern = 13;+ // field 14 is reserved for 'maxItems'.+ reserved 14;+ // field 15 is reserved for 'minItems'.+ reserved 15;+ // field 16 is reserved for 'uniqueItems'.+ reserved 16;+ // field 17 is reserved for 'enum'.+ reserved 17;+ // field 18 is reserved for 'multipleOf'.+ reserved 18;+}++// `Response` is a representation of OpenAPI v2 specification's Response object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject+//+message Response {+ // `Description` is a short description of the response.+ // GFM syntax can be used for rich text representation.+ string description = 1;+ // `Schema` optionally defines the structure of the response.+ // If `Schema` is not provided, it means there is no content to the response.+ Schema schema = 2;+ // `Headers` A list of headers that are sent with the response.+ // `Header` name is expected to be a string in the canonical format of the MIME header key+ // See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey+ map<string, Header> headers = 3;+ // `Examples` gives per-mimetype response examples.+ // See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object+ map<string, string> examples = 4;+ map<string, google.protobuf.Value> extensions = 5;+}++// `Info` is a representation of OpenAPI v2 specification's Info object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject+//+// Example:+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {+// info: {+// title: "Echo API";+// version: "1.0";+// description: "";+// contact: {+// name: "gRPC-Gateway project";+// url: "https://github.com/grpc-ecosystem/grpc-gateway";+// email: "[email protected]";+// };+// license: {+// name: "BSD 3-Clause License";+// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt";+// };+// };+// ...+// };+//+message Info {+ // The title of the application.+ string title = 1;+ // A short description of the application. GFM syntax can be used for rich+ // text representation.+ string description = 2;+ // The Terms of Service for the API.+ string terms_of_service = 3;+ // The contact information for the exposed API.+ Contact contact = 4;+ // The license information for the exposed API.+ License license = 5;+ // Provides the version of the application API (not to be confused+ // with the specification version).+ string version = 6;+ map<string, google.protobuf.Value> extensions = 7;+}++// `Contact` is a representation of OpenAPI v2 specification's Contact object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject+//+// Example:+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {+// info: {+// ...+// contact: {+// name: "gRPC-Gateway project";+// url: "https://github.com/grpc-ecosystem/grpc-gateway";+// email: "[email protected]";+// };+// ...+// };+// ...+// };+//+message Contact {+ // The identifying name of the contact person/organization.+ string name = 1;+ // The URL pointing to the contact information. MUST be in the format of a+ // URL.+ string url = 2;+ // The email address of the contact person/organization. MUST be in the format+ // of an email address.+ string email = 3;+}++// `License` is a representation of OpenAPI v2 specification's License object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject+//+// Example:+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {+// info: {+// ...+// license: {+// name: "BSD 3-Clause License";+// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt";+// };+// ...+// };+// ...+// };+//+message License {+ // The license name used for the API.+ string name = 1;+ // A URL to the license used for the API. MUST be in the format of a URL.+ string url = 2;+}++// `ExternalDocumentation` is a representation of OpenAPI v2 specification's+// ExternalDocumentation object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject+//+// Example:+//+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {+// ...+// external_docs: {+// description: "More about gRPC-Gateway";+// url: "https://github.com/grpc-ecosystem/grpc-gateway";+// }+// ...+// };+//+message ExternalDocumentation {+ // A short description of the target documentation. GFM syntax can be used for+ // rich text representation.+ string description = 1;+ // The URL for the target documentation. Value MUST be in the format+ // of a URL.+ string url = 2;+}++// `Schema` is a representation of OpenAPI v2 specification's Schema object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject+//+message Schema {+ JSONSchema json_schema = 1;+ // Adds support for polymorphism. The discriminator is the schema property+ // name that is used to differentiate between other schema that inherit this+ // schema. The property name used MUST be defined at this schema and it MUST+ // be in the required property list. When used, the value MUST be the name of+ // this schema or any schema that inherits it.+ string discriminator = 2;+ // Relevant only for Schema "properties" definitions. Declares the property as+ // "read only". This means that it MAY be sent as part of a response but MUST+ // NOT be sent as part of the request. Properties marked as readOnly being+ // true SHOULD NOT be in the required list of the defined schema. Default+ // value is false.+ bool read_only = 3;+ // field 4 is reserved for 'xml'.+ reserved 4;+ // Additional external documentation for this schema.+ ExternalDocumentation external_docs = 5;+ // A free-form property to include an example of an instance for this schema in JSON.+ // This is copied verbatim to the output.+ string example = 6;+}++// `JSONSchema` represents properties from JSON Schema taken, and as used, in+// the OpenAPI v2 spec.+//+// This includes changes made by OpenAPI v2.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject+//+// See also: https://cswr.github.io/JsonSchema/spec/basic_types/,+// https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json+//+// Example:+//+// message SimpleMessage {+// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {+// json_schema: {+// title: "SimpleMessage"+// description: "A simple message."+// required: ["id"]+// }+// };+//+// // Id represents the message identifier.+// string id = 1; [+// (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+// description: "The unique identifier of the simple message."+// }];+// }+//+message JSONSchema {+ // field 1 is reserved for '$id', omitted from OpenAPI v2.+ reserved 1;+ // field 2 is reserved for '$schema', omitted from OpenAPI v2.+ reserved 2;+ // Ref is used to define an external reference to include in the message.+ // This could be a fully qualified proto message reference, and that type must+ // be imported into the protofile. If no message is identified, the Ref will+ // be used verbatim in the output.+ // For example:+ // `ref: ".google.protobuf.Timestamp"`.+ string ref = 3;+ // field 4 is reserved for '$comment', omitted from OpenAPI v2.+ reserved 4;+ // The title of the schema.+ string title = 5;+ // A short description of the schema.+ string description = 6;+ string default = 7;+ bool read_only = 8;+ // A free-form property to include a JSON example of this field. This is copied+ // verbatim to the output swagger.json. Quotes must be escaped.+ // This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject+ string example = 9;+ double multiple_of = 10;+ // Maximum represents an inclusive upper limit for a numeric instance. The+ // value of MUST be a number,+ double maximum = 11;+ bool exclusive_maximum = 12;+ // minimum represents an inclusive lower limit for a numeric instance. The+ // value of MUST be a number,+ double minimum = 13;+ bool exclusive_minimum = 14;+ uint64 max_length = 15;+ uint64 min_length = 16;+ string pattern = 17;+ // field 18 is reserved for 'additionalItems', omitted from OpenAPI v2.+ reserved 18;+ // field 19 is reserved for 'items', but in OpenAPI-specific way.+ // TODO(ivucica): add 'items'?+ reserved 19;+ uint64 max_items = 20;+ uint64 min_items = 21;+ bool unique_items = 22;+ // field 23 is reserved for 'contains', omitted from OpenAPI v2.+ reserved 23;+ uint64 max_properties = 24;+ uint64 min_properties = 25;+ repeated string required = 26;+ // field 27 is reserved for 'additionalProperties', but in OpenAPI-specific+ // way. TODO(ivucica): add 'additionalProperties'?+ reserved 27;+ // field 28 is reserved for 'definitions', omitted from OpenAPI v2.+ reserved 28;+ // field 29 is reserved for 'properties', but in OpenAPI-specific way.+ // TODO(ivucica): add 'additionalProperties'?+ reserved 29;+ // following fields are reserved, as the properties have been omitted from+ // OpenAPI v2:+ // patternProperties, dependencies, propertyNames, const+ reserved 30 to 33;+ // Items in 'array' must be unique.+ repeated string array = 34;++ enum JSONSchemaSimpleTypes {+ UNKNOWN = 0;+ ARRAY = 1;+ BOOLEAN = 2;+ INTEGER = 3;+ NULL = 4;+ NUMBER = 5;+ OBJECT = 6;+ STRING = 7;+ }++ repeated JSONSchemaSimpleTypes type = 35;+ // `Format`+ string format = 36;+ // following fields are reserved, as the properties have been omitted from+ // OpenAPI v2: contentMediaType, contentEncoding, if, then, else+ reserved 37 to 41;+ // field 42 is reserved for 'allOf', but in OpenAPI-specific way.+ // TODO(ivucica): add 'allOf'?+ reserved 42;+ // following fields are reserved, as the properties have been omitted from+ // OpenAPI v2:+ // anyOf, oneOf, not+ reserved 43 to 45;+ // Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1+ repeated string enum = 46;++ // Additional field level properties used when generating the OpenAPI v2 file.+ FieldConfiguration field_configuration = 1001;++ // 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file.+ // These properties are not defined by OpenAPIv2, but they are used to control the generation.+ message FieldConfiguration {+ // Alternative parameter name when used as path parameter. If set, this will+ // be used as the complete parameter name when this field is used as a path+ // parameter. Use this to avoid having auto generated path parameter names+ // for overlapping paths.+ string path_param_name = 47;+ }+ map<string, google.protobuf.Value> extensions = 48;+}++// `Tag` is a representation of OpenAPI v2 specification's Tag object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject+//+message Tag {+ // field 1 is reserved for 'name'. In our generator, this is (to be) extracted+ // from the name of proto service, and thus not exposed to the user, as+ // changing tag object's name would break the link to the references to the+ // tag in individual operation specifications.+ //+ // TODO(ivucica): Add 'name' property. Use it to allow override of the name of+ // global Tag object, then use that name to reference the tag throughout the+ // OpenAPI file.+ reserved 1;+ // A short description for the tag. GFM syntax can be used for rich text+ // representation.+ string description = 2;+ // Additional external documentation for this tag.+ ExternalDocumentation external_docs = 3;+}++// `SecurityDefinitions` is a representation of OpenAPI v2 specification's+// Security Definitions object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject+//+// A declaration of the security schemes available to be used in the+// specification. This does not enforce the security schemes on the operations+// and only serves to provide the relevant details for each scheme.+message SecurityDefinitions {+ // A single security scheme definition, mapping a "name" to the scheme it+ // defines.+ map<string, SecurityScheme> security = 1;+}++// `SecurityScheme` is a representation of OpenAPI v2 specification's+// Security Scheme object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject+//+// Allows the definition of a security scheme that can be used by the+// operations. Supported schemes are basic authentication, an API key (either as+// a header or as a query parameter) and OAuth2's common flows (implicit,+// password, application and access code).+message SecurityScheme {+ // The type of the security scheme. Valid values are "basic",+ // "apiKey" or "oauth2".+ enum Type {+ TYPE_INVALID = 0;+ TYPE_BASIC = 1;+ TYPE_API_KEY = 2;+ TYPE_OAUTH2 = 3;+ }++ // The location of the API key. Valid values are "query" or "header".+ enum In {+ IN_INVALID = 0;+ IN_QUERY = 1;+ IN_HEADER = 2;+ }++ // The flow used by the OAuth2 security scheme. Valid values are+ // "implicit", "password", "application" or "accessCode".+ enum Flow {+ FLOW_INVALID = 0;+ FLOW_IMPLICIT = 1;+ FLOW_PASSWORD = 2;+ FLOW_APPLICATION = 3;+ FLOW_ACCESS_CODE = 4;+ }++ // The type of the security scheme. Valid values are "basic",+ // "apiKey" or "oauth2".+ Type type = 1;+ // A short description for security scheme.+ string description = 2;+ // The name of the header or query parameter to be used.+ // Valid for apiKey.+ string name = 3;+ // The location of the API key. Valid values are "query" or+ // "header".+ // Valid for apiKey.+ In in = 4;+ // The flow used by the OAuth2 security scheme. Valid values are+ // "implicit", "password", "application" or "accessCode".+ // Valid for oauth2.+ Flow flow = 5;+ // The authorization URL to be used for this flow. This SHOULD be in+ // the form of a URL.+ // Valid for oauth2/implicit and oauth2/accessCode.+ string authorization_url = 6;+ // The token URL to be used for this flow. This SHOULD be in the+ // form of a URL.+ // Valid for oauth2/password, oauth2/application and oauth2/accessCode.+ string token_url = 7;+ // The available scopes for the OAuth2 security scheme.+ // Valid for oauth2.+ Scopes scopes = 8;+ map<string, google.protobuf.Value> extensions = 9;+}++// `SecurityRequirement` is a representation of OpenAPI v2 specification's+// Security Requirement object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject+//+// Lists the required security schemes to execute this operation. The object can+// have multiple security schemes declared in it which are all required (that+// is, there is a logical AND between the schemes).+//+// The name used for each property MUST correspond to a security scheme+// declared in the Security Definitions.+message SecurityRequirement {+ // If the security scheme is of type "oauth2", then the value is a list of+ // scope names required for the execution. For other security scheme types,+ // the array MUST be empty.+ message SecurityRequirementValue {+ repeated string scope = 1;+ }+ // Each name must correspond to a security scheme which is declared in+ // the Security Definitions. If the security scheme is of type "oauth2",+ // then the value is a list of scope names required for the execution.+ // For other security scheme types, the array MUST be empty.+ map<string, SecurityRequirementValue> security_requirement = 1;+}++// `Scopes` is a representation of OpenAPI v2 specification's Scopes object.+//+// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject+//+// Lists the available scopes for an OAuth2 security scheme.+message Scopes {+ // Maps between a name of a scope to a short description of it (as the value+ // of the property).+ map<string, string> scope = 1;+}diff --git a/agent/src/main/proto/tts/thethings/flags/annotations.proto b/agent/src/main/proto/tts/thethings/flags/annotations.protonew file mode 100644index 000000000..c323e9c45--- /dev/null+++ b/agent/src/main/proto/tts/thethings/flags/annotations.proto@@ -0,0 +1,93 @@+// Copyright © 2021 The Things Industries B.V.+// SPDX-License-Identifier: Apache-2.0++syntax = "proto2";++package thethings.flags;++import "google/protobuf/descriptor.proto";++option go_package = "github.com/TheThingsIndustries/protoc-gen-go-flags/annotations";++// NOTE: protoc-gen-go-flags is primarily intended for internal use by+// The Things Industries. We have therefore chosen to use option number 51886,+// which is in the 50000-99999 range reserved for internal use within individual+// organizations. For this reason, the option number is not registered on+// https://github.com/protocolbuffers/protobuf/blob/master/docs/options.md.++message FileOptions {}++extend google.protobuf.FileOptions {+ optional FileOptions file = 51886;+}++message MessageOptions {+ // Generate (field mask) selector flags for this message.+ optional bool select = 1;+ // Generate setter flags for this message.+ optional bool set = 2;+ // Treat this message as a wrapper for the value field inside it.+ optional bool wrapper = 3;+ // Generate semantical flags for this message. Only active when set is also set.+ optional bool semantical = 4;+}++extend google.protobuf.MessageOptions {+ optional MessageOptions message = 51886;+}++message FieldOptions {+ // Skip generating (field mask) selector flags for this field.+ optional bool select = 1;+ // Skip generating setter flags for this field.+ optional bool set = 2;+ // New flag definition for custom type flag.+ // Specified as github.com/username/repo/package.New{CustomType}Flag.+ optional string set_flag_new_func = 3;+ // Custom value getter from the custom flag type.+ // Specified as github.com/username/repo/package.Get{CustomType}FromFlag.+ optional string set_flag_getter_func = 4;+ // Set flag and all of its subfield flags to hidden.+ optional bool hidden = 5;+ // Implies field has meaning just by existing. Only active when set is also set.+ optional bool semantical = 6;+}++extend google.protobuf.FieldOptions {+ optional FieldOptions field = 51886;+}++message OneofOptions {}++extend google.protobuf.OneofOptions {+ optional OneofOptions oneof = 51886;+}++message EnumOptions {+ // Path where the custom enum values are defined.+ // The map must be of type string to int32, where string is an alias name and+ // int32 must be a valid enum int32.+ optional string alias_map = 1;+}++extend google.protobuf.EnumOptions {+ optional EnumOptions enum = 51886;+}++message EnumValueOptions {}++extend google.protobuf.EnumValueOptions {+ optional EnumValueOptions enum_value = 51886;+}++message ServiceOptions {}++extend google.protobuf.ServiceOptions {+ optional ServiceOptions service = 51886;+}++message MethodOptions {}++extend google.protobuf.MethodOptions {+ optional MethodOptions method = 51886;+}diff --git a/agent/src/main/proto/tts/thethings/json/annotations.proto b/agent/src/main/proto/tts/thethings/json/annotations.protonew file mode 100644index 000000000..7d1f77f85--- /dev/null+++ b/agent/src/main/proto/tts/thethings/json/annotations.proto@@ -0,0 +1,99 @@+// Copyright © 2021 The Things Industries B.V.+// SPDX-License-Identifier: Apache-2.0++syntax = "proto2";++package thethings.json;++import "google/protobuf/descriptor.proto";++option go_package = "github.com/TheThingsIndustries/protoc-gen-go-json/annotations";++// NOTE: protoc-gen-go-json is primarily intended for internal use by+// The Things Industries. We have therefore chosen to use option number 51885,+// which is in the 50000-99999 range reserved for internal use within individual+// organizations. For this reason, the option number is not registered on+// https://github.com/protocolbuffers/protobuf/blob/master/docs/options.md.++message FileOptions {+ // Generate marshalers for all messages and enums in this file.+ // Message options can be used to override this.+ optional bool marshaler_all = 1;+ // Generate unmarshalers for all messages and enums in this file.+ // Message options can be used to override this.+ optional bool unmarshaler_all = 2;+}++extend google.protobuf.FileOptions {+ optional FileOptions file = 51885;+}++message MessageOptions {+ // Generate a marshaler for this message.+ optional bool marshaler = 1;+ // Generate an unmarshaler for this message.+ optional bool unmarshaler = 2;+ // Treat this message as a wrapper for the value field inside it.+ optional bool wrapper = 3;+}++extend google.protobuf.MessageOptions {+ optional MessageOptions message = 51885;+}++message FieldOptions {+ // Custom marshaler function. Specified as github.com/username/repo/package.FuncName.+ optional string marshaler_func = 1;+ // Custom unmarshaler function. Specified as github.com/username/repo/package.FuncName.+ optional string unmarshaler_func = 2;+}++extend google.protobuf.FieldOptions {+ optional FieldOptions field = 51885;+}++message OneofOptions {}++extend google.protobuf.OneofOptions {+ optional OneofOptions oneof = 51885;+}++message EnumOptions {+ // Generate a marshaler for this enum.+ optional bool marshaler = 1;+ // Always marshal as a number.+ optional bool marshal_as_number = 2;+ // Always marshal as a string.+ optional bool marshal_as_string = 3;+ // Generate an unmarshaler for this enum.+ optional bool unmarshaler = 4;+ // Consider string values with this prefix when unmarshaling.+ optional string prefix = 5;+}++extend google.protobuf.EnumOptions {+ optional EnumOptions enum = 51885;+}++message EnumValueOptions {+ // The value to emit when marshaling as string.+ optional string value = 1;+ // Aliases to accept when unmarshaling from string.+ repeated string aliases = 2;+}++extend google.protobuf.EnumValueOptions {+ optional EnumValueOptions enum_value = 51885;+}++message ServiceOptions {}++extend google.protobuf.ServiceOptions {+ optional ServiceOptions service = 51885;+}++message MethodOptions {}++extend google.protobuf.MethodOptions {+ optional MethodOptions method = 51885;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/_api.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/_api.protonew file mode 100644index 000000000..0d6f9cfa3--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/_api.proto@@ -0,0 +1,22 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++// Package documentation should be added in the comment block below:++// The Things Stack for LoRaWAN v3 API+package ttn.lorawan.v3;++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/application.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/application.protonew file mode 100644index 000000000..fac4e7470--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/application.proto@@ -0,0 +1,297 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Application is the message that defines an Application in the network.+message Application {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The identifiers of the application. These are public and can be seen by any authenticated user in the network.+ ApplicationIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // When the application was created. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the application was last updated. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the application was deleted. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp deleted_at = 8 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // The name of the application.+ string name = 4 [(validate.rules).string.max_len = 50];+ // A description for the application.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this application. Typically used for organizing applications or for storing integration-specific data.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Contact information for this application. Typically used to indicate who to contact with technical/security questions about the application.+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];++ OrganizationOrUserIdentifiers administrative_contact = 10;+ OrganizationOrUserIdentifiers technical_contact = 11;++ // The address of the Network Server where this application is supposed to be registered.+ // If set, this fields indicates where end devices for this application should be registered.+ //+ // Stored in Entity Registry.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string network_server_address = 12 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];++ // The address of the Application Server where this application is supposed to be registered.+ // If set, this fields indicates where end devices for this application should be registered.+ //+ // Stored in Entity Registry.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string application_server_address = 13 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];++ // The address of the Join Server where this application is supposed to be registered.+ // If set, this fields indicates where end devices for this application should be registered.+ //+ // Stored in Entity Registry.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string join_server_address = 14 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];++ uint32 dev_eui_counter = 9 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ reserved 15;+ reserved "end_device_limit";++ reserved 16;+ reserved "label_ids";++ // next: 17+}++message Applications {+ repeated Application applications = 1;+}++message IssueDevEUIResponse {+ bytes dev_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message GetApplicationRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // The names of the application fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // By default we list all applications the caller has rights on.+ // Set the user or the organization (not both) to instead list the applications+ // where the user or organization is collaborator on.+ OrganizationOrUserIdentifiers collaborator = 1 [(thethings.flags.field) = {hidden: true}];+ // The names of the application fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "application_id",+ "-application_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+ // Only return recently deleted applications.+ bool deleted = 6;+}++message CreateApplicationRequest {+ Application application = 1 [(validate.rules).message.required = true];+ // Collaborator to grant all rights on the newly created application.+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateApplicationRequest {+ Application application = 1 [(validate.rules).message.required = true];+ // The names of the application fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationAPIKeysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path.+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "api_key_id",+ "-api_key_id",+ "name",+ "-name",+ "created_at",+ "-created_at",+ "expires_at",+ "-expires_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+}++message GetApplicationAPIKeyRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // Unique public identifier for the API key.+ string key_id = 2;+}++message CreateApplicationAPIKeyRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ string name = 2 [(validate.rules).string.max_len = 50];+ repeated Right rights = 3 [(validate.rules).repeated = {+ min_items: 1,+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+ google.protobuf.Timestamp expires_at = 4 [(validate.rules).timestamp.gt_now = true];+}++message UpdateApplicationAPIKeyRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ APIKey api_key = 2 [(validate.rules).message.required = true];+ // The names of the api key fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteApplicationAPIKeyRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ string key_id = 2;+}++message ListApplicationCollaboratorsRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "id",+ "-id",+ "-rights",+ "rights"+ ]+ }];+}++message GetApplicationCollaboratorRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message SetApplicationCollaboratorRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ Collaborator collaborator = 2 [(validate.rules).message.required = true];+}++message DeleteApplicationCollaboratorRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator_ids = 2 [(validate.rules).message.required = true];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/application_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/application_services.protonew file mode 100644index 000000000..2a8541504--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/application_services.proto@@ -0,0 +1,175 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/application.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The ApplicationRegistry service, exposed by the Identity Server, is used to manage+// application registrations.+service ApplicationRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage applications."};+ // Create a new application. This also sets the given organization or user as+ // first collaborator with all possible rights.+ rpc Create(CreateApplicationRequest) returns (Application) {+ option (google.api.http) = {+ post: "/users/{collaborator.user_ids.user_id}/applications"+ body: "*"+ additional_bindings {+ post: "/organizations/{collaborator.organization_ids.organization_id}/applications"+ body: "*"+ }+ };+ }++ // Get the application with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc Get(GetApplicationRequest) returns (Application) {+ option (google.api.http) = {get: "/applications/{application_ids.application_id}"};+ }++ // List applications where the given user or organization is a direct collaborator.+ // If no user or organization is given, this returns the applications the caller+ // has access to.+ // Similar to Get, this selects the fields given by the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc List(ListApplicationsRequest) returns (Applications) {+ option (google.api.http) = {+ get: "/applications"+ additional_bindings {get: "/users/{collaborator.user_ids.user_id}/applications"}+ additional_bindings {get: "/organizations/{collaborator.organization_ids.organization_id}/applications"}+ };+ }++ // Update the application, changing the fields specified by the field mask to the provided values.+ rpc Update(UpdateApplicationRequest) returns (Application) {+ option (google.api.http) = {+ put: "/applications/{application.ids.application_id}"+ body: "*"+ };+ }++ // Delete the application. This may not release the application ID for reuse.+ // All end devices must be deleted from the application before it can be deleted.+ rpc Delete(ApplicationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/applications/{application_id}"};+ }++ // Restore a recently deleted application.+ //+ // Deployment configuration may specify if, and for how long after deletion,+ // entities can be restored.+ rpc Restore(ApplicationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/applications/{application_id}/restore"};+ }++ // Purge the application. This will release the application ID for reuse.+ // All end devices must be deleted from the application before it can be deleted.+ // The application owner is responsible for clearing data from any (external) integrations+ // that may store and expose data by application ID+ rpc Purge(ApplicationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/applications/{application_id}/purge"};+ }++ // Request DevEUI from the configured address block for a device inside the application.+ // The maximum number of DevEUI's issued per application can be configured.+ rpc IssueDevEUI(ApplicationIdentifiers) returns (IssueDevEUIResponse) {+ option (google.api.http) = {post: "/applications/{application_id}/dev-eui"};+ }+}++// The ApplicationAccess service, exposed by the Identity Server, is used to manage+// API keys and collaborators of applications.+service ApplicationAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage access to applications."};+ // List the rights the caller has on this application.+ rpc ListRights(ApplicationIdentifiers) returns (Rights) {+ option (google.api.http) = {get: "/applications/{application_id}/rights"};+ }++ // Create an API key scoped to this application.+ rpc CreateAPIKey(CreateApplicationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ post: "/applications/{application_ids.application_id}/api-keys"+ body: "*"+ };+ }++ // List the API keys for this application.+ rpc ListAPIKeys(ListApplicationAPIKeysRequest) returns (APIKeys) {+ option (google.api.http) = {get: "/applications/{application_ids.application_id}/api-keys"};+ }++ // Get a single API key of this application.+ rpc GetAPIKey(GetApplicationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {get: "/applications/{application_ids.application_id}/api-keys/{key_id}"};+ }++ // Update the rights of an API key of the application.+ // This method can also be used to delete the API key, by giving it no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc UpdateAPIKey(UpdateApplicationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ put: "/applications/{application_ids.application_id}/api-keys/{api_key.id}"+ body: "*"+ };+ }++ // Delete a single API key of this application.+ rpc DeleteAPIKey(DeleteApplicationAPIKeyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/applications/{application_ids.application_id}/api-keys/{key_id}"};+ }++ // Get the rights of a collaborator (member) of the application.+ // Pseudo-rights in the response (such as the "_ALL" right) are not expanded.+ rpc GetCollaborator(GetApplicationCollaboratorRequest) returns (GetCollaboratorResponse) {+ option (google.api.http) = {+ additional_bindings {get: "/applications/{application_ids.application_id}/collaborator/user/{collaborator.user_ids.user_id}"}+ additional_bindings {get: "/applications/{application_ids.application_id}/collaborator/organization/{collaborator.organization_ids.organization_id}"}+ };+ }++ // Set the rights of a collaborator (member) on the application.+ // This method can also be used to delete the collaborator, by giving them no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc SetCollaborator(SetApplicationCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/applications/{application_ids.application_id}/collaborators"+ body: "*"+ };+ }++ // List the collaborators on this application.+ rpc ListCollaborators(ListApplicationCollaboratorsRequest) returns (Collaborators) {+ option (google.api.http) = {get: "/applications/{application_ids.application_id}/collaborators"};+ }++ // DeleteCollaborator removes a collaborator from an application.+ rpc DeleteCollaborator(DeleteApplicationCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ additional_bindings {delete: "/applications/{application_ids.application_id}/collaborator/user/{collaborator_ids.user_ids.user_id}"}+ additional_bindings {delete: "/applications/{application_ids.application_id}/collaborator/organization/{collaborator_ids.organization_ids.organization_id}"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver.protonew file mode 100644index 000000000..83af3198f--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver.proto@@ -0,0 +1,295 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/messages.proto";+import "ttn/lorawan/v3/mqtt.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ApplicationLink {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ reserved 1; // Deprecated: network_server_address+ reserved 2; // Deprecated: api_key+ // Default message payload formatters to use when there are no formatters+ // defined on the end device level.+ MessagePayloadFormatters default_formatters = 3;+ reserved 4; // Deprecated: tls+ // Skip decryption of uplink payloads and encryption of downlink payloads.+ // Leave empty for the using the Application Server's default setting.+ google.protobuf.BoolValue skip_payload_crypto = 5;+}++message GetApplicationLinkRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message SetApplicationLinkRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ ApplicationLink link = 2 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 3;+}++// Link stats as monitored by the Application Server.+message ApplicationLinkStats {+ google.protobuf.Timestamp linked_at = 1;+ string network_server_address = 2 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ // Timestamp when the last upstream message has been received from a Network Server.+ // This can be a join-accept, uplink message or downlink message event.+ google.protobuf.Timestamp last_up_received_at = 3;+ // Number of upstream messages received.+ uint64 up_count = 4;+ // Timestamp when the last downlink message has been forwarded to a Network Server.+ google.protobuf.Timestamp last_downlink_forwarded_at = 5;+ // Number of downlink messages forwarded.+ uint64 downlink_count = 6;+}++// Application Server configuration.+message AsConfiguration {+ message PubSub {+ message Providers {+ enum Status {+ option (thethings.json.enum) = {marshal_as_string: true};++ // No restrictions are in place.+ ENABLED = 0;+ // Warnings are being emitted that the provider will be deprecated in the future.+ WARNING = 1;+ // New integrations cannot be set up, and old ones do not start.+ DISABLED = 2;+ }++ Status mqtt = 1;+ Status nats = 2;+ reserved 3; // Deprecated: aws_iot+ }++ Providers providers = 1;+ }+ PubSub pubsub = 1;++ message Webhooks {+ int64 unhealthy_attempts_threshold = 1;+ google.protobuf.Duration unhealthy_retry_interval = 2;++ reserved 3;+ reserved "queue";+ }+ Webhooks webhooks = 2;+}++message GetAsConfigurationRequest {}++message GetAsConfigurationResponse {+ AsConfiguration configuration = 1;+}++// The As service manages the Application Server.+service As {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage an Application Server."};+ // Get a link configuration from the Application Server to Network Server.+ // This only contains the configuration. Use GetLinkStats to view statistics and any link errors.+ rpc GetLink(GetApplicationLinkRequest) returns (ApplicationLink) {+ option (google.api.http) = {get: "/as/applications/{application_ids.application_id}/link"};+ }++ // Set a link configuration from the Application Server a Network Server.+ // This call returns immediately after setting the link configuration; it does not wait for a link to establish.+ // To get link statistics or errors, use GetLinkStats.+ // Note that there can only be one Application Server instance linked to a Network Server for a given application at a time.+ rpc SetLink(SetApplicationLinkRequest) returns (ApplicationLink) {+ option (google.api.http) = {+ put: "/as/applications/{application_ids.application_id}/link",+ body: "*"+ };+ }++ // Delete the link between the Application Server and Network Server for the specified application.+ rpc DeleteLink(ApplicationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/applications/{application_id}/link"};+ }++ // GetLinkStats returns the link statistics.+ // This call returns a NotFound error code if there is no link for the given application identifiers.+ // This call returns the error code of the link error if linking to a Network Server failed.+ rpc GetLinkStats(ApplicationIdentifiers) returns (ApplicationLinkStats) {+ option (google.api.http) = {get: "/as/applications/{application_id}/link/stats"};+ }++ rpc GetConfiguration(GetAsConfigurationRequest) returns (GetAsConfigurationResponse) {+ option (google.api.http) = {get: "/as/configuration"};+ }+}++// Container for multiple Application uplink messages.+message NsAsHandleUplinkRequest {+ repeated ApplicationUp application_ups = 1 [(validate.rules).repeated.min_items = 1];+}++// The NsAs service connects a Network Server to an Application Server.+service NsAs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The NsAs service is used by The Things Stack Network Servers to interact with The Things Stack Application Servers. This is an inter-component service and is not meant for end users."};+ // Handle Application uplink messages.+ rpc HandleUplink(NsAsHandleUplinkRequest) returns (google.protobuf.Empty);+}++message EncodeDownlinkRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ EndDeviceVersionIdentifiers version_ids = 2;+ ApplicationDownlink downlink = 3 [(validate.rules).message.required = true];+ PayloadFormatter formatter = 4 [(validate.rules).enum.defined_only = true];+ string parameter = 5;+}++message EncodeDownlinkResponse {+ ApplicationDownlink downlink = 1;+}++message DecodeUplinkRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ EndDeviceVersionIdentifiers version_ids = 2;+ ApplicationUplink uplink = 3 [(validate.rules).message.required = true];+ PayloadFormatter formatter = 4 [(validate.rules).enum.defined_only = true];+ string parameter = 5;+}++message DecodeUplinkResponse {+ ApplicationUplink uplink = 1;+}++message DecodeDownlinkRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ EndDeviceVersionIdentifiers version_ids = 2;+ ApplicationDownlink downlink = 3 [(validate.rules).message.required = true];+ PayloadFormatter formatter = 4 [(validate.rules).enum.defined_only = true];+ string parameter = 5;+}++message DecodeDownlinkResponse {+ ApplicationDownlink downlink = 1;+}++// The AppAs service connects an application or integration to an Application Server.+service AppAs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Connect and manage applications or integrations to an Application Server."};+ // Subscribe to upstream messages.+ rpc Subscribe(ApplicationIdentifiers) returns (stream ApplicationUp);+ // Push downlink messages to the end of the downlink queue.+ rpc DownlinkQueuePush(DownlinkQueueRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/push",+ body: "*"+ };+ }+ // Replace the entire downlink queue with the specified messages.+ // This can also be used to empty the queue by specifying no messages.+ rpc DownlinkQueueReplace(DownlinkQueueRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/replace",+ body: "*"+ };+ }+ // List the items currently in the downlink queue.+ rpc DownlinkQueueList(EndDeviceIdentifiers) returns (ApplicationDownlinks) {+ option (google.api.http) = {get: "/as/applications/{application_ids.application_id}/devices/{device_id}/down"};+ }+ // Get connection information to connect an MQTT client.+ rpc GetMQTTConnectionInfo(ApplicationIdentifiers) returns (MQTTConnectionInfo) {+ option (google.api.http) = {get: "/as/applications/{application_id}/mqtt-connection-info"};+ }+ // Simulate an upstream message. This can be used to test integrations.+ rpc SimulateUplink(ApplicationUp) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/up/simulate",+ body: "*"+ };+ }+ rpc EncodeDownlink(EncodeDownlinkRequest) returns (EncodeDownlinkResponse) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/encode",+ body: "*"+ };+ }+ rpc DecodeUplink(DecodeUplinkRequest) returns (DecodeUplinkResponse) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/up/decode",+ body: "*"+ };+ }+ rpc DecodeDownlink(DecodeDownlinkRequest) returns (DecodeDownlinkResponse) {+ option (google.api.http) = {+ post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/decode",+ body: "*"+ };+ }+}++// The AsEndDeviceRegistry service allows clients to manage their end devices on the Application Server.+service AsEndDeviceRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage end devices on the Application Server."};+ // Get returns the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Get(GetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {get: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"};+ }++ // Set creates or updates the device.+ rpc Set(SetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ put: "/as/applications/{end_device.ids.application_ids.application_id}/devices/{end_device.ids.device_id}"+ body: "*"+ additional_bindings {+ post: "/as/applications/{end_device.ids.application_ids.application_id}/devices"+ body: "*"+ };+ };+ }++ // Delete deletes the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Delete(EndDeviceIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/applications/{application_ids.application_id}/devices/{device_id}"};+ }+}++// The AsEndDeviceBatchRegistry service allows clients to manage batches end devices on the Application Server.+service AsEndDeviceBatchRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage batches of end devices on the Application Server."};+ // Delete a list of devices within the same application.+ // This operation is atomic; either all devices are deleted or none.+ // Devices not found are skipped and no error is returned.+ rpc Delete(BatchDeleteEndDevicesRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/applications/{application_ids.application_id}/devices/batch"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_alcsync.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_alcsync.protonew file mode 100644index 000000000..543ca6c3f--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_alcsync.proto@@ -0,0 +1,55 @@+// Copyright © 2023 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/timestamp.proto";+import "thethings/json/annotations.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++enum ALCSyncCommandIdentifier {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "ALCSYNC_CID"+ };++ ALCSYNC_CID_PKG_VERSION = 0;+ ALCSYNC_CID_APP_TIME = 1;+ ALCSYNC_CID_APP_DEV_TIME_PERIODICITY = 2;+ ALCSYNC_CID_FORCE_DEV_RESYNC = 3;+}++message ALCSyncCommand {+ ALCSyncCommandIdentifier cid = 1 [(validate.rules).enum = {defined_only: true}];++ oneof payload {+ AppTimeReq app_time_req = 2;+ AppTimeAns app_time_ans = 3;+ }++ message AppTimeReq {+ google.protobuf.Timestamp DeviceTime = 1 [(validate.rules).timestamp.required = true];+ uint32 TokenReq = 2 [(validate.rules).uint32.lte = 255];+ bool AnsRequired = 3;+ }++ message AppTimeAns {+ int32 TimeCorrection = 1;+ uint32 TokenAns = 2 [(validate.rules).uint32.lte = 255];+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_storage.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_storage.protonew file mode 100644index 000000000..188f57288--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_integrations_storage.proto@@ -0,0 +1,151 @@+// Copyright © 2020 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/messages.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ContinuationTokenPayload {+ google.protobuf.UInt32Value limit = 1;+ google.protobuf.Timestamp after = 2;+ google.protobuf.Timestamp before = 3;+ google.protobuf.UInt32Value f_port = 4;+ string order = 5;+ google.protobuf.FieldMask field_mask = 6;+ google.protobuf.Duration last = 7;+ int64 last_received_id = 8;+}++message GetStoredApplicationUpRequest {+ // Query upstream messages from all end devices of an application. Cannot be used in conjunction with end_device_ids.+ ApplicationIdentifiers application_ids = 1;+ // Query upstream messages from a single end device. Cannot be used in conjunction with application_ids.+ EndDeviceIdentifiers end_device_ids = 2;++ // Query upstream messages of a specific type. If not set, then all upstream messages are returned.+ string type = 3 [(validate.rules).string = {+ in: [+ "",+ "uplink_message",+ "uplink_normalized",+ "join_accept",+ "downlink_ack",+ "downlink_nack",+ "downlink_sent",+ "downlink_failed",+ "downlink_queued",+ "downlink_queue_invalidated",+ "location_solved",+ "service_data"+ ]+ }];++ // Limit number of results.+ google.protobuf.UInt32Value limit = 4;+ // Query upstream messages after this timestamp only. Cannot be used in conjunction with last.+ google.protobuf.Timestamp after = 5;+ // Query upstream messages before this timestamp only. Cannot be used in conjunction with last.+ google.protobuf.Timestamp before = 6;+ // Query uplinks on a specific FPort only.+ google.protobuf.UInt32Value f_port = 7;++ // Order results.+ string order = 8 [(validate.rules).string = {+ in: [+ "",+ "-received_at",+ "received_at"+ ]+ }];++ // The names of the upstream message fields that should be returned. See the API reference+ // for allowed field names for each type of upstream message.+ google.protobuf.FieldMask field_mask = 9;++ // Query upstream messages that have arrived in the last minutes or hours. Cannot be used in conjunction with after and before.+ google.protobuf.Duration last = 10 [deprecated = true];++ // The continuation token, which is used to retrieve the next page. If provided, other fields are ignored.+ string continuation_token = 11 [(validate.rules).string.max_len = 16000];+}++message GetStoredApplicationUpCountRequest {+ // Count upstream messages from all end devices of an application. Cannot be used in conjunction with end_device_ids.+ ApplicationIdentifiers application_ids = 1;+ // Count upstream messages from a single end device. Cannot be used in conjunction with application_ids.+ EndDeviceIdentifiers end_device_ids = 2;++ // Count upstream messages of a specific type. If not set, then all upstream messages are returned.+ string type = 3 [(validate.rules).string = {+ in: [+ "",+ "uplink_message",+ "join_accept",+ "downlink_ack",+ "downlink_nack",+ "downlink_sent",+ "downlink_failed",+ "downlink_queued",+ "downlink_queue_invalidated",+ "location_solved",+ "service_data"+ ]+ }];++ // Count upstream messages after this timestamp only. Cannot be used in conjunction with last.+ google.protobuf.Timestamp after = 4;+ // Count upstream messages before this timestamp only. Cannot be used in conjunction with last.+ google.protobuf.Timestamp before = 5;+ // Count uplinks on a specific FPort only.+ google.protobuf.UInt32Value f_port = 6;++ // Count upstream messages that have arrived in the last minutes or hours. Cannot be used in conjunction with after and before.+ google.protobuf.Duration last = 7;+}++message GetStoredApplicationUpCountResponse {+ // Number of stored messages by end device ID.+ map<string, uint32> count = 1;+}++// The ApplicationUpStorage service can be used to query stored application upstream messages.+service ApplicationUpStorage {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Query application upstream messages from the storage integration."};+ // Returns a stream of application messages that have been stored in the database.+ rpc GetStoredApplicationUp(GetStoredApplicationUpRequest) returns (stream ApplicationUp) {+ option (google.api.http) = {+ get: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/packages/storage/{type}"+ additional_bindings {get: "/as/applications/{application_ids.application_id}/packages/storage/{type}"}+ };+ }+ // Returns how many application messages have been stored in the database for an application or end device.+ rpc GetStoredApplicationUpCount(GetStoredApplicationUpCountRequest) returns (GetStoredApplicationUpCountResponse) {+ option (google.api.http) = {+ get: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/packages/storage/{type}/count"+ additional_bindings {get: "/as/applications/{application_ids.application_id}/packages/storage/{type}/count"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_packages.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_packages.protonew file mode 100644index 000000000..62f23b89c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_packages.proto@@ -0,0 +1,224 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ApplicationPackage {+ string name = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ uint32 default_f_port = 2 [(validate.rules).uint32 = {+ gte: 1,+ lte: 255+ }];+}++message ApplicationPackages {+ repeated ApplicationPackage packages = 1;+}++message ApplicationPackageAssociationIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ uint32 f_port = 2 [(validate.rules).uint32 = {+ gte: 1,+ lte: 255+ }];+}++message ApplicationPackageAssociation {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationPackageAssociationIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ string package_name = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ google.protobuf.Struct data = 5;+}++message ApplicationPackageAssociations {+ repeated ApplicationPackageAssociation associations = 1;+}++message GetApplicationPackageAssociationRequest {+ ApplicationPackageAssociationIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationPackageAssociationRequest {+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ // Each page is ordered by the FPort.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ google.protobuf.FieldMask field_mask = 4;+}++message SetApplicationPackageAssociationRequest {+ ApplicationPackageAssociation association = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ApplicationPackageDefaultAssociationIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ uint32 f_port = 2 [(validate.rules).uint32 = {+ gte: 1,+ lte: 255+ }];+}++message ApplicationPackageDefaultAssociation {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationPackageDefaultAssociationIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ string package_name = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ google.protobuf.Struct data = 5;+}++message ApplicationPackageDefaultAssociations {+ repeated ApplicationPackageDefaultAssociation defaults = 1;+}++message GetApplicationPackageDefaultAssociationRequest {+ ApplicationPackageDefaultAssociationIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationPackageDefaultAssociationRequest {+ ApplicationIdentifiers ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ // Each page is ordered by the FPort.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ google.protobuf.FieldMask field_mask = 4;+}++message SetApplicationPackageDefaultAssociationRequest {+ ApplicationPackageDefaultAssociation default = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++service ApplicationPackageRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage application packages and their associations."};+ // List returns the available packages for the end device.+ rpc List(EndDeviceIdentifiers) returns (ApplicationPackages) {+ option (google.api.http) = {get: "/as/applications/{application_ids.application_id}/devices/{device_id}/packages"};+ }++ // GetAssociation returns the association registered on the FPort of the end device.+ rpc GetAssociation(GetApplicationPackageAssociationRequest) returns (ApplicationPackageAssociation) {+ option (google.api.http) = {get: "/as/applications/{ids.end_device_ids.application_ids.application_id}/devices/{ids.end_device_ids.device_id}/packages/associations/{ids.f_port}"};+ }++ // ListAssociations returns all of the associations of the end device.+ rpc ListAssociations(ListApplicationPackageAssociationRequest) returns (ApplicationPackageAssociations) {+ option (google.api.http) = {get: "/as/applications/{ids.application_ids.application_id}/devices/{ids.device_id}/packages/associations"};+ }++ // SetAssociation updates or creates the association on the FPort of the end device.+ rpc SetAssociation(SetApplicationPackageAssociationRequest) returns (ApplicationPackageAssociation) {+ option (google.api.http) = {+ put: "/as/applications/{association.ids.end_device_ids.application_ids.application_id}/devices/{association.ids.end_device_ids.device_id}/packages/associations/{association.ids.f_port}"+ body: "*"+ };+ }++ // DeleteAssociation removes the association on the FPort of the end device.+ rpc DeleteAssociation(ApplicationPackageAssociationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/packages/associations/{f_port}"};+ }++ // GetDefaultAssociation returns the default association registered on the FPort of the application.+ rpc GetDefaultAssociation(GetApplicationPackageDefaultAssociationRequest) returns (ApplicationPackageDefaultAssociation) {+ option (google.api.http) = {get: "/as/applications/{ids.application_ids.application_id}/packages/associations/{ids.f_port}"};+ }++ // ListDefaultAssociations returns all of the default associations of the application.+ rpc ListDefaultAssociations(ListApplicationPackageDefaultAssociationRequest) returns (ApplicationPackageDefaultAssociations) {+ option (google.api.http) = {get: "/as/applications/{ids.application_id}/packages/associations"};+ }++ // SetDefaultAssociation updates or creates the default association on the FPort of the application.+ rpc SetDefaultAssociation(SetApplicationPackageDefaultAssociationRequest) returns (ApplicationPackageDefaultAssociation) {+ option (google.api.http) = {+ put: "/as/applications/{default.ids.application_ids.application_id}/packages/associations/{default.ids.f_port}"+ body: "*"+ };+ }++ // DeleteDefaultAssociation removes the default association on the FPort of the application.+ rpc DeleteDefaultAssociation(ApplicationPackageDefaultAssociationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/applications/{application_ids.application_id}/packages/associations/{f_port}"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_pubsub.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_pubsub.protonew file mode 100644index 000000000..45e43cd27--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_pubsub.proto@@ -0,0 +1,320 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ApplicationPubSubIdentifiers {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ string pub_sub_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message ApplicationPubSub {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationPubSubIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];++ // The format to use for the body.+ // Supported values depend on the Application Server configuration.+ string format = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 20+ }];++ // The NATS provider settings.+ message NATSProvider {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The server connection URL.+ string server_url = 1 [(validate.rules).string.uri = true];+ }+ // The MQTT provider settings.+ message MQTTProvider {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string server_url = 1 [(validate.rules).string.uri = true];+ string client_id = 2 [(validate.rules).string.max_len = 23];+ string username = 3 [(validate.rules).string.max_len = 100];+ string password = 4 [(validate.rules).string.max_len = 100];++ enum QoS {+ option (thethings.json.enum) = {marshal_as_string: true};++ AT_MOST_ONCE = 0;+ AT_LEAST_ONCE = 1;+ EXACTLY_ONCE = 2;+ }+ QoS subscribe_qos = 5;+ QoS publish_qos = 6;++ bool use_tls = 7;+ // The server Root CA certificate. PEM formatted.+ bytes tls_ca = 8 [+ (validate.rules).bytes.max_len = 8192,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];+ // The client certificate. PEM formatted.+ bytes tls_client_cert = 9 [+ (validate.rules).bytes.max_len = 8192,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];+ // The client private key. PEM formatted.+ bytes tls_client_key = 10 [+ (validate.rules).bytes.max_len = 8192,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];++ // HTTP headers to use on MQTT-over-Websocket connections.+ map<string, string> headers = 11;+ }++ message AWSIoTProvider {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The AWS region.+ string region = 1 [(validate.rules).string = {+ in: [+ "af-south-1",+ "ap-east-1",+ "ap-northeast-1",+ "ap-northeast-2",+ "ap-south-1",+ "ap-southeast-1",+ "ap-southeast-2",+ "ca-central-1",+ "eu-central-1",+ "eu-north-1",+ "eu-south-1",+ "eu-west-1",+ "eu-west-2",+ "eu-west-3",+ "me-south-1",+ "sa-east-1",+ "us-east-1",+ "us-east-2",+ "us-west-1",+ "us-west-2"+ ]+ }];++ message AccessKey {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string access_key_id = 1 [(validate.rules).string = {+ pattern: "^[\\w]*$",+ min_len: 16,+ max_len: 128+ }];+ string secret_access_key = 2 [(validate.rules).string.max_len = 40];+ string session_token = 3 [(validate.rules).string.max_len = 256];+ }++ // If set, the integration will use an AWS access key.+ AccessKey access_key = 2;++ message AssumeRole {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string arn = 1 [(validate.rules).string = {pattern: "^arn:aws:iam::[0-9]{12}:role\\/[A-Za-z0-9_+=,.@-]+$"}];+ string external_id = 2 [(validate.rules).string = {+ pattern: "^[\\w+=,.@:\\/-]*$",+ max_len: 1224+ }];+ google.protobuf.Duration session_duration = 3;+ }++ // If set, the integration will assume the given role during operation.+ AssumeRole assume_role = 3;++ // The endpoint address to connect to. If the endpoint address is left empty,+ // the integration will try to discover it.+ string endpoint_address = 4 [(validate.rules).string = {+ pattern: "^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])|)$",+ max_len: 128+ }];++ message DefaultIntegration {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The stack name that is associated with the CloudFormation deployment of The Things Stack Enterprise integration.+ string stack_name = 1 [(validate.rules).string = {+ pattern: "^[A-Za-z][A-Za-z0-9\\-]*$",+ max_len: 128+ }];+ }++ oneof deployment {+ // Enable the default integration. This overrides custom base topic and message topics of the pub/sub integration.+ DefaultIntegration default = 5;+ }+ }++ // The provider for the PubSub.+ oneof provider {+ option (validate.required) = true;++ NATSProvider nats = 17;+ MQTTProvider mqtt = 25;+ AWSIoTProvider aws_iot = 101;+ }++ // Base topic name to which the messages topic is appended.+ string base_topic = 6 [(validate.rules).string.max_len = 100];++ message Message {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The topic on which the Application Server publishes or receives the messages.+ string topic = 1 [(validate.rules).string.max_len = 100];+ }++ // The topic to which the Application Server subscribes for downlink queue push operations.+ Message downlink_push = 7;+ // The topic to which the Application Server subscribes for downlink queue replace operations.+ Message downlink_replace = 8;++ Message uplink_message = 9;+ Message uplink_normalized = 20;+ Message join_accept = 10;+ Message downlink_ack = 11;+ Message downlink_nack = 12;+ Message downlink_sent = 13;+ Message downlink_failed = 14;+ Message downlink_queued = 15;+ Message downlink_queue_invalidated = 19;+ Message location_solved = 16;+ Message service_data = 18;++ // next: 21+}++message ApplicationPubSubs {+ repeated ApplicationPubSub pubsubs = 1;+}++message ApplicationPubSubFormats {+ // Format and description.+ map<string, string> formats = 1;+}++message GetApplicationPubSubRequest {+ ApplicationPubSubIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationPubSubsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ uint32 page = 4;+}++message SetApplicationPubSubRequest {+ ApplicationPubSub pubsub = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++service ApplicationPubSubRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage application pubsubs."};+ rpc GetFormats(google.protobuf.Empty) returns (ApplicationPubSubFormats) {+ option (google.api.http) = {get: "/as/pubsub-formats"};+ }++ rpc Get(GetApplicationPubSubRequest) returns (ApplicationPubSub) {+ option (google.api.http) = {get: "/as/pubsub/{ids.application_ids.application_id}/{ids.pub_sub_id}"};+ }++ rpc List(ListApplicationPubSubsRequest) returns (ApplicationPubSubs) {+ option (google.api.http) = {get: "/as/pubsub/{application_ids.application_id}"};+ }++ rpc Set(SetApplicationPubSubRequest) returns (ApplicationPubSub) {+ option (google.api.http) = {+ put: "/as/pubsub/{pubsub.ids.application_ids.application_id}/{pubsub.ids.pub_sub_id}"+ body: "*"+ additional_bindings {+ post: "/as/pubsub/{pubsub.ids.application_ids.application_id}"+ body: "*"+ }+ };+ }++ rpc Delete(ApplicationPubSubIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/pubsub/{application_ids.application_id}/{pub_sub_id}"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_web.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_web.protonew file mode 100644index 000000000..ad11eea4f--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/applicationserver_web.proto@@ -0,0 +1,307 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/error.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ApplicationWebhookIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ string webhook_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message ApplicationWebhookTemplateIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string template_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++// ApplicationWebhookTemplateField represents a custom field that needs to be filled by the user in order to use the template.+// A field can be an API key, an username or password, or any custom platform specific field (such as region).+// The fields are meant to be replaced inside the URLs and headers when the webhook is created.+message ApplicationWebhookTemplateField {+ string id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ string name = 2 [(validate.rules).string.max_len = 20];+ string description = 3 [(validate.rules).string.max_len = 100];+ // Secret decides if the field should be shown in plain-text or should stay hidden.+ bool secret = 4;+ string default_value = 5 [(validate.rules).string.max_len = 100];+ bool optional = 6;+}++message ApplicationWebhookTemplate {+ ApplicationWebhookTemplateIdentifiers ids = 1 [(validate.rules).message.required = true];++ string name = 2 [(validate.rules).string.max_len = 20];+ string description = 3 [(validate.rules).string.max_len = 100];+ string logo_url = 4 [(validate.rules).string.uri = true];+ string info_url = 5 [(validate.rules).string.uri = true];+ string documentation_url = 6 [(validate.rules).string.uri = true];++ // The base URL of the template. Can contain template fields, in RFC 6570 format.+ string base_url = 7 [(validate.rules).string.uri = true];++ // The HTTP headers used by the template. Both the key and the value can contain template fields.+ map<string, string> headers = 8 [(validate.rules).map = {+ max_pairs: 50,+ keys: {+ string: {max_len: 64}+ },+ values: {+ string: {max_len: 256}+ }+ }];++ string format = 9 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 20+ }];++ repeated ApplicationWebhookTemplateField fields = 10;++ // Control the creation of the downlink queue operations API key.+ bool create_downlink_api_key = 19;++ message Message {+ // Path to append to the base URL. Can contain template fields, in RFC 6570 format.+ string path = 1 [(validate.rules).string.max_len = 64];+ }+ Message uplink_message = 11;+ Message uplink_normalized = 23;+ Message join_accept = 12;+ Message downlink_ack = 13;+ Message downlink_nack = 14;+ Message downlink_sent = 15;+ Message downlink_failed = 16;+ Message downlink_queued = 17;+ Message downlink_queue_invalidated = 21;+ Message location_solved = 18;+ Message service_data = 20;++ google.protobuf.FieldMask field_mask = 22;++ // next: 24+}++message ApplicationWebhookTemplates {+ repeated ApplicationWebhookTemplate templates = 1;+}++message ApplicationWebhookHealth {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ message WebhookHealthStatusHealthy {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ }+ message WebhookHealthStatusUnhealthy {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ uint64 failed_attempts = 1;+ google.protobuf.Timestamp last_failed_attempt_at = 2 [(validate.rules).timestamp.required = true];+ ErrorDetails last_failed_attempt_details = 3;+ }+ oneof status {+ WebhookHealthStatusHealthy healthy = 1;+ WebhookHealthStatusUnhealthy unhealthy = 2;+ }+}++message ApplicationWebhook {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationWebhookIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];++ // Base URL to which the message's path is appended.+ string base_url = 4 [(validate.rules).string.uri = true];+ // HTTP headers to use.+ map<string, string> headers = 5 [(validate.rules).map = {+ max_pairs: 50,+ keys: {+ string: {max_len: 64}+ },+ values: {+ string: {max_len: 4096}+ }+ }];+ // The format to use for the body.+ // Supported values depend on the Application Server configuration.+ string format = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 20+ }];++ // The ID of the template that was used to create the Webhook.+ ApplicationWebhookTemplateIdentifiers template_ids = 15;+ // The value of the fields used by the template. Maps field.id to the value.+ map<string, string> template_fields = 16;++ // The API key to be used for downlink queue operations.+ // The field is provided for convenience reasons, and can contain API keys with additional rights (albeit this is discouraged).+ string downlink_api_key = 17 [(validate.rules).string.max_len = 128];++ message Message {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Path to append to the base URL.+ string path = 1 [(validate.rules).string.max_len = 64];+ }+ Message uplink_message = 7;+ Message uplink_normalized = 22;+ Message join_accept = 8;+ Message downlink_ack = 9;+ Message downlink_nack = 10;+ Message downlink_sent = 11;+ Message downlink_failed = 12;+ Message downlink_queued = 13;+ Message downlink_queue_invalidated = 19;+ Message location_solved = 14;+ Message service_data = 18;++ ApplicationWebhookHealth health_status = 20;++ google.protobuf.FieldMask field_mask = 21;++ reserved 23;+ reserved "queue";++ // Set to temporarily pause forwarding uplink data to this end point and receiving downlinks from this end point.+ bool paused = 24;++ // next: 25+}++message ApplicationWebhooks {+ repeated ApplicationWebhook webhooks = 1;+}++message ApplicationWebhookFormats {+ // Format and description.+ map<string, string> formats = 1;+}++message GetApplicationWebhookRequest {+ ApplicationWebhookIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationWebhooksRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ uint32 page = 4;+}++message SetApplicationWebhookRequest {+ ApplicationWebhook webhook = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message GetApplicationWebhookTemplateRequest {+ ApplicationWebhookTemplateIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message ListApplicationWebhookTemplatesRequest {+ google.protobuf.FieldMask field_mask = 1;+}++service ApplicationWebhookRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage application webhooks."};+ rpc GetFormats(google.protobuf.Empty) returns (ApplicationWebhookFormats) {+ option (google.api.http) = {get: "/as/webhook-formats"};+ }++ rpc GetTemplate(GetApplicationWebhookTemplateRequest) returns (ApplicationWebhookTemplate) {+ option (google.api.http) = {get: "/as/webhook-templates/{ids.template_id}"};+ }++ rpc ListTemplates(ListApplicationWebhookTemplatesRequest) returns (ApplicationWebhookTemplates) {+ option (google.api.http) = {get: "/as/webhook-templates"};+ }++ rpc Get(GetApplicationWebhookRequest) returns (ApplicationWebhook) {+ option (google.api.http) = {get: "/as/webhooks/{ids.application_ids.application_id}/{ids.webhook_id}"};+ }++ rpc List(ListApplicationWebhooksRequest) returns (ApplicationWebhooks) {+ option (google.api.http) = {get: "/as/webhooks/{application_ids.application_id}"};+ }++ rpc Set(SetApplicationWebhookRequest) returns (ApplicationWebhook) {+ option (google.api.http) = {+ put: "/as/webhooks/{webhook.ids.application_ids.application_id}/{webhook.ids.webhook_id}"+ body: "*"+ additional_bindings {+ post: "/as/webhooks/{webhook.ids.application_ids.application_id}"+ body: "*"+ }+ };+ }++ rpc Delete(ApplicationWebhookIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/as/webhooks/{application_ids.application_id}/{webhook_id}"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/client.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/client.protonew file mode 100644index 000000000..cdd80ea9b--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/client.proto@@ -0,0 +1,247 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The OAuth2 flows an OAuth client can use to get an access token.+enum GrantType {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "GRANT"+ };++ // Grant type used to exchange an authorization code for an access token.+ GRANT_AUTHORIZATION_CODE = 0;+ // Grant type used to exchange a user ID and password for an access token.+ GRANT_PASSWORD = 1;+ // Grant type used to exchange a refresh token for an access token.+ GRANT_REFRESH_TOKEN = 2;+}++// An OAuth client on the network.+message Client {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The identifiers of the OAuth client. These are public and can be seen by any authenticated user in the network.+ ClientIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // When the OAuth client was created. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the OAuth client was last updated. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the OAuth client was deleted. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp deleted_at = 16 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // The name of the OAuth client. This information is public and can be seen by any authenticated user in the network.+ string name = 4 [(validate.rules).string.max_len = 50];+ // A description for the OAuth client. This information is public and can be seen by any authenticated user in the network.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this client. Typically used for organizing clients or for storing integration-specific data.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Contact information for this client. Typically used to indicate who to contact with technical/security questions about the application.+ // This information is public and can be seen by any authenticated user in the network.+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];++ OrganizationOrUserIdentifiers administrative_contact = 18;+ OrganizationOrUserIdentifiers technical_contact = 19;++ // The client secret is only visible to collaborators of the client.+ string secret = 8 [(validate.rules).string.max_len = 128];+ // The allowed redirect URIs against which authorization requests are checked.+ // If the authorization request does not pass a redirect URI, the first one+ // from this list is taken.+ // This information is public and can be seen by any authenticated user in the network.+ repeated string redirect_uris = 9 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 128}+ }+ }];+ // The allowed logout redirect URIs against which client initiated logout+ // requests are checked. If the authorization request does not pass a redirect+ // URI, the first one from this list is taken.+ // This information is public and can be seen by any authenticated user in the network.+ repeated string logout_redirect_uris = 15 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 128}+ }+ }];+ // The reviewing state of the client.+ // This information is public and can be seen by any authenticated user in the network.+ // This field can only be modified by admins.+ // If state_description is not updated when updating state, state_description is cleared.+ State state = 10 [(validate.rules).enum.defined_only = true];+ // A description for the state field.+ // This field can only be modified by admins, and should typically only be updated+ // when also updating `state`.+ string state_description = 17 [(validate.rules).string.max_len = 128];+ // If set, the authorization page will be skipped.+ // This information is public and can be seen by any authenticated user in the network.+ // This field can only be modified by admins.+ bool skip_authorization = 11;+ // If set, the authorization page will show endorsement.+ // This information is public and can be seen by any authenticated user in the network.+ // This field can only be modified by admins.+ bool endorsed = 12;+ // OAuth flows that can be used for the client to get a token.+ // This information is public and can be seen by any authenticated user in the network.+ // After a client is created, this field can only be modified by admins.+ repeated GrantType grants = 13 [(validate.rules).repeated.items.enum.defined_only = true];+ // Rights denotes what rights the client will have access to.+ // This information is public and can be seen by any authenticated user in the network.+ // Users that previously authorized this client will have to re-authorize the+ // client after rights are added to this list.+ repeated Right rights = 14 [(validate.rules).repeated.items.enum.defined_only = true];++ reserved 20;+ reserved "label_ids";++ // next: 21+}++message Clients {+ repeated Client clients = 1;+}++message GetClientRequest {+ ClientIdentifiers client_ids = 1 [(validate.rules).message.required = true];+ // The names of the client fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message ListClientsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // By default we list all OAuth clients the caller has rights on.+ // Set the user or the organization (not both) to instead list the OAuth clients+ // where the user or organization is collaborator on.+ OrganizationOrUserIdentifiers collaborator = 1 [(thethings.flags.field) = {hidden: true}];+ // The names of the client fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "client_id",+ "-client_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+ // Only return recently deleted clients.+ bool deleted = 6;+}++message CreateClientRequest {+ Client client = 1 [(validate.rules).message.required = true];+ // Collaborator to grant all rights on the newly created client.+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateClientRequest {+ Client client = 1 [(validate.rules).message.required = true];+ // The names of the client fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message ListClientCollaboratorsRequest {+ ClientIdentifiers client_ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "id",+ "-id",+ "-rights",+ "rights"+ ]+ }];+}++message GetClientCollaboratorRequest {+ ClientIdentifiers client_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message SetClientCollaboratorRequest {+ ClientIdentifiers client_ids = 1 [(validate.rules).message.required = true];+ Collaborator collaborator = 2 [(validate.rules).message.required = true];+}++message DeleteClientCollaboratorRequest {+ ClientIdentifiers client_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator_ids = 2 [(validate.rules).message.required = true];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/client_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/client_services.protonew file mode 100644index 000000000..9f0d6238c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/client_services.proto@@ -0,0 +1,132 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/client.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The ClientRegistry service, exposed by the Identity Server, is used to manage+// OAuth client registrations.+service ClientRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage OAuth client registrations."};+ // Create a new OAuth client. This also sets the given organization or user as+ // first collaborator with all possible rights.+ rpc Create(CreateClientRequest) returns (Client) {+ option (google.api.http) = {+ post: "/users/{collaborator.user_ids.user_id}/clients"+ body: "*"+ additional_bindings {+ post: "/organizations/{collaborator.organization_ids.organization_id}/clients"+ body: "*"+ }+ };+ }++ // Get the OAuth client with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc Get(GetClientRequest) returns (Client) {+ option (google.api.http) = {get: "/clients/{client_ids.client_id}"};+ }++ // List OAuth clients where the given user or organization is a direct collaborator.+ // If no user or organization is given, this returns the OAuth clients the caller+ // has access to.+ // Similar to Get, this selects the fields specified in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc List(ListClientsRequest) returns (Clients) {+ option (google.api.http) = {+ get: "/clients"+ additional_bindings {get: "/users/{collaborator.user_ids.user_id}/clients"}+ additional_bindings {get: "/organizations/{collaborator.organization_ids.organization_id}/clients"}+ };+ }++ // Update the OAuth client, changing the fields specified by the field mask to the provided values.+ rpc Update(UpdateClientRequest) returns (Client) {+ option (google.api.http) = {+ put: "/clients/{client.ids.client_id}"+ body: "*"+ };+ }++ // Delete the OAuth client. This may not release the client ID for reuse.+ rpc Delete(ClientIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/clients/{client_id}"};+ }++ // Restore a recently deleted client.+ //+ // Deployment configuration may specify if, and for how long after deletion,+ // entities can be restored.+ rpc Restore(ClientIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/clients/{client_id}/restore"};+ }++ // Purge the client. This will release the client ID for reuse.+ rpc Purge(ClientIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/clients/{client_id}/purge"};+ }+}++// The ClientAccess service, exposed by the Identity Server, is used to manage+// collaborators of OAuth clients.+service ClientAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage access to OAuth clients."};+ // List the rights the caller has on this application.+ rpc ListRights(ClientIdentifiers) returns (Rights) {+ option (google.api.http) = {get: "/clients/{client_id}/rights"};+ }++ // Get the rights of a collaborator (member) of the client.+ // Pseudo-rights in the response (such as the "_ALL" right) are not expanded.+ rpc GetCollaborator(GetClientCollaboratorRequest) returns (GetCollaboratorResponse) {+ option (google.api.http) = {+ additional_bindings {get: "/clients/{client_ids.client_id}/collaborator/user/{collaborator.user_ids.user_id}"}+ additional_bindings {get: "/clients/{client_ids.client_id}/collaborator/organization/{collaborator.organization_ids.organization_id}"}+ };+ }++ // Set the rights of a collaborator (member) on the OAuth client.+ // This method can also be used to delete the collaborator, by giving them no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc SetCollaborator(SetClientCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/clients/{client_ids.client_id}/collaborators"+ body: "*"+ };+ }++ // List the collaborators on this OAuth client.+ rpc ListCollaborators(ListClientCollaboratorsRequest) returns (Collaborators) {+ option (google.api.http) = {get: "/clients/{client_ids.client_id}/collaborators"};+ }++ // DeleteCollaborator removes a collaborator from a client.+ rpc DeleteCollaborator(DeleteClientCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ additional_bindings {delete: "/clients/{client_ids.client_id}/collaborators/user/{collaborator_ids.user_ids.user_id}"}+ additional_bindings {delete: "/clients/{client_ids.client_id}/collaborators/organization/{collaborator_ids.organization_ids.organization_id}"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/cluster.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/cluster.protonew file mode 100644index 000000000..7fc4907d5--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/cluster.proto@@ -0,0 +1,34 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "ttn/lorawan/v3/enums.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// PeerInfo+message PeerInfo {+ // Port on which the gRPC server is exposed.+ uint32 grpc_port = 1;+ // Indicates whether the gRPC server uses TLS.+ bool tls = 2;+ // Roles of the peer.+ repeated ClusterRole roles = 3;++ // Tags of the peer+ map<string, string> tags = 4;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/configuration_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/configuration_services.protonew file mode 100644index 000000000..a4d56befd--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/configuration_services.proto@@ -0,0 +1,205 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ListFrequencyPlansRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Optional base frequency in MHz for hardware support (433, 470, 868 or 915)+ uint32 base_frequency = 1;+ // Optional Band ID to filter the results.+ string band_id = 2;+ // Optional field to include only gateway related results.+ bool gateways_only = 3;+}++message FrequencyPlanDescription {+ string id = 1;+ // The ID of the frequency that the current frequency plan is based on.+ string base_id = 2;+ string name = 3;+ // Base frequency in MHz for hardware support (433, 470, 868 or 915)+ uint32 base_frequency = 4;+ string band_id = 5;+}++message ListFrequencyPlansResponse {+ repeated FrequencyPlanDescription frequency_plans = 1;+}++message GetPhyVersionsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Optional Band ID to filter the results.+ // If unused, all supported Bands and their versions are returned.+ string band_id = 1;+}++message GetPhyVersionsResponse {+ message VersionInfo {+ string band_id = 1;+ repeated PHYVersion phy_versions = 2;+ }+ repeated VersionInfo version_info = 2;+}++message ListBandsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Optional Band ID to filter the results.+ // If unused, all supported Bands are returned.+ string band_id = 1;+ // Optional PHY version to filter the results.+ // If unused, all supported versions are returned.+ PHYVersion phy_version = 2 [(validate.rules).enum.defined_only = true];+}++message BandDescription {+ string id = 1;++ message Beacon {+ DataRateIndex data_rate_index = 1;+ string coding_rate = 2;+ reserved 3; // inverted_polarity+ reserved 4; // compute_frequency+ repeated uint64 frequencies = 5;+ }++ Beacon beacon = 2;+ reserved 3; // ping_slot_frequency+ repeated uint64 ping_slot_frequencies = 32;++ uint32 max_uplink_channels = 4;++ message Channel {+ uint64 frequency = 1;+ DataRateIndex min_data_rate = 2;+ DataRateIndex max_data_rate = 3;+ }++ repeated Channel uplink_channels = 5;+ uint32 max_downlink_channels = 6;+ repeated Channel downlink_channels = 7;++ message SubBandParameters {+ uint64 min_frequency = 1;+ uint64 max_frequency = 2;+ float duty_cycle = 3;+ float max_eirp = 4;+ }++ repeated SubBandParameters sub_bands = 8;++ message BandDataRate {+ DataRate rate = 1;+ reserved 2; // max_mac_payload_size+ }++ map<uint32, BandDataRate> data_rates = 9;++ uint64 freq_multiplier = 10;+ bool implements_cf_list = 11;+ CFListType cf_list_type = 12;+ google.protobuf.Duration receive_delay_1 = 13;+ google.protobuf.Duration receive_delay_2 = 14;+ google.protobuf.Duration join_accept_delay_1 = 15;+ google.protobuf.Duration join_accept_delay_2 = 16;+ uint64 max_fcnt_gap = 17;+ bool supports_dynamic_adr = 18;+ ADRAckLimitExponent adr_ack_limit = 19;+ google.protobuf.Duration min_retransmit_timeout = 20;+ google.protobuf.Duration max_retransmit_timeout = 21;+ repeated float tx_offset = 22;+ DataRateIndex max_adr_data_rate_index = 23;+ google.protobuf.Duration relay_forward_delay = 34;+ google.protobuf.Duration relay_receive_delay = 35;++ bool tx_param_setup_req_support = 24;+ float default_max_eirp = 25;+ reserved 26; // rx1_channel+ reserved 27; // rx2_datarate+ reserved 28; // generate_ch_masks+ reserved 29; // parse_ch_mask++ message Rx2Parameters {+ DataRateIndex data_rate_index = 1;+ uint64 frequency = 2;+ }++ Rx2Parameters default_rx2_parameters = 30;++ message DwellTime {+ google.protobuf.BoolValue uplinks = 1;+ google.protobuf.BoolValue downlinks = 2;+ }++ DwellTime boot_dwell_time = 31;++ message RelayParameters {+ message RelayWORChannel {+ uint64 frequency = 1;+ uint64 ack_frequency = 2;+ DataRateIndex data_rate_index = 3;+ }+ repeated RelayWORChannel wor_channels = 1;+ }++ RelayParameters relay = 33;+}++message ListBandsResponse {+ message VersionedBandDescription {+ map<string, BandDescription> band = 1;+ }+ map<string, VersionedBandDescription> descriptions = 1;+}++service Configuration {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Retrieve LoRaWAN network configuration options."};+ rpc ListFrequencyPlans(ListFrequencyPlansRequest) returns (ListFrequencyPlansResponse) {+ option (google.api.http) = {get: "/configuration/frequency-plans"};+ }++ // Returns a list of supported LoRaWAN PHY Versions for the given Band ID.+ rpc GetPhyVersions(GetPhyVersionsRequest) returns (GetPhyVersionsResponse) {+ option (google.api.http) = {get: "/configuration/phy-versions"};+ }++ rpc ListBands(ListBandsRequest) returns (ListBandsResponse) {+ option (google.api.http) = {+ get: "/configuration/bands"+ additional_bindings {get: "/configuration/bands/{band_id}"}+ additional_bindings {get: "/configuration/bands/{band_id}/{phy_version}"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/contact_info.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/contact_info.protonew file mode 100644index 000000000..e62b7c65c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/contact_info.proto@@ -0,0 +1,102 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++enum ContactType {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "CONTACT_TYPE"+ };++ CONTACT_TYPE_OTHER = 0;+ CONTACT_TYPE_ABUSE = 1;+ CONTACT_TYPE_BILLING = 2;+ CONTACT_TYPE_TECHNICAL = 3;+}++enum ContactMethod {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "CONTACT_METHOD"+ };++ CONTACT_METHOD_OTHER = 0;+ CONTACT_METHOD_EMAIL = 1;+ CONTACT_METHOD_PHONE = 2;+}++message ContactInfo {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ContactType contact_type = 1 [(validate.rules).enum.defined_only = true];+ ContactMethod contact_method = 2 [(validate.rules).enum.defined_only = true];+ string value = 3 [(validate.rules).string.max_len = 256];+ bool public = 4;+ google.protobuf.Timestamp validated_at = 5;+}++message ContactInfoValidation {+ string id = 1 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+ string token = 2 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+ EntityIdentifiers entity = 3;+ repeated ContactInfo contact_info = 4;+ google.protobuf.Timestamp created_at = 5;+ google.protobuf.Timestamp expires_at = 6;+ google.protobuf.Timestamp updated_at = 7;+}++// The ContactInfoRegistry service, exposed by the Identity Server, is used for+// validating contact information of registered entities.+//+// The actual contact information can be managed with the different registry services:+// ApplicationRegistry, ClientRegistry, GatewayRegistry, OrganizationRegistry and UserRegistry.+service ContactInfoRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "DEPRECATED: Validate contact information of registered entities."};+ // Request validation for the non-validated contact info for the given entity.+ rpc RequestValidation(EntityIdentifiers) returns (ContactInfoValidation) {+ option (google.api.http) = {+ post: "/contact_info/validation"+ body: "*"+ };+ }+ // Validate confirms a contact info validation.+ rpc Validate(ContactInfoValidation) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ patch: "/contact_info/validation"+ body: "*"+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/deviceclaimingserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/deviceclaimingserver.protonew file mode 100644index 000000000..50064baad--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/deviceclaimingserver.proto@@ -0,0 +1,470 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/struct.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/error.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ClaimEndDeviceRequest {+ message AuthenticatedIdentifiers {+ // JoinEUI (or AppEUI) of the device to claim.+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // DevEUI of the device to claim.+ bytes dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // Authentication code to prove ownership.+ // In the LoRa Alliance TR005 specification, this equals the OwnerToken.+ string authentication_code = 3 [(validate.rules).string.pattern = "^[A-Z0-9]{1,32}$"];+ }+ oneof source_device {+ option (validate.required) = true;+ // Authenticated identifiers.+ AuthenticatedIdentifiers authenticated_identifiers = 1;+ // Raw QR code contents.+ bytes qr_code = 2 [(validate.rules).bytes = {+ min_len: 0,+ max_len: 1024+ }];+ }++ // Application identifiers of the target end device.+ ApplicationIdentifiers target_application_ids = 3 [(validate.rules).message.required = true];+ // End device ID of the target end device. If empty, use the source device ID.+ string target_device_id = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];++ reserved 5; // Deprecated: invalidate_authentication_code+ reserved 6; // Deprecated: target_join_eui+ reserved 7; // Deprecated: target_network_server_address+ reserved 8; // Deprecated: target_network_server_kek_label+ reserved 9; // Deprecated: target_application_server_address+ reserved 10; // Deprecated: target_application_server_kek_label+ reserved 11; // Deprecated: target_application_server_id+ reserved 12; // Deprecated: target_join_server_address+ reserved 13; // Deprecated: target_net_id+}++// DEPRECATED: Device claiming that transfers devices between applications is no longer supported and will be removed+// in a future version of The Things Stack.+message AuthorizeApplicationRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ string api_key = 2 [(validate.rules).string = {+ min_len: 1,+ max_len: 128+ }];+}++message GetInfoByJoinEUIRequest {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message GetInfoByJoinEUIResponse {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // If set, this Join EUI is available for claiming on one of the configured Join Servers.+ bool supports_claiming = 2;+}++message GetInfoByJoinEUIsRequest {+ repeated GetInfoByJoinEUIRequest requests = 1 [(validate.rules).repeated.max_items = 20];+}++message GetInfoByJoinEUIsResponse {+ repeated GetInfoByJoinEUIResponse infos = 1;+}++message GetClaimStatusResponse {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ bytes home_net_id = 2 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ bytes home_ns_id = 3 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];++ message VendorSpecific {+ uint32 organization_unique_identifier = 1;+ // Vendor Specific data in JSON format.+ google.protobuf.Struct data = 2;+ }++ VendorSpecific vendor_specific = 4;+}++// The EndDeviceClaimingServer service support claiming and managing end devices on external Join Servers.+service EndDeviceClaimingServer {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Claim and manage end devices on external Join Servers."};+ // Claims the end device on a Join Server by claim authentication code or QR code.+ rpc Claim(ClaimEndDeviceRequest) returns (EndDeviceIdentifiers) {+ option (google.api.http) = {+ post: "/edcs/claim",+ body: "*"+ };+ }++ // Unclaims the end device on a Join Server.+ // EUIs provided in the request are ignored and the end device is looked up by the given identifiers.+ rpc Unclaim(EndDeviceIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/edcs/claim/{application_ids.application_id}/devices/{device_id}"};+ }++ // Return whether claiming is available for a given JoinEUI.+ rpc GetInfoByJoinEUI(GetInfoByJoinEUIRequest) returns (GetInfoByJoinEUIResponse) {+ option (google.api.http) = {+ post: "/edcs/claim/info",+ body: "*"+ };+ }++ // Gets the claim status of an end device.+ // EUIs provided in the request are ignored and the end device is looked up by the given identifiers.+ rpc GetClaimStatus(EndDeviceIdentifiers) returns (GetClaimStatusResponse) {+ option (google.api.http) = {get: "/edcs/claim/{application_ids.application_id}/devices/{device_id}"};+ }++ // Authorize the End Device Claiming Server to claim devices registered in the given application. The application+ // identifiers are the source application, where the devices are registered before they are claimed.+ // The API key is used to access the application, find the device, verify the claim request and delete the end device+ // from the source application.+ // DEPRECATED: Device claiming that transfers devices between applications is no longer supported and will be removed+ // in a future version of The Things Stack.+ rpc AuthorizeApplication(AuthorizeApplicationRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ post: "/edcs/applications/{application_ids.application_id}/authorize",+ body: "*"+ };+ }++ // Unauthorize the End Device Claiming Server to claim devices in the given application.+ // This reverts the authorization given with rpc AuthorizeApplication.+ // DEPRECATED: Device claiming that transfers devices between applications is no longer supported and will be removed+ // in a future version of The Things Stack.+ rpc UnauthorizeApplication(ApplicationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/edcs/applications/{application_id}/authorize"};+ }+}++message BatchUnclaimEndDevicesRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ repeated string device_ids = 2 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ items: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ }+ }];+}++message BatchUnclaimEndDevicesResponse {+ ApplicationIdentifiers application_ids = 1;+ // End devices that could not be unclaimed.+ // The key is the device ID.+ map<string, ErrorDetails> failed = 2;+}++// The EndDeviceBatchClaimingServer service support claiming and managing batches of end devices on external Join Servers.+service EndDeviceBatchClaimingServer {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Claim and manage batches of end devices on external Join Servers."};+ // Unclaims multiple end devices on an external Join Server.+ // All devices must have the same application ID.+ // Check the response for devices that could not be unclaimed.+ rpc Unclaim(BatchUnclaimEndDevicesRequest) returns (BatchUnclaimEndDevicesResponse) {+ option (google.api.http) = {delete: "/edcs/claim/{application_ids.application_id}/devices/batch"};+ }++ // Return whether claiming is supported for each Join EUI in a given list.+ rpc GetInfoByJoinEUIs(GetInfoByJoinEUIsRequest) returns (GetInfoByJoinEUIsResponse) {+ option (google.api.http) = {+ post: "/edcs/claim/info/batch",+ body: "*"+ };+ }+}++// DEPRECATED: This message is deprecated and will be removed in a future version of The Things Stack.+message CUPSRedirection {+ option deprecated = true;+ // CUPS URI for LoRa Basics Station CUPS redirection.+ string target_cups_uri = 1 [(validate.rules).string = {+ uri: true,+ pattern: "^https",+ max_len: 256+ }];++ // The key set in the gateway to authenticate itself.+ string current_gateway_key = 2 [(validate.rules).string.max_len = 2048];++ // Optional PEM encoded CA Root certificate. If this field is empty, DCS will attempt to dial the Target CUPS server and fetch the CA.+ bytes target_cups_trust = 3;+ message ClientTLS {+ // PEM encoded Client Certificate.+ bytes cert = 1 [(validate.rules).bytes.max_len = 8192];+ // PEM encoded Client Private Key.+ bytes key = 2 [(validate.rules).bytes.max_len = 8192];+ }+ // CUPS Credentials for the gateway.+ oneof gateway_credentials {+ // TODO: Support mTLS (https://github.com/TheThingsNetwork/lorawan-stack/issues/137)+ ClientTLS client_tls = 4;+ // The Device Claiming Server will fill this field with a The Things Stack API Key.+ string auth_token = 5 [(validate.rules).string.max_len = 2048];+ }+}++message ClaimGatewayRequest {+ message AuthenticatedIdentifiers {+ bytes gateway_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes authentication_code = 2 [(validate.rules).bytes.max_len = 2048];+ }+ oneof source_gateway {+ option (validate.required) = true;+ AuthenticatedIdentifiers authenticated_identifiers = 1;+ bytes qr_code = 2 [(validate.rules).bytes = {+ min_len: 0,+ max_len: 1024+ }];+ }++ // Collaborator to grant all rights on the target gateway.+ OrganizationOrUserIdentifiers collaborator = 3 [(validate.rules).message.required = true];++ // Gateway ID for the target gateway. This must be a unique value.+ // If this is not set, the target ID for the target gateway will be set to `<gateway-eui>`.+ string target_gateway_id = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];++ // Target Gateway Server Address for the target gateway.+ string target_gateway_server_address = 5 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];++ // Parameters to set CUPS redirection for the gateway.+ // DEPRECATED: This field is deprecated and will be removed in a future version of The Things Stack.+ CUPSRedirection cups_redirection = 6 [deprecated = true];++ // Frequency plan ID of the target gateway.+ // TODO: Remove this field (https://github.com/TheThingsIndustries/lorawan-stack/issues/4024)+ // DEPRECATED: Use target_frequency_plan_ids instead.+ string target_frequency_plan_id = 7 [+ (validate.rules).string.max_len = 64,+ deprecated = true+ ];++ // Frequency plan IDs of the target gateway.+ repeated string target_frequency_plan_ids = 8 [(validate.rules).repeated = {+ min_items: 0,+ max_items: 8,+ items: {+ string: {max_len: 64}+ }+ }];+}++message AuthorizeGatewayRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ string api_key = 2 [(validate.rules).string.min_len = 1];+}++message GetInfoByGatewayEUIRequest {+ bytes eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message GetInfoByGatewayEUIResponse {+ bytes eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bool supports_claiming = 2;+ // Indicates whether the gateway is a managed gateway.+ // If true, when the gateway is successfully claimed, it can be managed with ManagedGatewayConfigurationService.+ bool is_managed = 3;+}++// The GatewayClaimingServer service support claiming and managing gateway claims.+service GatewayClaimingServer {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Claim gateways and manage claims."};+ // Claims a gateway by claim authentication code or QR code and transfers the gateway to the target user.+ rpc Claim(ClaimGatewayRequest) returns (GatewayIdentifiers) {+ option (google.api.http) = {+ post: "/gcls/claim",+ body: "*"+ };+ }++ // Unclaims the gateway.+ // EUI provided in the request are ignored and the end device is looked up by the gateway ID.+ rpc Unclaim(GatewayIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/gcls/claim/{gateway_id}"};+ }++ // Return whether claiming is available for a given gateway EUI.+ rpc GetInfoByGatewayEUI(GetInfoByGatewayEUIRequest) returns (GetInfoByGatewayEUIResponse) {+ option (google.api.http) = {+ post: "/gcls/claim/info",+ body: "*"+ };+ }++ // AuthorizeGateway allows a gateway to be claimed.+ // DEPRECATED: Authorizing gateways for claiming is no longer supported and will be removed in a future version of The+ // Things Stack.+ rpc AuthorizeGateway(AuthorizeGatewayRequest) returns (google.protobuf.Empty) {+ option deprecated = true;+ option (google.api.http) = {+ post: "/gcls/gateways/{gateway_ids.gateway_id}/authorize",+ body: "*"+ };+ }++ // UnauthorizeGateway prevents a gateway from being claimed.+ // DEPRECATED: Unauthorizing (locking) gateways for claiming is no longer supported and will be removed in a future+ // version of The Things Stack.+ rpc UnauthorizeGateway(GatewayIdentifiers) returns (google.protobuf.Empty) {+ option deprecated = true;+ option (google.api.http) = {delete: "/gcls/gateways/{gateway_id}/authorize"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/devicerepository.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/devicerepository.protonew file mode 100644index 000000000..321bdf3d2--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/devicerepository.proto@@ -0,0 +1,540 @@+// Copyright © 2020 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/messages.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message EndDeviceBrand {+ // Brand identifier, as specified in the Device Repository.+ string brand_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Brand name.+ string name = 2;++ // Private Enterprise Number (PEN) assigned by IANA.+ uint32 private_enterprise_number = 3;+ // Organization Unique Identifiers (OUI) assigned by IEEE.+ repeated string organization_unique_identifiers = 4 [(validate.rules).repeated.items.string.pattern = "[0-9A-F]{6}"];+ // VendorID managed by the LoRa Alliance, as defined in TR005.+ uint32 lora_alliance_vendor_id = 5;+ // Brand website URL.+ string website = 6 [(validate.rules).string = {+ uri: true,+ ignore_empty: true+ }];+ // Contact email address.+ string email = 7 [(validate.rules).string = {+ email: true,+ ignore_empty: true+ }];+ // Path to brand logo.+ string logo = 8 [(validate.rules).string.pattern = "^$|^(([a-z0-9-]+\\/)+)?([a-z0-9_-]+\\.)+(png|svg)$"];+}++enum KeyProvisioning {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "KEY_PROVISIONING"+ };++ // Unknown Key Provisioning.+ KEY_PROVISIONING_UNKNOWN = 0 [(thethings.json.enum_value) = {value: "unknown"}];+ // Custom Key Provisioning.+ KEY_PROVISIONING_CUSTOM = 1 [(thethings.json.enum_value) = {value: "custom"}];+ // Key Provisioning from the Global Join Server.+ KEY_PROVISIONING_JOIN_SERVER = 2 [(thethings.json.enum_value) = {value: "join server"}];+ // Key Provisioning from Manifest.+ KEY_PROVISIONING_MANIFEST = 3 [(thethings.json.enum_value) = {value: "manifest"}];+}++enum KeySecurity {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "KEY_SECURITY"+ };++ // Unknown key security.+ KEY_SECURITY_UNKNOWN = 0 [(thethings.json.enum_value) = {value: "unknown"}];+ // No key security.+ KEY_SECURITY_NONE = 1 [(thethings.json.enum_value) = {value: "none"}];+ // Read Protected key security.+ KEY_SECURITY_READ_PROTECTED = 2 [(thethings.json.enum_value) = {value: "read protected"}];+ // Key security using the Security Element.+ KEY_SECURITY_SECURE_ELEMENT = 3 [(thethings.json.enum_value) = {value: "secure element"}];+}++message EndDeviceModel {+ // Brand identifier, as defined in the Device Repository.+ string brand_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Model identifier, as defined in the Device Repository.+ string model_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Model name, as defined in the Device Repository.+ string name = 3;+ // Model description.+ string description = 4;++ message HardwareVersion {+ // Hardware version string.+ string version = 1;+ // Numberic hardware revision number.+ uint32 numeric = 2;+ // Hardware part number.+ string part_number = 3;+ }+ // Available hardware versions.+ repeated HardwareVersion hardware_versions = 5;++ message FirmwareVersion {+ message Profile {+ // Vendor ID of the profile, as defined in the Device Repository.+ // If this value is set, the profile is loaded from this vendor's folder.+ // If this value is not set, the profile is loaded from the current (end device's) vendor.+ string vendor_id = 4 [(validate.rules).string = {+ pattern: "^$|^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Profile identifier, as defined in the Device Repository.+ string profile_id = 1 [(validate.rules).string = {+ pattern: "^$|^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Whether the device is LoRaWAN certified.+ bool lorawan_certified = 2;+ // Payload formatter codec identifier, as defined in the Device Repository.+ string codec_id = 3 [(validate.rules).string = {+ pattern: "^$|^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ }+ // Firmware version string.+ string version = 1;+ // Numeric firmware revision number.+ uint32 numeric = 2;+ // Hardware versions supported by this firmware version.+ repeated string supported_hardware_versions = 3 [(validate.rules).repeated.unique = true];+ // Device profiles for each supported region (band).+ map<string, Profile> profiles = 4;+ }+ // Available firmware versions.+ repeated FirmwareVersion firmware_versions = 6;+ // List of sensors included in the device.+ repeated string sensors = 7 [(validate.rules).repeated.unique = true];+ message Dimensions {+ // Device width (mm).+ google.protobuf.FloatValue width = 1;+ // Device height (mm).+ google.protobuf.FloatValue height = 2;+ // Device diameter (mm).+ google.protobuf.FloatValue diameter = 3;+ // Device length (mm).+ google.protobuf.FloatValue length = 4;+ }+ // Device dimensions.+ Dimensions dimensions = 8;+ // Device weight (gram).+ google.protobuf.FloatValue weight = 9;+ message Battery {+ // Whether the device battery can be replaced.+ google.protobuf.BoolValue replaceable = 1;+ // Battery type.+ string type = 2;+ }+ // Device battery information.+ Battery battery = 10;+ message OperatingConditions {+ message Limits {+ // Min value of operating conditions range.+ google.protobuf.FloatValue min = 1;+ // Max value of operating conditions range.+ google.protobuf.FloatValue max = 2;+ }+ // Temperature operating conditions (Celsius).+ Limits temperature = 1;+ // Relative humidity operating conditions (Fraction, in range [0, 1]).+ Limits relative_humidity = 2;+ }+ // Device operating conditions.+ OperatingConditions operating_conditions = 11;+ // Device IP rating code.+ string ip_code = 12;+ // Supported key provisioning methods.+ repeated KeyProvisioning key_provisioning = 13 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ },+ }];+ // Device key security.+ KeySecurity key_security = 14 [(validate.rules).enum.defined_only = true];++ message Photos {+ // Main device photo.+ string main = 1 [(validate.rules).string.pattern = "^$|^(([a-z0-9-]+\\/)+)?([a-z0-9_-]+\\.)+(png|jpg|jpeg)$"];+ // List of other device photos.+ repeated string other = 2 [(validate.rules).repeated = {+ unique: true,+ items: {+ string: {pattern: "^$|^(([a-z0-9-]+\\/)+)?([a-z0-9_-]+\\.)+(png|jpg|jpeg)$"}+ },+ }];+ }+ // Device photos.+ Photos photos = 15;+ message Videos {+ // Link to main device video.+ string main = 1 [(validate.rules).string.pattern = "^(?:https?:\\/\\/(?:www\\.)?youtu(?:be\\.com\\/watch\\?v=|\\.be\\/)(?:[\\w\\-_]*)(?:&(amp;)?[\\w\\?=]*)?)$|^(?:https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|)(?:\\d+)(?:|\\/\\?))$"];+ // Links to other device videos.+ repeated string other = 2 [(validate.rules).repeated = {+ unique: true,+ items: {+ string: {pattern: "^(?:https?:\\/\\/(?:www\\.)?youtu(?:be\\.com\\/watch\\?v=|\\.be\\/)(?:[\\w\\-_]*)(?:&(amp;)?[\\w\\?=]*)?)$|^(?:https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|)(?:\\d+)(?:|\\/\\?))$"}+ },+ }];+ }+ // Device videos.+ Videos videos = 16;++ // Device information page URL.+ string product_url = 17 [(validate.rules).string = {+ uri: true,+ ignore_empty: true+ }];+ // Device datasheet URL.+ string datasheet_url = 18 [(validate.rules).string = {+ uri: true,+ ignore_empty: true+ }];++ message Reseller {+ // Reseller name.+ string name = 1;+ // Reseller regions.+ repeated string region = 2;+ // Reseller URL.+ string url = 3 [(validate.rules).string = {+ uri: true,+ ignore_empty: true+ }];+ }+ // Reseller URLs.+ repeated Reseller resellers = 19;++ message Compliances {+ message Compliance {+ string body = 1;+ string norm = 2;+ string standard = 3;+ string version = 4;+ }+ // List of safety standards the device is compliant with.+ repeated Compliance safety = 1;+ // List of radio equipment standards the device is compliant with.+ repeated Compliance radio_equipment = 2;+ }+ // List of standards the device is compliant with.+ Compliances compliances = 20;++ // List of any additional radios included in the device.+ repeated string additional_radios = 21 [(validate.rules).repeated.unique = true];+}++message GetEndDeviceBrandRequest {+ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // Brand identifier, as defined in the Device Repository.+ string brand_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];++ // Field mask paths.+ google.protobuf.FieldMask field_mask = 3;+}++message ListEndDeviceBrandsRequest {+ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;++ // Order (for pagination)+ string order_by = 4 [(validate.rules).string = {+ in: [+ "",+ "brand_id",+ "-brand_id",+ "name",+ "-name"+ ]+ }];++ // Search for brands matching a query string.+ string search = 5 [(validate.rules).string = {max_len: 100}];++ // Field mask paths.+ google.protobuf.FieldMask field_mask = 6;+}++message GetEndDeviceModelRequest {+ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // Brand identifier, as defined in the Device Repository.+ string brand_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Model identifier, as defined in the Device Repository.+ string model_id = 3 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];++ // Field mask paths.+ google.protobuf.FieldMask field_mask = 4;+}++message ListEndDeviceModelsRequest {+ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // List end devices from a specific brand.+ string brand_id = 2 [(validate.rules).string = {+ pattern: "^([a-z0-9](?:[-]?[a-z0-9]){2,}|)?$",+ max_len: 36+ }];++ // Limit the number of results per page.+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 4;+ // Order end devices+ string order_by = 5 [(validate.rules).string = {+ in: [+ "",+ "brand_id",+ "-brand_id",+ "model_id",+ "-model_id",+ "name",+ "-name"+ ]+ }];++ // List end devices matching a query string.+ string search = 6 [(validate.rules).string = {max_len: 100}];++ // Field mask paths.+ google.protobuf.FieldMask field_mask = 7;+}++message GetTemplateRequest {+ // Identifiers to uniquely identify a LoRaWAN end device profile.+ message EndDeviceProfileIdentifiers {+ // VendorID managed by the LoRa Alliance, as defined in TR005.+ uint32 vendor_id = 1 [(validate.rules).uint32 = {gte: 1}];++ // ID of the LoRaWAN end device profile assigned by the vendor.+ uint32 vendor_profile_id = 2;+ }++ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // End device version information.+ // Use either EndDeviceVersionIdentifiers or EndDeviceProfileIdentifiers.+ EndDeviceVersionIdentifiers version_ids = 2;++ // End device profile identifiers.+ EndDeviceProfileIdentifiers end_device_profile_ids = 3;+}++message GetPayloadFormatterRequest {+ // Application identifiers.+ ApplicationIdentifiers application_ids = 1 [deprecated = true];++ // End device version information.+ EndDeviceVersionIdentifiers version_ids = 2;++ // Field mask paths.+ google.protobuf.FieldMask field_mask = 3;+}++message ListEndDeviceBrandsResponse {+ repeated EndDeviceBrand brands = 1;+}++message ListEndDeviceModelsResponse {+ repeated EndDeviceModel models = 1;+}++message EncodedMessagePayload {+ uint32 f_port = 1 [(validate.rules).uint32.lte = 255];+ bytes frm_payload = 2;+ repeated string warnings = 3 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 100}+ }+ }];+ repeated string errors = 4 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 100}+ }+ }];+}++message DecodedMessagePayload {+ google.protobuf.Struct data = 1;+ repeated string warnings = 2 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 100}+ }+ }];+ repeated string errors = 3 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {max_len: 100}+ }+ }];+}++message MessagePayloadDecoder {+ // Payload formatter type.+ PayloadFormatter formatter = 1 [(validate.rules).enum.defined_only = true];+ // Parameter for the formatter, must be set together.+ string formatter_parameter = 2;++ string codec_id = 3 [(validate.rules).string = {+ pattern: "^([a-z0-9](?:[-]?[a-z0-9]){2,}|)?$",+ max_len: 36+ }];++ message Example {+ string description = 1 [(validate.rules).string.max_len = 200];+ EncodedMessagePayload input = 2;+ DecodedMessagePayload output = 3;+ }+ repeated Example examples = 4 [(validate.rules).repeated.max_items = 20];+}++message MessagePayloadEncoder {+ // Payload formatter type.+ PayloadFormatter formatter = 1 [(validate.rules).enum.defined_only = true];+ // Parameter for the formatter, must be set together.+ string formatter_parameter = 2;++ string codec_id = 3 [(validate.rules).string = {+ pattern: "^([a-z0-9](?:[-]?[a-z0-9]){2,}|)?$",+ max_len: 36+ }];++ message Example {+ string description = 1 [(validate.rules).string.max_len = 200];+ DecodedMessagePayload input = 2;+ EncodedMessagePayload output = 3;+ }+ repeated Example examples = 4 [(validate.rules).repeated.max_items = 20];+}++service DeviceRepository {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Get information on LoRaWAN end device brands, models, and templates from the Device Repository."};+ rpc ListBrands(ListEndDeviceBrandsRequest) returns (ListEndDeviceBrandsResponse) {+ option (google.api.http) = {+ get: "/dr/brands"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands"}+ };+ }++ rpc GetBrand(GetEndDeviceBrandRequest) returns (EndDeviceBrand) {+ option (google.api.http) = {+ get: "/dr/brands/{brand_id}"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{brand_id}"}+ };+ }++ rpc ListModels(ListEndDeviceModelsRequest) returns (ListEndDeviceModelsResponse) {+ option (google.api.http) = {+ get: "/dr/models"+ additional_bindings {get: "/dr/brands/{brand_id}/models"}+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/models"}+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{brand_id}/models"}+ };+ }++ rpc GetModel(GetEndDeviceModelRequest) returns (EndDeviceModel) {+ option (google.api.http) = {+ get: "/dr/brands/{brand_id}/models/{model_id}"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{brand_id}/models/{model_id}"}+ };+ }++ rpc GetTemplate(GetTemplateRequest) returns (EndDeviceTemplate) {+ option (google.api.http) = {+ get: "/dr/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/template"+ additional_bindings {get: "/dr/vendors/{end_device_profile_ids.vendor_id}/profiles/{end_device_profile_ids.vendor_profile_id}/template"}+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/template"}+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/vendors/{end_device_profile_ids.vendor_id}/profiles/{end_device_profile_ids.vendor_profile_id}/template"}+ };+ }++ rpc GetUplinkDecoder(GetPayloadFormatterRequest) returns (MessagePayloadDecoder) {+ option (google.api.http) = {+ get: "/dr/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/uplink/decoder"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/uplink/decoder"}+ };+ }++ rpc GetDownlinkDecoder(GetPayloadFormatterRequest) returns (MessagePayloadDecoder) {+ option (google.api.http) = {+ get: "/dr/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/downlink/decoder"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/downlink/decoder"}+ };+ }++ rpc GetDownlinkEncoder(GetPayloadFormatterRequest) returns (MessagePayloadEncoder) {+ option (google.api.http) = {+ get: "/dr/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/downlink/encoder"+ additional_bindings {get: "/dr/applications/{application_ids.application_id}/brands/{version_ids.brand_id}/models/{version_ids.model_id}/{version_ids.firmware_version}/{version_ids.band_id}/formatters/downlink/encoder"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/email_messages.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/email_messages.protonew file mode 100644index 000000000..40ec4f221--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/email_messages.proto@@ -0,0 +1,28 @@+// Copyright © 2022 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "ttn/lorawan/v3/client.proto";+import "ttn/lorawan/v3/rights.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// CreateClientEmailMessage is used as a wrapper for handling the email regarding the create client procedure.+message CreateClientEmailMessage {+ CreateClientRequest create_client_request = 1;+ APIKey api_key = 2;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/email_validation.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/email_validation.protonew file mode 100644index 000000000..13b4973a5--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/email_validation.proto@@ -0,0 +1,71 @@+// Copyright © 2023 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message EmailValidation {+ string id = 1 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+ string token = 2 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+ string address = 3 [(validate.rules).string.email = true];+ google.protobuf.Timestamp created_at = 4;+ google.protobuf.Timestamp expires_at = 5;+ google.protobuf.Timestamp updated_at = 6;+}++message ValidateEmailRequest {+ string id = 1 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+ string token = 2 [(validate.rules).string = {+ max_len: 64,+ min_len: 1+ }];+}++// The EmailValidationRegistry service, exposed by the Identity Server, is used for validating a user's primary email.+service EmailValidationRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Validate a user's primary email."};+ // Request validation for the non-validated contact info for the given entity.+ rpc RequestValidation(UserIdentifiers) returns (EmailValidation) {+ option (google.api.http) = {+ post: "/email/validation"+ body: "*"+ };+ }+ // Validate confirms a contact info validation.+ rpc Validate(ValidateEmailRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ patch: "/email/validation"+ body: "*"+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/end_device.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/end_device.protonew file mode 100644index 000000000..0d8532a42--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/end_device.proto@@ -0,0 +1,1452 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/duration.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/keys.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "ttn/lorawan/v3/messages.proto";+import "ttn/lorawan/v3/metadata.proto";+import "ttn/lorawan/v3/picture.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message Session {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ reserved 1; // RFU: Session ID++ // Device Address, issued by the Network Server or chosen by device manufacturer in case of testing range (beginning with 00-03).+ // Known by Network Server, Application Server and Join Server. Owned by Network Server.+ bytes dev_addr = 2 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ SessionKeys keys = 3 [(validate.rules).message.required = true];+ // Last uplink frame counter value used. Network Server only. Application Server assumes the Network Server checked it.+ uint32 last_f_cnt_up = 4;+ // Last network downlink frame counter value used. Network Server only.+ uint32 last_n_f_cnt_down = 5;+ // Last application downlink frame counter value used. Application Server only.+ uint32 last_a_f_cnt_down = 6;+ // Frame counter of the last confirmed downlink message sent. Network Server only.+ uint32 last_conf_f_cnt_down = 7;+ // Time when the session started. Network Server only.+ google.protobuf.Timestamp started_at = 8;+ // Queued Application downlink messages. Stored in Application Server and Network Server.+ repeated ApplicationDownlink queued_application_downlinks = 9;+}++message BoolValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ bool value = 1;+}++message ServingRelayForwardingLimits {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // Reset behavior of the buckets upon limit update.+ RelayResetLimitCounter reset_behavior = 1;+ // Bucket configuration for join requests.+ // If unset, no individual limits will apply to join requests, but the relay overall limitations will apply.+ RelayForwardLimits join_requests = 2;+ // Bucket configuration for unknown device notifications.+ // If unset, no individual limits will apply to unknown end device notifications, but the relay overall+ // limitations will still apply.+ RelayForwardLimits notifications = 3;+ // Bucket configuration for uplink messages across all served end devices.+ // If unset, no individual limits will apply to uplink messages across all served end devices, but the relay+ // overall limitations will still apply.+ RelayForwardLimits uplink_messages = 4;+ // Bucket configuration for all relay messages.+ // If unset, no overall limits will apply to the relay, but individual limitations will still apply.+ RelayForwardLimits overall = 5;+}++message RelayUplinkForwardingRule {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // Bucket configuration for the served end device.+ // If unset, no individual limits will apply to the end device, but the relay global limitations will apply.+ RelayUplinkForwardLimits limits = 1;+ // Last wake on radio frame counter used by the served end device.+ uint32 last_w_f_cnt = 2;++ // End device identifier of the served end device.+ string device_id = 3 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ // Session key ID of the session keys used to derive the root relay session key.+ bytes session_key_id = 4;+}++message ServingRelayParameters {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // Second wake on radio channel configuration.+ RelaySecondChannel second_channel = 1;+ // Index of the default wake on radio channel.+ uint32 default_channel_index = 2 [(validate.rules).uint32.lte = 255];+ // Channel activity detection periodicity.+ RelayCADPeriodicity cad_periodicity = 3 [(validate.rules).enum.defined_only = true];+ // Configured uplink forwarding rules.+ repeated RelayUplinkForwardingRule uplink_forwarding_rules = 4 [(validate.rules).repeated.max_items = 16];+ // Configured forwarding limits.+ // If unset, the default value from Network Server configuration will be used.+ ServingRelayForwardingLimits limits = 5;+}++message ServedRelayParameters {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };++ oneof mode {+ option (validate.required) = true;++ // The end device will always attempt to use the relay mode in order to send uplink messages.+ RelayEndDeviceAlwaysMode always = 1;+ // The end device will attempt to use relay mode only after a number of uplink messages have been sent without+ // receiving a valid a downlink message.+ RelayEndDeviceDynamicMode dynamic = 2;+ // The end device will control when it uses the relay mode. This is the default mode.+ RelayEndDeviceControlledMode end_device_controlled = 3;+ }+ // Number of wake on radio frames to be sent without an acknowledgement before sending the uplink message directly.+ uint32 backoff = 4 [(validate.rules).uint32.lte = 63];+ // Second wake on radio channel configuration.+ RelaySecondChannel second_channel = 5;++ // End device identifier of the serving end device.+ string serving_device_id = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++// RelayParameters represent the parameters of a relay.+// This is used internally by the Network Server.+message RelayParameters {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };++ oneof mode {+ option (validate.required) = true;++ // Parameters related to a relay which is serving end devices.+ ServingRelayParameters serving = 1;+ // Parameters related to an end device served by a relay.+ ServedRelayParameters served = 2;+ }+}++message ServingRelaySettings {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // Second wake on radio channel configuration.+ RelaySecondChannel second_channel = 1;+ reserved 2; // DEPRECATED: default_channel_index (uint32)+ // Index of the default wake on radio channel.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value default_channel_index = 6 [(validate.rules).uint32.lte = 255];+ // Channel activity detection periodicity.+ RelayCADPeriodicity cad_periodicity = 3 [(validate.rules).enum.defined_only = true];+ // Configured uplink forwarding rules.+ repeated RelayUplinkForwardingRule uplink_forwarding_rules = 4 [(validate.rules).repeated.max_items = 16];+ // Configured forwarding limits.+ // If unset, the default value from Network Server configuration will be used.+ ServingRelayForwardingLimits limits = 5;+}++message ServedRelaySettings {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };++ oneof mode {+ option (validate.required) = true;++ // The end device will always attempt to use the relay mode in order to send uplink messages.+ RelayEndDeviceAlwaysMode always = 1;+ // The end device will attempt to use relay mode only after a number of uplink messages have been sent without+ // receiving a valid a downlink message.+ RelayEndDeviceDynamicMode dynamic = 2;+ // The end device will control when it uses the relay mode. This is the default mode.+ RelayEndDeviceControlledMode end_device_controlled = 3;+ }+ reserved 4; // DEPRECATED: backoff (uint32)+ // Number of wake on radio frames to be sent without an acknowledgement before sending the uplink message directly.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value backoff = 7 [(validate.rules).uint32.lte = 63];+ // Second wake on radio channel configuration.+ RelaySecondChannel second_channel = 5;++ // End device identifier of the serving end device.+ string serving_device_id = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++// RelaySettings represent the settings of a relay.+// This is used internally by the Network Server.+message RelaySettings {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };++ oneof mode {+ option (validate.required) = true;++ ServingRelaySettings serving = 1;+ ServedRelaySettings served = 2;+ }+}++// MACParameters represent the parameters of the device's MAC layer (active or desired).+// This is used internally by the Network Server.+message MACParameters {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Maximum EIRP (dBm).+ float max_eirp = 1;+ reserved 2; // Deprecated: uplink_dwell_time+ reserved 3; // Deprecated: downlink_dwell_time+ // ADR: data rate index to use.+ DataRateIndex adr_data_rate_index = 4 [(validate.rules).enum.defined_only = true];+ // ADR: transmission power index to use.+ uint32 adr_tx_power_index = 5 [(validate.rules).uint32.lte = 15];+ // ADR: number of retransmissions.+ uint32 adr_nb_trans = 6 [(validate.rules).uint32.lte = 15];+ // ADR: number of messages to wait before setting ADRAckReq.+ // This field is deprecated, use adr_ack_limit_exponent instead.+ uint32 adr_ack_limit = 7 [deprecated = true];+ // ADR: number of messages to wait after setting ADRAckReq and before changing TxPower or DataRate.+ // This field is deprecated, use adr_ack_delay_exponent instead.+ uint32 adr_ack_delay = 8 [deprecated = true];+ // Rx1 delay (Rx2 delay is Rx1 delay + 1 second).+ RxDelay rx1_delay = 9 [(validate.rules).enum.defined_only = true];+ // Data rate offset for Rx1.+ DataRateOffset rx1_data_rate_offset = 10 [(validate.rules).enum.defined_only = true];+ // Data rate index for Rx2.+ DataRateIndex rx2_data_rate_index = 11 [(validate.rules).enum.defined_only = true];+ // Frequency for Rx2 (Hz).+ uint64 rx2_frequency = 12 [(validate.rules).uint64.gte = 100000];+ // Maximum uplink duty cycle (of all channels).+ AggregatedDutyCycle max_duty_cycle = 13 [(validate.rules).enum.defined_only = true];+ // Time within which a rejoin-request must be sent.+ RejoinTimeExponent rejoin_time_periodicity = 14 [(validate.rules).enum.defined_only = true];+ // Message count within which a rejoin-request must be sent.+ RejoinCountExponent rejoin_count_periodicity = 15 [(validate.rules).enum.defined_only = true];+ // Frequency of the class B ping slot (Hz).+ uint64 ping_slot_frequency = 16 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }];+ // Data rate index of the class B ping slot.+ // This field is deprecated, use ping_slot_data_rate_index_value instead.+ DataRateIndex ping_slot_data_rate_index_legacy = 17 [deprecated = true];+ // Frequency of the class B beacon (Hz).+ uint64 beacon_frequency = 18 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }];++ message Channel {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Uplink frequency of the channel (Hz).+ uint64 uplink_frequency = 1 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }];+ // Downlink frequency of the channel (Hz).+ uint64 downlink_frequency = 2 [(validate.rules).uint64.gte = 100000];+ // Index of the minimum data rate for uplink.+ DataRateIndex min_data_rate_index = 3 [(validate.rules).enum.defined_only = true];+ // Index of the maximum data rate for uplink.+ DataRateIndex max_data_rate_index = 4 [(validate.rules).enum.defined_only = true];+ // Channel can be used by device for uplink.+ bool enable_uplink = 5;+ }+ // Configured uplink channels and optionally Rx1 frequency.+ repeated Channel channels = 19 [(validate.rules).repeated.min_items = 1];++ // Whether uplink dwell time is set (400ms).+ // If unset, then the value is either unknown or irrelevant(Network Server cannot modify it).+ BoolValue uplink_dwell_time = 20;+ // Whether downlink dwell time is set (400ms).+ // If unset, then the value is either unknown or irrelevant(Network Server cannot modify it).+ BoolValue downlink_dwell_time = 21;++ // ADR: number of messages to wait before setting ADRAckReq.+ ADRAckLimitExponentValue adr_ack_limit_exponent = 22;+ // ADR: number of messages to wait after setting ADRAckReq and before changing TxPower or DataRate.+ ADRAckDelayExponentValue adr_ack_delay_exponent = 23;+ // Data rate index of the class B ping slot.+ DataRateIndexValue ping_slot_data_rate_index_value = 24;++ // Relay parameters.+ RelayParameters relay = 25;+}++// Template for creating end devices.+message EndDeviceVersion {+ // Version identifiers.+ EndDeviceVersionIdentifiers ids = 1 [(validate.rules).message.required = true];++ // LoRaWAN MAC version.+ MACVersion lorawan_version = 2 [(validate.rules).enum.defined_only = true];+ // LoRaWAN PHY version.+ PHYVersion lorawan_phy_version = 3 [(validate.rules).enum.defined_only = true];+ // ID of the frequency plan used by this device.+ string frequency_plan_id = 4 [(validate.rules).string.max_len = 64];++ // Photos contains file names of device photos.+ repeated string photos = 5 [(validate.rules).repeated.max_items = 10];++ // Whether the device supports class B.+ bool supports_class_b = 6;+ // Whether the device supports class C.+ bool supports_class_c = 7;+ // Default MAC layer settings of the device.+ MACSettings default_mac_settings = 8;+ // Minimum frequency the device is capable of using (Hz).+ uint64 min_frequency = 9;+ // Maximum frequency the device is capable of using (Hz).+ uint64 max_frequency = 10;+ // The device supports join (it's OTAA).+ bool supports_join = 11;+ // Whether the device resets the join and dev nonces (not LoRaWAN compliant).+ bool resets_join_nonces = 12;++ // Default formatters defining the payload formats for this end device.+ MessagePayloadFormatters default_formatters = 13 [(validate.rules).message.required = true];+}++// Adaptive Data Rate settings.+message ADRSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };+ // Configuration options for static ADR.+ message StaticMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Data rate index to use.+ DataRateIndex data_rate_index = 1 [(validate.rules).enum.defined_only = true];+ // Transmission power index to use.+ uint32 tx_power_index = 2 [(validate.rules).uint32.lte = 15];+ // Number of retransmissions.+ uint32 nb_trans = 3 [(validate.rules).uint32 = {+ gte: 1,+ lte: 15+ }];+ }++ // Configuration options for dynamic ADR.+ message DynamicMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The ADR margin (dB) tells the network server how much margin it should add in ADR requests.+ // A bigger margin is less efficient, but gives a better chance of successful reception.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.FloatValue margin = 1;++ // Minimum data rate index.+ // If unset, the default value from Network Server configuration will be used.+ DataRateIndexValue min_data_rate_index = 2;+ // Maximum data rate index.+ // If unset, the default value from Network Server configuration will be used.+ DataRateIndexValue max_data_rate_index = 3;++ // Minimum transmission power index.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value min_tx_power_index = 4 [(validate.rules).uint32.lte = 15];+ // Maximum transmission power index.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value max_tx_power_index = 5 [(validate.rules).uint32.lte = 15];++ // Minimum number of retransmissions.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value min_nb_trans = 6 [(validate.rules).uint32 = {+ gte: 1,+ lte: 3+ }];+ // Maximum number of retransmissions.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value max_nb_trans = 7 [(validate.rules).uint32 = {+ gte: 1,+ lte: 3+ }];++ // EXPERIMENTAL: Channel steering settings.+ message ChannelSteeringSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ semantical: true+ };++ // Configuration options for LoRa narrow channels steering.+ // The narrow mode attempts to steer the end device towards+ // using the LoRa modulated, 125kHz bandwidth channels.+ message LoRaNarrowMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ }++ // Configuration options for cases in which ADR is not supposed to steer the end device+ // to another set of channels.+ message DisabledMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ }++ oneof mode {+ LoRaNarrowMode lora_narrow = 1;+ DisabledMode disabled = 2;+ }+ }++ ChannelSteeringSettings channel_steering = 8;++ // EXPERIMENTAL: Data rate index override settings.+ message PerDataRateIndexOverride {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ reserved 1;+ reserved "min_tx_power_index";+ reserved 2;+ reserved "max_tx_power_index";+ // Minimum number of retransmissions.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value min_nb_trans = 3 [(validate.rules).uint32 = {+ gte: 1,+ lte: 3+ }];+ // Maximum number of retransmissions.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value max_nb_trans = 4 [(validate.rules).uint32 = {+ gte: 1,+ lte: 3+ }];+ }++ // EXPERIMENTAL: Configuration overrides.+ message Overrides {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ PerDataRateIndexOverride data_rate_0 = 1;+ PerDataRateIndexOverride data_rate_1 = 2;+ PerDataRateIndexOverride data_rate_2 = 3;+ PerDataRateIndexOverride data_rate_3 = 4;+ PerDataRateIndexOverride data_rate_4 = 5;+ PerDataRateIndexOverride data_rate_5 = 6;+ PerDataRateIndexOverride data_rate_6 = 7;+ PerDataRateIndexOverride data_rate_7 = 8;+ PerDataRateIndexOverride data_rate_8 = 9;+ PerDataRateIndexOverride data_rate_9 = 10;+ PerDataRateIndexOverride data_rate_10 = 11;+ PerDataRateIndexOverride data_rate_11 = 12;+ PerDataRateIndexOverride data_rate_12 = 13;+ PerDataRateIndexOverride data_rate_13 = 14;+ PerDataRateIndexOverride data_rate_14 = 15;+ PerDataRateIndexOverride data_rate_15 = 16;+ }++ Overrides overrides = 9;+ }++ // Configuration options for cases in which ADR is to be disabled+ // completely.+ message DisabledMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ }++ oneof mode {+ StaticMode static = 1;+ DynamicMode dynamic = 2;+ DisabledMode disabled = 3;+ }+}++message MACSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Maximum delay for the device to answer a MAC request or a confirmed downlink frame.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.Duration class_b_timeout = 1;+ // Periodicity of the class B ping slot.+ // If unset, the default value from Network Server configuration will be used.+ PingSlotPeriodValue ping_slot_periodicity = 2;+ // Data rate index of the class B ping slot.+ // If unset, the default value from Network Server configuration will be used.+ DataRateIndexValue ping_slot_data_rate_index = 3;+ // Frequency of the class B ping slot (Hz).+ // If unset, the default value from Network Server configuration will be used.+ ZeroableFrequencyValue ping_slot_frequency = 4;+ // Frequency of the class B beacon (Hz).+ // If unset, the default value from Network Server configuration will be used.+ ZeroableFrequencyValue beacon_frequency = 25;++ // Maximum delay for the device to answer a MAC request or a confirmed downlink frame.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.Duration class_c_timeout = 5;++ // Class A Rx1 delay.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ RxDelayValue rx1_delay = 6;+ // Rx1 data rate offset.+ // If unset, the default value from Network Server configuration will be used.+ DataRateOffsetValue rx1_data_rate_offset = 7;+ // Data rate index for Rx2.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ DataRateIndexValue rx2_data_rate_index = 8;+ // Frequency for Rx2 (Hz).+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ FrequencyValue rx2_frequency = 9;+ // List of factory-preset frequencies.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ repeated uint64 factory_preset_frequencies = 10 [(validate.rules).repeated.max_items = 96];++ // Maximum uplink duty cycle (of all channels).+ AggregatedDutyCycleValue max_duty_cycle = 11;++ // Whether the device supports 32-bit frame counters.+ // If unset, the default value from Network Server configuration will be used.+ BoolValue supports_32_bit_f_cnt = 12;++ // Whether the Network Server should use ADR for the device.+ // This field is deprecated, use adr_settings instead.+ BoolValue use_adr = 13 [deprecated = true];+ // The ADR margin (dB) tells the network server how much margin it should add in ADR requests.+ // A bigger margin is less efficient, but gives a better chance of successful reception.+ // This field is deprecated, use adr_settings.dynamic.margin instead.+ google.protobuf.FloatValue adr_margin = 14 [deprecated = true];+ // Whether the device resets the frame counters (not LoRaWAN compliant).+ // If unset, the default value from Network Server configuration will be used.+ BoolValue resets_f_cnt = 15;+ // The interval after which a DevStatusReq MACCommand shall be sent.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.Duration status_time_periodicity = 16;+ // Number of uplink messages after which a DevStatusReq MACCommand shall be sent.+ // If unset, the default value from Network Server configuration will be used.+ google.protobuf.UInt32Value status_count_periodicity = 17;++ // The Rx1 delay Network Server should configure device to use via MAC commands or Join-Accept.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ RxDelayValue desired_rx1_delay = 18;+ // The Rx1 data rate offset Network Server should configure device to use via MAC commands or Join-Accept.+ // If unset, the default value from Network Server configuration will be used.+ DataRateOffsetValue desired_rx1_data_rate_offset = 19;+ // The Rx2 data rate index Network Server should configure device to use via MAC commands or Join-Accept.+ // If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used.+ DataRateIndexValue desired_rx2_data_rate_index = 20;+ // The Rx2 frequency index Network Server should configure device to use via MAC commands.+ // If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used.+ FrequencyValue desired_rx2_frequency = 21;++ // The maximum uplink duty cycle (of all channels) Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration will be used.+ AggregatedDutyCycleValue desired_max_duty_cycle = 22;++ // The ADR ACK limit Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ ADRAckLimitExponentValue desired_adr_ack_limit_exponent = 23;+ // The ADR ACK delay Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ ADRAckDelayExponentValue desired_adr_ack_delay_exponent = 24;++ // The data rate index of the class B ping slot Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration will be used.+ DataRateIndexValue desired_ping_slot_data_rate_index = 27;+ // The frequency of the class B ping slot (Hz) Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ ZeroableFrequencyValue desired_ping_slot_frequency = 28;+ // The frequency of the class B beacon (Hz) Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration will be used.+ ZeroableFrequencyValue desired_beacon_frequency = 29;+ // Maximum EIRP (dBm).+ // If unset, the default value from regional parameters specification will be used.+ DeviceEIRPValue desired_max_eirp = 30;+ // The minimum duration passed before a network-initiated(e.g. Class B or C) downlink following an arbitrary downlink.+ google.protobuf.Duration class_b_c_downlink_interval = 31;++ // Whether uplink dwell time is set (400ms).+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ BoolValue uplink_dwell_time = 32;+ // Whether downlink dwell time is set (400ms).+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ BoolValue downlink_dwell_time = 33;++ // Adaptive Data Rate settings.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ ADRSettings adr = 34;++ // Whether or not downlink messages should be scheduled.+ // This option can be used in order to disable any downlink interaction with the end device. It will affect all types+ // of downlink messages: data and MAC downlinks, and join accepts.+ BoolValue schedule_downlinks = 35;++ // The relay settings the end device is using.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ RelaySettings relay = 36;++ // The relay settings the Network Server should configure device to use via MAC commands.+ // If unset, the default value from Network Server configuration or regional parameters specification will be used.+ RelaySettings desired_relay = 37;+}++message MACSettingsProfile {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Profile identifiers.+ MACSettingsProfileIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // MAC settings.+ MACSettings mac_settings = 2 [(validate.rules).message.required = true];+ // Associated end devices counter.+ uint32 end_devices_count = 3;+}++// MACState represents the state of MAC layer of the device.+// MACState is reset on each join for OTAA or ResetInd for ABP devices.+// This is used internally by the Network Server.+message MACState {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Current LoRaWAN MAC parameters.+ MACParameters current_parameters = 1 [(validate.rules).message.required = true];+ // Desired LoRaWAN MAC parameters.+ MACParameters desired_parameters = 2 [(validate.rules).message.required = true];++ // Currently active LoRaWAN device class+ // - Device class is A by default+ // - If device sets ClassB bit in uplink, this will be set to B+ // - If device sent DeviceModeInd MAC message, this will be set to that value+ Class device_class = 3 [(validate.rules).enum.defined_only = true];+ // LoRaWAN MAC version.+ MACVersion lorawan_version = 4 [(validate.rules).enum.defined_only = true];+ // Time when the last confirmed downlink message or MAC command was scheduled.+ google.protobuf.Timestamp last_confirmed_downlink_at = 5;+ // Frame counter value of last uplink containing DevStatusAns.+ uint32 last_dev_status_f_cnt_up = 6;+ // Periodicity of the class B ping slot.+ PingSlotPeriodValue ping_slot_periodicity = 7;+ // A confirmed application downlink, for which an acknowledgment is expected to arrive.+ ApplicationDownlink pending_application_downlink = 8;+ // Queued MAC responses.+ // Regenerated on each uplink.+ repeated MACCommand queued_responses = 9;+ // Pending MAC requests(i.e. sent requests, for which no response has been received yet).+ // Regenerated on each downlink.+ repeated MACCommand pending_requests = 10;++ message JoinRequest {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ reserved 1, 2, 3, 4, 5, 9, 10; // deprecated JoinRequest fields.+ DLSettings downlink_settings = 6 [(validate.rules).message.required = true];+ RxDelay rx_delay = 7 [(validate.rules).enum.defined_only = true];+ CFList cf_list = 8;+ }+ message JoinAccept {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Payload of the join-accept received from Join Server.+ bytes payload = 1 [(validate.rules).bytes = {+ min_len: 17,+ max_len: 33+ }];+ JoinRequest request = 2 [(validate.rules).message.required = true];+ // Network session keys associated with the join.+ SessionKeys keys = 3 [(validate.rules).message.required = true];+ repeated string correlation_ids = 4 [(validate.rules).repeated.items.string.max_len = 100];+ bytes dev_addr = 5 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ bytes net_id = 6 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ }++ // Queued join-accept.+ // Set each time a (re-)join request accept is received from Join Server and removed each time a downlink is scheduled.+ JoinAccept queued_join_accept = 11;+ // Pending join request.+ // Set each time a join-accept is scheduled and removed each time an uplink is received from the device.+ JoinRequest pending_join_request = 12;+ // Whether or not Rx windows are expected to be open.+ // Set to true every time an uplink is received.+ // Set to false every time a successful downlink scheduling attempt is made.+ bool rx_windows_available = 13;++ // A minimal UplinkMessage definition which is binary compatible with the top level UplinkMessage message.+ // Used for type safe recent uplink storage.+ message UplinkMessage {+ Message payload = 2 [(validate.rules).message.required = true];+ message TxSettings {+ DataRate data_rate = 1 [(validate.rules).message.required = true];+ reserved 2 to 9;+ }+ TxSettings settings = 4 [(validate.rules).message.required = true];+ message RxMetadata {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ float channel_rssi = 9;+ float snr = 11;+ DownlinkPathConstraint downlink_path_constraint = 14 [(validate.rules).enum.defined_only = true];+ bytes uplink_token = 15;+ message PacketBrokerMetadata {+ reserved 1 to 10;+ }+ PacketBrokerMetadata packet_broker = 18;+ message RelayMetadata {+ reserved 1 to 3;+ }+ RelayMetadata relay = 23;+ reserved 2 to 8, 10, 12, 13, 16, 17, 19, 20, 21, 22, 99;+ }+ repeated RxMetadata rx_metadata = 5;+ google.protobuf.Timestamp received_at = 6;+ repeated string correlation_ids = 7 [(validate.rules).repeated.items.string.max_len = 100];+ uint32 device_channel_index = 9 [(validate.rules).uint32 = {lte: 255}];+ reserved 1, 3, 8, 10;+ }++ // A minimal DownlinkMessage definition which is binary compatible with the top level DownlinkMessage message.+ // Used for type safe recent downlink storage.+ message DownlinkMessage {+ message Message {+ message MHDR {+ MType m_type = 1 [(validate.rules).enum.defined_only = true];+ reserved 2;+ }+ MHDR m_hdr = 1 [(validate.rules).message.required = true];+ message MACPayload {+ uint32 f_port = 2 [(validate.rules).uint32.lte = 255];+ uint32 full_f_cnt = 5;+ reserved 1, 3, 4;+ }+ MACPayload mac_payload = 3;+ reserved 2, 4 to 7;+ }+ Message payload = 2;+ repeated string correlation_ids = 6 [(validate.rules).repeated.items.string.max_len = 100];+ reserved 1, 3 to 5, 7;+ }++ // Recent data uplink messages sorted by time.+ // The number of messages stored may depend on configuration.+ repeated UplinkMessage recent_uplinks = 14;+ // Recent data downlink messages sorted by time.+ // The number of messages stored may depend on configuration.+ repeated DownlinkMessage recent_downlinks = 15;++ // Time when the last network-initiated downlink message was scheduled.+ google.protobuf.Timestamp last_network_initiated_downlink_at = 16;++ // ADR Data rate index values rejected by the device.+ // Reset each time `current_parameters.channels` change.+ // Elements are sorted in ascending order.+ repeated DataRateIndex rejected_adr_data_rate_indexes = 17 [(validate.rules).repeated = {+ max_items: 15,+ items {+ enum {defined_only: true}+ }+ }];++ // ADR TX output power index values rejected by the device.+ // Elements are sorted in ascending order.+ repeated uint32 rejected_adr_tx_power_indexes = 18 [(validate.rules).repeated = {+ max_items: 15,+ items {+ uint32 {lte: 15}+ }+ }];++ // Frequencies rejected by the device.+ repeated uint64 rejected_frequencies = 19 [(validate.rules).repeated.items.uint64.gte = 100000];++ // Time when the last downlink message was scheduled.+ google.protobuf.Timestamp last_downlink_at = 20;++ message DataRateRange {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ DataRateIndex min_data_rate_index = 1 [(validate.rules).enum.defined_only = true];+ DataRateIndex max_data_rate_index = 2 [(validate.rules).enum.defined_only = true];+ }+ message DataRateRanges {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ repeated DataRateRange ranges = 1 [(validate.rules).repeated = {min_items: 1}];+ }+ // Data rate ranges rejected by the device per frequency.+ map<uint64, DataRateRanges> rejected_data_rate_ranges = 21;++ // Frame counter of uplink, which confirmed the last ADR parameter change.+ uint32 last_adr_change_f_cnt_up = 22;++ // MAC command identifiers sent by the end device in the last received uplink.+ // The Network Server may choose to store only certain types of MAC+ // command identifiers in the underlying implementation.+ repeated MACCommandIdentifier recent_mac_command_identifiers = 23;++ // Pending relay downlink contents.+ // The pending downlink will be scheduled to the relay in either Rx1 or Rx2.+ // The pending downlink will be cleared after the scheduling attempt.+ RelayForwardDownlinkReq pending_relay_downlink = 24;+}++// Power state of the device.+enum PowerState {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "POWER"+ };+ POWER_UNKNOWN = 0;+ POWER_BATTERY = 1;+ POWER_EXTERNAL = 2;+}++// Authentication code for end devices.+message EndDeviceAuthenticationCode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string value = 1 [(validate.rules).string.pattern = "^[a-zA-Z0-9]{1,32}$"];+ google.protobuf.Timestamp valid_from = 2;+ google.protobuf.Timestamp valid_to = 3;+}++// Defines an End Device registration and its state on the network.+// The persistence of the EndDevice is divided between the Network Server, Application Server and Join Server.+// SDKs are responsible for combining (if desired) the three.+message EndDevice {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ EndDeviceIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];++ // Friendly name of the device. Stored in Entity Registry.+ string name = 4 [(validate.rules).string.max_len = 50];+ // Description of the device. Stored in Entity Registry.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this end device. Typically used for organizing end devices or for storing integration-specific data. Stored in Entity Registry.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Version Identifiers. Stored in Entity Registry, Network Server and Application Server.+ EndDeviceVersionIdentifiers version_ids = 7;++ // Default service profile. Stored in Entity Registry.+ string service_profile_id = 8 [(validate.rules).string.max_len = 64];++ // The address of the Network Server where this device is supposed to be registered.+ // Stored in Entity Registry and Join Server.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string network_server_address = 9 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ // The KEK label of the Network Server to use for wrapping network session keys.+ // Stored in Join Server.+ string network_server_kek_label = 47 [(validate.rules).string.max_len = 2048];+ // The address of the Application Server where this device is supposed to be registered.+ // Stored in Entity Registry and Join Server.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string application_server_address = 10 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ // The KEK label of the Application Server to use for wrapping the application session key.+ // Stored in Join Server.+ string application_server_kek_label = 48 [(validate.rules).string.max_len = 2048];+ // The AS-ID of the Application Server to use.+ // Stored in Join Server.+ string application_server_id = 49 [(validate.rules).string.max_len = 100];+ // The address of the Join Server where this device is supposed to be registered.+ // Stored in Entity Registry.+ // The typical format of the address is "host:port". If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string join_server_address = 11 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];++ // Location of the device. Stored in Entity Registry.+ map<string, Location> locations = 12 [(validate.rules).map.keys.string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];++ // Stored in Entity Registry.+ Picture picture = 50;++ // Whether the device supports class B.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ bool supports_class_b = 13;+ // Whether the device supports class C.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ bool supports_class_c = 14;+ // LoRaWAN MAC version. Stored in Network Server.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ MACVersion lorawan_version = 15 [(validate.rules).enum.defined_only = true];+ // LoRaWAN PHY version. Stored in Network Server.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ PHYVersion lorawan_phy_version = 16 [(validate.rules).enum.defined_only = true];+ // ID of the frequency plan used by this device.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ string frequency_plan_id = 17 [(validate.rules).string.max_len = 64];+ // Minimum frequency the device is capable of using (Hz). Stored in Network Server.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ uint64 min_frequency = 18;+ // Maximum frequency the device is capable of using (Hz). Stored in Network Server.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ uint64 max_frequency = 19;+ // The device supports join (it's OTAA).+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ bool supports_join = 20;+ // Whether the device resets the join and dev nonces (not LoRaWAN compliant). Stored in Join Server.+ // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any.+ bool resets_join_nonces = 21;++ // Device root keys. Stored in Join Server.+ RootKeys root_keys = 22;++ // Home NetID. Stored in Join Server.+ bytes net_id = 23 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ // Settings for how the Network Server handles MAC layer for this device. Stored in Network Server.+ // Mutually exclusive with MAC settings profile.+ MACSettings mac_settings = 24;+ // MAC state of the device. Stored in Network Server.+ MACState mac_state = 25;+ // Pending MAC state of the device. Stored in Network Server.+ MACState pending_mac_state = 44;+ // Current session of the device. Stored in Network Server and Application Server.+ Session session = 26;+ // Pending session. Stored in Network Server and Application Server until RekeyInd is received.+ Session pending_session = 27;++ // Last DevNonce used.+ // This field is only used for devices using LoRaWAN version 1.1 and later.+ // Stored in Join Server.+ uint32 last_dev_nonce = 28;+ // Used DevNonces sorted in ascending order.+ // This field is only used for devices using LoRaWAN versions preceding 1.1.+ // Stored in Join Server.+ repeated uint32 used_dev_nonces = 29;+ // Last JoinNonce/AppNonce(for devices using LoRaWAN versions preceding 1.1) used.+ // Stored in Join Server.+ uint32 last_join_nonce = 30;+ // Last Rejoin counter value used (type 0/2).+ // Stored in Join Server.+ uint32 last_rj_count_0 = 31;+ // Last Rejoin counter value used (type 1).+ // Stored in Join Server.+ uint32 last_rj_count_1 = 32;++ // Time when last DevStatus MAC command was received.+ // Stored in Network Server.+ google.protobuf.Timestamp last_dev_status_received_at = 33;+ // The power state of the device; whether it is battery-powered or connected to an external power source.+ // Received via the DevStatus MAC command at status_received_at.+ // Stored in Network Server.+ PowerState power_state = 34 [+ (validate.rules).enum.defined_only = true,+ (thethings.flags.field) = {set: false}+ ];+ // Latest-known battery percentage of the device.+ // Received via the DevStatus MAC command at last_dev_status_received_at or earlier.+ // Stored in Network Server.+ google.protobuf.FloatValue battery_percentage = 35 [(validate.rules).float = {+ gte: 0,+ lte: 1+ }];+ // Demodulation signal-to-noise ratio (dB).+ // Received via the DevStatus MAC command at last_dev_status_received_at.+ // Stored in Network Server.+ int32 downlink_margin = 36;++ reserved 37; // Deprecated: recent_adr_uplinks+ reserved 38; // Deprecated: recent_uplinks+ reserved 39; // Deprecated: recent_downlinks++ // Queued Application downlink messages. Stored in Application Server,+ // which sets them on the Network Server.+ // This field is deprecated and is always set equal to session.queued_application_downlinks.+ repeated ApplicationDownlink queued_application_downlinks = 40;++ // The payload formatters for this end device. Stored in Application Server.+ // Copied on creation from template identified by version_ids.+ MessagePayloadFormatters formatters = 41;++ // ID of the provisioner. Stored in Join Server.+ string provisioner_id = 42 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Vendor-specific provisioning data. Stored in Join Server.+ google.protobuf.Struct provisioning_data = 43;++ // Indicates whether this device represents a multicast group.+ bool multicast = 45;++ // Authentication code to claim ownership of the end device.+ // From TTS v3.21.0 this field is stored in the Identity Server.+ // For TTS versions < 3.21.0, this field is stored in the Join Server.+ // The value stored on the Identity Server takes precedence.+ EndDeviceAuthenticationCode claim_authentication_code = 46;++ // Skip decryption of uplink payloads and encryption of downlink payloads.+ // This field is deprecated, use skip_payload_crypto_override instead.+ bool skip_payload_crypto = 51;+ // Skip decryption of uplink payloads and encryption of downlink payloads.+ // This field overrides the application-level setting.+ google.protobuf.BoolValue skip_payload_crypto_override = 52;++ // Timestamp when the device has been activated. Stored in the Entity Registry.+ // This field is set by the Application Server when an end device sends+ // its first uplink.+ // The Application Server will use the field in order to avoid repeated+ // calls to the Entity Registry.+ // The field cannot be unset once set.+ google.protobuf.Timestamp activated_at = 53;++ // Timestamp when a device uplink has been last observed.+ // This field is set by the Application Server and stored in the Identity Server.+ google.protobuf.Timestamp last_seen_at = 54;++ string serial_number = 55 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];++ LoRaAllianceProfileIdentifiers lora_alliance_profile_ids = 56;++ reserved 57;+ reserved "label_ids";++ // MAC settings profile identifiers.+ // Mutually exclusive with MAC settings.+ MACSettingsProfileIdentifiers mac_settings_profile_ids = 58;++ // next: 59;+}++message EndDevices {+ repeated EndDevice end_devices = 1;+}++message DevAddrPrefix {+ // DevAddr base.+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ // Number of most significant bits from dev_addr that are used as prefix.+ uint32 length = 2;+}++message CreateEndDeviceRequest {+ EndDevice end_device = 1 [(validate.rules).message.required = true];+}++message UpdateEndDeviceRequest {+ EndDevice end_device = 1 [(validate.rules).message.required = true];+ // The names of the end device fields that should be updated.+ // See the API reference for which fields can be set on the different services.+ google.protobuf.FieldMask field_mask = 2;+}++message BatchUpdateEndDeviceLastSeenRequest {+ message EndDeviceLastSeenUpdate {+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ google.protobuf.Timestamp last_seen_at = 2;+ }++ // The last seen timestamp needs to be set per end device.+ repeated EndDeviceLastSeenUpdate updates = 1;+}++message GetEndDeviceRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ // The names of the end device fields that should be returned.+ // See the API reference for which fields can be returned by the different services.+ google.protobuf.FieldMask field_mask = 2;+}++message GetEndDeviceIdentifiersForEUIsRequest {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message ListEndDevicesRequest {+ ApplicationIdentifiers application_ids = 1;+ // The names of the end device fields that should be returned.+ // See the API reference for which fields can be returned by the different services.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "device_id",+ "-device_id",+ "join_eui",+ "-join_eui",+ "dev_eui",+ "-dev_eui",+ "name",+ "-name",+ "description",+ "-description",+ "created_at",+ "-created_at",+ "last_seen_at",+ "-last_seen_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+ // Filter end devices by fields.+ message Filter {+ oneof field {+ google.protobuf.Timestamp updated_since = 1 [(validate.rules).timestamp.lt_now = true];+ }+ }+ repeated Filter filters = 6;+}++message SetEndDeviceRequest {+ EndDevice end_device = 1 [(validate.rules).message.required = true];+ // The names of the end device fields that should be updated.+ // See the API reference for which fields can be set on the different services.+ google.protobuf.FieldMask field_mask = 2;+}++message ResetAndGetEndDeviceRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ // The names of the end device fields that should be returned.+ // See the API reference for which fields can be returned by the different services.+ google.protobuf.FieldMask field_mask = 2;+}++message EndDeviceTemplate {+ EndDevice end_device = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+ string mapping_key = 3 [(validate.rules).string.max_len = 100];+}++message EndDeviceTemplateFormat {+ string name = 1 [(validate.rules).string.max_len = 100];+ string description = 2 [(validate.rules).string.max_len = 200];+ repeated string file_extensions = 3 [(validate.rules).repeated = {+ max_items: 100,+ unique: true,+ items: {+ string: {pattern: "^(?:\\.[a-z0-9]{1,16}){1,2}$"}+ }+ }];+}++message EndDeviceTemplateFormats {+ map<string, EndDeviceTemplateFormat> formats = 1 [(validate.rules).map.keys.string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message ConvertEndDeviceTemplateRequest {+ // ID of the format.+ string format_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Data to convert.+ bytes data = 2;++ // End device profile identifiers.+ EndDeviceVersionIdentifiers end_device_version_ids = 3;+}++message BatchDeleteEndDevicesRequest {+ ttn.lorawan.v3.ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ repeated string device_ids = 2 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ items: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ }+ }];+}++message BatchGetEndDevicesRequest {+ ttn.lorawan.v3.ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ repeated string device_ids = 2 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ items: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ }+ }];+ // The names of the end device fields that should be returned.+ // This mask is applied on all the end devices in the result.+ // See the API reference for which fields can be returned by the different services.+ google.protobuf.FieldMask field_mask = 3;+ reserved 4;+ reserved "order";+ reserved 5;+ reserved "limit";+ reserved 6;+ reserved "page";+}++message BatchSetMACSettingsProfileRequest {+ ttn.lorawan.v3.ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ MACSettingsProfileIdentifiers mac_settings_profile_ids = 2;+ repeated string device_ids = 3 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ items: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ }+ }];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/end_device_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/end_device_services.protonew file mode 100644index 000000000..695a494d1--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/end_device_services.proto@@ -0,0 +1,140 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The EndDeviceRegistry service, exposed by the Identity Server, is used to manage+// end device registrations.+//+// After registering an end device, it also needs to be registered in+// the NsEndDeviceRegistry that is exposed by the Network Server,+// the AsEndDeviceRegistry that is exposed by the Application Server,+// and the JsEndDeviceRegistry that is exposed by the Join Server.+//+// Before deleting an end device it first needs to be deleted from the+// NsEndDeviceRegistry, the AsEndDeviceRegistry and the JsEndDeviceRegistry.+service EndDeviceRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage end devices on The Things Stack Identity Server."};+ // Create a new end device within an application.+ //+ // After registering an end device, it also needs to be registered in+ // the NsEndDeviceRegistry that is exposed by the Network Server,+ // the AsEndDeviceRegistry that is exposed by the Application Server,+ // and the JsEndDeviceRegistry that is exposed by the Join Server.+ rpc Create(CreateEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ post: "/applications/{end_device.ids.application_ids.application_id}/devices"+ body: "*"+ };+ }++ // Get the end device with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc Get(GetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {get: "/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"};+ }++ // Get the identifiers of the end device that has the given EUIs registered.+ rpc GetIdentifiersForEUIs(GetEndDeviceIdentifiersForEUIsRequest) returns (EndDeviceIdentifiers);++ // List end devices in the given application.+ // Similar to Get, this selects the fields given by the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc List(ListEndDevicesRequest) returns (EndDevices) {+ option (google.api.http) = {+ get: "/applications/{application_ids.application_id}/devices"+ additional_bindings {+ post: "/applications/{application_ids.application_id}/devices/filter"+ body: "*"+ }+ };+ }++ // Update the end device, changing the fields specified by the field mask to the provided values.+ rpc Update(UpdateEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ put: "/applications/{end_device.ids.application_ids.application_id}/devices/{end_device.ids.device_id}"+ body: "*"+ };+ }++ // Update the last seen timestamp for a batch of end devices.+ rpc BatchUpdateLastSeen(BatchUpdateEndDeviceLastSeenRequest) returns (google.protobuf.Empty);++ // Delete the end device with the given IDs.+ //+ // Before deleting an end device it first needs to be deleted from the+ // NsEndDeviceRegistry, the AsEndDeviceRegistry and the JsEndDeviceRegistry.+ // In addition, if the device claimed on a Join Server, it also needs to be+ // unclaimed via the DeviceClaimingServer so it can be claimed in the future.+ // This is NOT done automatically.+ rpc Delete(EndDeviceIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/applications/{application_ids.application_id}/devices/{device_id}"};+ }+}++// The EndDeviceTemplateRegistry service is used to convert end devices information between formats.+service EndDeviceTemplateConverter {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Convert end device information between supported formats."};+ // Returns the configured formats to convert from.+ rpc ListFormats(google.protobuf.Empty) returns (EndDeviceTemplateFormats) {+ option (google.api.http) = {get: "/edtc/formats"};+ }++ // Converts the binary data to a stream of end device templates.+ rpc Convert(ConvertEndDeviceTemplateRequest) returns (stream EndDeviceTemplate) {+ option (google.api.http) = {+ post: "/edtc/convert",+ body: "*"+ };+ }+}++// The EndDeviceBatchRegistry service, exposed by the Identity Server, is used to manage+// end device registrations in batches.+service EndDeviceBatchRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage end devices on The Things Stack Identity Server in batches."};+ // Get a batch of end devices with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ // Devices not found are skipped and no error is returned.+ rpc Get(BatchGetEndDevicesRequest) returns (ttn.lorawan.v3.EndDevices) {+ option (google.api.http) = {get: "/applications/{application_ids.application_id}/devices/batch"};+ }++ // Delete a batch of end devices with the given IDs.+ //+ // This operation is atomic; either all devices are deleted or none.+ // Devices not found are skipped and no error is returned.+ // Before calling this RPC, use the corresponding BatchDelete RPCs+ // of NsEndDeviceRegistry, AsEndDeviceRegistry and+ // optionally the JsEndDeviceRegistry to delete the end devices.+ // If the devices were claimed on a Join Server, use the BatchUnclaim RPC+ // of the DeviceClaimingServer.+ // This is NOT done automatically.+ rpc Delete(BatchDeleteEndDevicesRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/applications/{application_ids.application_id}/devices/batch"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/enums.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/enums.protonew file mode 100644index 000000000..17614818c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/enums.proto@@ -0,0 +1,71 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "thethings/json/annotations.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++enum DownlinkPathConstraint {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "DOWNLINK_PATH_CONSTRAINT"+ };++ // Indicates that the gateway can be selected for downlink without constraints by the Network Server.+ DOWNLINK_PATH_CONSTRAINT_NONE = 0;+ // Indicates that the gateway can be selected for downlink only if no other or better gateway can be selected.+ DOWNLINK_PATH_CONSTRAINT_PREFER_OTHER = 1;+ // Indicates that this gateway will never be selected for downlink, even if that results in no available downlink path.+ DOWNLINK_PATH_CONSTRAINT_NEVER = 2;+}++// State enum defines states that an entity can be in.+enum State {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "STATE"+ };++ // Denotes that the entity has been requested and is pending review by an admin.+ STATE_REQUESTED = 0;+ // Denotes that the entity has been reviewed and approved by an admin.+ STATE_APPROVED = 1;+ // Denotes that the entity has been reviewed and rejected by an admin.+ STATE_REJECTED = 2;+ // Denotes that the entity has been flagged and is pending review by an admin.+ STATE_FLAGGED = 3;+ // Denotes that the entity has been reviewed and suspended by an admin.+ STATE_SUSPENDED = 4;+}++enum ClusterRole {+ NONE = 0;+ ENTITY_REGISTRY = 1;+ ACCESS = 2;+ GATEWAY_SERVER = 3;+ NETWORK_SERVER = 4;+ APPLICATION_SERVER = 5;+ JOIN_SERVER = 6;+ CRYPTO_SERVER = 7;+ DEVICE_TEMPLATE_CONVERTER = 8;+ DEVICE_CLAIMING_SERVER = 9;+ GATEWAY_CONFIGURATION_SERVER = 10;+ QR_CODE_GENERATOR = 11;+ PACKET_BROKER_AGENT = 12;+ DEVICE_REPOSITORY = 13;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/error.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/error.protonew file mode 100644index 000000000..b892243d9--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/error.proto@@ -0,0 +1,51 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/any.proto";+import "google/protobuf/struct.proto";+import "thethings/flags/annotations.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Error details that are communicated over gRPC (and HTTP) APIs.+// The messages (for translation) are stored as "error:<namespace>:<name>".+message ErrorDetails {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ // Namespace of the error (typically the package name in The Things Stack).+ string namespace = 1;+ // Name of the error.+ string name = 2;+ // The default (fallback) message format that should be used for the error.+ // This is also used if the client does not have a translation for the error.+ string message_format = 3;+ // Attributes that should be filled into the message format. Any extra attributes+ // can be displayed as error details.+ google.protobuf.Struct attributes = 4;+ // The correlation ID of the error can be used to correlate the error to stack+ // traces the network may (or may not) store about recent errors.+ string correlation_id = 5;+ // The error that caused this error.+ ErrorDetails cause = 6 [(thethings.flags.field) = {select: false}];+ // The status code of the error.+ uint32 code = 7;+ // The details of the error.+ repeated google.protobuf.Any details = 8;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/events.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/events.protonew file mode 100644index 000000000..ffea2d1d8--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/events.proto@@ -0,0 +1,106 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/any.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message Event {+ // Name of the event. This can be used to find the (localized) event description.+ string name = 1;+ // Time at which the event was triggered.+ google.protobuf.Timestamp time = 2 [(validate.rules).timestamp.required = true];+ // Identifiers of the entity (or entities) involved.+ repeated EntityIdentifiers identifiers = 3;+ // Optional data attached to the event.+ google.protobuf.Any data = 4;+ // Correlation IDs can be used to find related events and actions such as API calls.+ repeated string correlation_ids = 5 [(validate.rules).repeated.items.string.max_len = 100];+ // The origin of the event. Typically the hostname of the server that created it.+ string origin = 6;+ // Event context, internal use only.+ map<string, bytes> context = 7;+ // The event will be visible to a caller that has any of these rights.+ Rights visibility = 8;+ message Authentication {+ // The type of authentication that was used. This is typically a bearer token.+ string type = 1;+ // The type of token that was used. Common types are APIKey, AccessToken and SessionToken.+ string token_type = 2;+ // The ID of the token that was used.+ string token_id = 3;+ }+ // Details on the authentication provided by the caller that triggered this event.+ Authentication authentication = 9;+ // The IP address of the caller that triggered this event.+ string remote_ip = 10;+ // The IP address of the caller that triggered this event.+ string user_agent = 11;+ // The unique identifier of the event, assigned on creation.+ string unique_id = 12;+}++message StreamEventsRequest {+ repeated EntityIdentifiers identifiers = 1;+ // If greater than zero, this will return historical events, up to this maximum when the stream starts.+ // If used in combination with "after", the limit that is reached first, is used.+ // The availability of historical events depends on server support and retention policy.+ uint32 tail = 2;+ // If not empty, this will return historical events after the given time when the stream starts.+ // If used in combination with "tail", the limit that is reached first, is used.+ // The availability of historical events depends on server support and retention policy.+ google.protobuf.Timestamp after = 3;+ // If provided, this will filter events, so that only events with the given names are returned.+ // Names can be provided as either exact event names (e.g. 'gs.up.receive'),+ // or as regular expressions (e.g. '/^gs\..+/').+ repeated string names = 4;+}++message FindRelatedEventsRequest {+ string correlation_id = 1 [(validate.rules).string = {+ min_len: 1,+ max_len: 100,+ }];+}++message FindRelatedEventsResponse {+ repeated Event events = 1;+}++// The Events service serves events from the cluster.+service Events {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Read events served from a The Things Stack cluster."};+ // Stream live events, optionally with a tail of historical events (depending on server support and retention policy).+ // Events may arrive out-of-order.+ rpc Stream(StreamEventsRequest) returns (stream Event) {+ option (google.api.http) = {+ post: "/events"+ body: "*"+ };+ }++ rpc FindRelated(FindRelatedEventsRequest) returns (FindRelatedEventsResponse) {+ option (google.api.http) = {get: "/events/related"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/gateway.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway.protonew file mode 100644index 000000000..5005b0bbc--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway.proto@@ -0,0 +1,825 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/duration.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/metadata.proto";+import "ttn/lorawan/v3/rights.proto";+import "ttn/lorawan/v3/secrets.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message GatewayBrand {+ string id = 1;+ string name = 2;+ string url = 3;+ // Logos contains file names of brand logos.+ repeated string logos = 4;+}++message GatewayModel {+ string brand_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string name = 3;+}++// Identifies an end device model with version information.+message GatewayVersionIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string brand_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string model_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string hardware_version = 3 [(validate.rules).string.max_len = 32];+ string firmware_version = 4 [(validate.rules).string.max_len = 32];+ string runtime_version = 5 [(validate.rules).string.max_len = 32];+}++message GatewayRadio {+ bool enable = 1;+ string chip_type = 2;+ uint64 frequency = 3;+ float rssi_offset = 4;++ message TxConfiguration {+ uint64 min_frequency = 1;+ uint64 max_frequency = 2;+ uint64 notch_frequency = 3;+ }+ TxConfiguration tx_configuration = 5;+}++// Authentication code for claiming gateways.+message GatewayClaimAuthenticationCode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ Secret secret = 1;+ google.protobuf.Timestamp valid_from = 2;+ google.protobuf.Timestamp valid_to = 3;+}++// Gateway is the message that defines a gateway on the network.+message Gateway {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The identifiers of the gateway. These are public and can be seen by any authenticated user in the network.+ GatewayIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // When the gateway was created. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the gateway was last updated. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the gateway was deleted. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp deleted_at = 26 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // The name of the gateway. This information is public and can be seen by any authenticated user in the network.+ string name = 4 [(validate.rules).string.max_len = 50];+ // A description for the gateway. This information is public and can be seen by any authenticated user in the network.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this gateway. Typically used for organizing gateways or for storing integration-specific data.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Contact information for this gateway. Typically used to indicate who to contact with technical/security questions about the gateway.+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];++ OrganizationOrUserIdentifiers administrative_contact = 30;+ OrganizationOrUserIdentifiers technical_contact = 31;++ GatewayVersionIdentifiers version_ids = 8;++ // The address of the Gateway Server to connect to.+ // This information is public and can be seen by any authenticated user in the network if status_public is true.+ // The typical format of the address is "scheme://host:port". The scheme is optional. If the port is omitted,+ // the normal port inference (with DNS lookup, otherwise defaults) is used.+ // The connection shall be established with transport layer security (TLS).+ // Custom certificate authorities may be configured out-of-band.+ string gateway_server_address = 9 [(validate.rules).string.pattern = "^([a-z]{2,5}://)?(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ bool auto_update = 10;+ string update_channel = 11 [(validate.rules).string.max_len = 128];++ // Frequency plan ID of the gateway.+ // This information is public and can be seen by any authenticated user in the network.+ // DEPRECATED: use frequency_plan_ids.+ // This equals the first element of the frequency_plan_ids field.+ string frequency_plan_id = 12 [(validate.rules).string.max_len = 64];++ // Frequency plan IDs of the gateway.+ // This information is public and can be seen by any authenticated user in the network.+ // The first element equals the frequency_plan_id field.+ repeated string frequency_plan_ids = 20 [(validate.rules).repeated = {+ max_items: 8,+ items: {+ string: {max_len: 64}+ }+ }];++ // Antennas of the gateway. Location information of the antennas is public and can be seen by any authenticated user in the network if location_public=true.+ repeated GatewayAntenna antennas = 13 [(validate.rules).repeated.max_items = 8];+ // The status of this gateway may be publicly displayed.+ bool status_public = 14;+ // The location of this gateway may be publicly displayed.+ bool location_public = 15;+ // Enable server-side buffering of downlink messages. This is recommended for gateways using the Semtech UDP Packet+ // Forwarder v2.x or older, as it does not feature a just-in-time queue. If enabled, the Gateway Server schedules the+ // downlink message late to the gateway so that it does not overwrite previously scheduled downlink messages that have+ // not been transmitted yet.+ bool schedule_downlink_late = 16;+ // Enforcing gateway duty cycle is recommended for all gateways to respect spectrum regulations. Disable enforcing the+ // duty cycle only in controlled research and development environments.+ bool enforce_duty_cycle = 17;+ DownlinkPathConstraint downlink_path_constraint = 18 [(validate.rules).enum.defined_only = true];+ // Adjust the time that GS schedules class C messages in advance. This is useful for gateways that have a known high latency backhaul, like 3G and satellite.+ google.protobuf.Duration schedule_anytime_delay = 19;+ // Update the location of this gateway from status messages. This only works for gateways connecting with authentication; gateways connected over UDP are not supported.+ bool update_location_from_status = 21;+ // The LoRa Basics Station LNS secret.+ // This is either an auth token (such as an API Key) or a TLS private certificate.+ // Requires the RIGHT_GATEWAY_READ_SECRETS for reading and RIGHT_GATEWAY_WRITE_SECRETS for updating this value.+ Secret lbs_lns_secret = 22;+ // The authentication code for gateway claiming.+ // Requires the RIGHT_GATEWAY_READ_SECRETS for reading and RIGHT_GATEWAY_WRITE_SECRETS for updating this value.+ // The entire field must be used in RPCs since sub-fields are validated wrt to each other. Direct selection/update of sub-fields only are not allowed.+ // Use the top level field mask `claim_authentication_code` even when updating single fields.+ GatewayClaimAuthenticationCode claim_authentication_code = 23;+ // CUPS URI for LoRa Basics Station CUPS redirection.+ // The CUPS Trust field will be automatically fetched from the cert chain presented by the target server.+ string target_cups_uri = 24 [(validate.rules).string = {+ uri: true,+ ignore_empty: true+ }];+ // CUPS Key for LoRa Basics Station CUPS redirection.+ // If redirecting to another instance of TTS, use the CUPS API Key for the gateway on the target instance.+ // Requires the RIGHT_GATEWAY_READ_SECRETS for reading and RIGHT_GATEWAY_WRITE_SECRETS for updating this value.+ Secret target_cups_key = 25;+ // Require an authenticated gateway connection. This prevents the gateway from using the UDP protocol and requires authentication when using other protocols.+ bool require_authenticated_connection = 27;++ // LR-FHSS gateway capabilities.+ message LRFHSS {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The gateway supports the LR-FHSS uplink channels.+ bool supported = 1;+ }++ LRFHSS lrfhss = 28;++ bool disable_packet_broker_forwarding = 29;++ reserved 33;+ reserved "label_ids";++ // next: 34+}++message Gateways {+ repeated Gateway gateways = 1;+}++message ManagedGateway {+ option (thethings.flags.message) = {+ select: true+ set: true+ };+ GatewayIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false+ hidden: true+ }+ ];+ GatewayVersionIdentifiers version_ids = 2;++ string cellular_imei = 3 [(validate.rules).string = {+ pattern: "^[0-9]{15}$"+ ignore_empty: true+ }];+ string cellular_imsi = 4 [(validate.rules).string = {+ pattern: "^[0-9]{15}$"+ ignore_empty: true+ }];+ bytes wifi_mac_address = 5 [+ (validate.rules).bytes = {+ len: 6+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal6Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"EC656E000100\""+ }+ ];+ bytes ethernet_mac_address = 6 [+ (validate.rules).bytes = {+ len: 6+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal6Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"EC656E000100\""+ }+ ];++ string wifi_profile_id = 7 [(validate.rules).string = {+ uuid: true,+ ignore_empty: true+ }];+ string ethernet_profile_id = 8 [(validate.rules).string = {+ uuid: true,+ ignore_empty: true+ }];+}++message ManagedGatewayWiFiAccessPoint {+ string ssid = 1 [(validate.rules).string = {max_len: 32}];+ bytes bssid = 2 [+ (validate.rules).bytes = {len: 6},+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal6Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"EC656E000100\""+ }+ ];+ uint32 channel = 3 [(validate.rules).uint32 = {gte: 1}];+ string authentication_mode = 4;+ float rssi = 5;+}++message ManagedGatewayWiFiAccessPoints {+ repeated ManagedGatewayWiFiAccessPoint access_points = 1;+}++enum ManagedGatewayNetworkInterfaceType {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "MANAGED_GATEWAY_NETWORK_INTERFACE_TYPE"+ };++ MANAGED_GATEWAY_NETWORK_INTERFACE_TYPE_UNSPECIFIED = 0;+ MANAGED_GATEWAY_NETWORK_INTERFACE_TYPE_CELLULAR = 1;+ MANAGED_GATEWAY_NETWORK_INTERFACE_TYPE_WIFI = 2;+ MANAGED_GATEWAY_NETWORK_INTERFACE_TYPE_ETHERNET = 3;+}++enum ManagedGatewayNetworkInterfaceStatus {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "MANAGED_GATEWAY_NETWORK_INTERFACE_STATUS"+ };++ MANAGED_GATEWAY_NETWORK_INTERFACE_STATUS_UNSPECIFIED = 0;+ MANAGED_GATEWAY_NETWORK_INTERFACE_STATUS_DOWN = 1;+ MANAGED_GATEWAY_NETWORK_INTERFACE_STATUS_UP = 2;+ MANAGED_GATEWAY_NETWORK_INTERFACE_STATUS_FAILED = 3;+}++message ManagedGatewayNetworkInterfaceAddresses {+ repeated string ip_addresses = 1 [+ (validate.rules).repeated = {+ max_items: 2,+ items: {+ string: {ip: true}+ }+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "[\"192.0.2.0\",\"2001:db8::1\"]"+ }+ ];+ string subnet_mask = 2 [+ (validate.rules).string = {+ ipv4: true+ ignore_empty: true+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"192.0.2.0\""+ }+ ];+ string gateway = 3 [+ (validate.rules).string = {+ ipv4: true+ ignore_empty: true+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"192.0.2.0\""+ }+ ];+ repeated string dns_servers = 4 [+ (validate.rules).repeated = {+ max_items: 2,+ items: {+ string: {ipv4: true}+ }+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "[\"192.0.2.0\",\"192.0.2.1\"]"+ }+ ];+}++message ManagedGatewaySystemStatus {+ // CPU temperature (Celsius).+ google.protobuf.FloatValue cpu_temperature = 1;+}++message ManagedGatewayControllerConnection {+ ManagedGatewayNetworkInterfaceType network_interface_type = 1 [(validate.rules).enum.defined_only = true];+}++message ManagedGatewayGatewayServerConnection {+ ManagedGatewayNetworkInterfaceType network_interface_type = 1 [(validate.rules).enum.defined_only = true];+ string address = 2;+}++message ManagedGatewayNetworkInterfaceInfo {+ ManagedGatewayNetworkInterfaceStatus status = 1 [(validate.rules).enum.defined_only = true];+ bool dhcp_enabled = 2;+ ManagedGatewayNetworkInterfaceAddresses addresses = 3;+}++message ManagedGatewayCellularBackhaul {+ ManagedGatewayNetworkInterfaceInfo network_interface = 1;+ string operator = 2 [(validate.rules).string.max_len = 32];+ google.protobuf.FloatValue rssi = 3;+}++message ManagedGatewayWiFiBackhaul {+ ManagedGatewayNetworkInterfaceInfo network_interface = 1;+ string ssid = 2 [(validate.rules).string.max_len = 32];+ bytes bssid = 3 [+ (validate.rules).bytes = {len: 6},+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal6Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"EC656E000100\""+ }+ ];+ uint32 channel = 4 [(validate.rules).uint32 = {gte: 1}];+ string authentication_mode = 5;+ google.protobuf.FloatValue rssi = 6;+}++message ManagedGatewayEthernetBackhaul {+ ManagedGatewayNetworkInterfaceInfo network_interface = 1;+}++message ManagedGatewayEventData {+ oneof data {+ ManagedGateway entity = 1;+ Location location = 2;+ ManagedGatewaySystemStatus system_status = 3;+ ManagedGatewayControllerConnection controller_connection = 4;+ ManagedGatewayGatewayServerConnection gateway_server_connection = 5;+ ManagedGatewayCellularBackhaul cellular_backhaul = 6;+ ManagedGatewayWiFiBackhaul wifi_backhaul = 7;+ ManagedGatewayEthernetBackhaul ethernet_backhaul = 8;+ }+}++message ManagedGatewayWiFiProfile {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string profile_id = 1 [(validate.rules).string = {+ uuid: true+ ignore_empty: true+ }];+ string profile_name = 2 [(validate.rules).string = {max_len: 32}];+ bool shared = 6;+ string ssid = 3 [(validate.rules).string = {max_len: 32}];+ string password = 4 [(validate.rules).string.max_len = 64];+ ManagedGatewayNetworkInterfaceAddresses network_interface_addresses = 5;+}++message ManagedGatewayWiFiProfiles {+ repeated ManagedGatewayWiFiProfile profiles = 1;+}++message ManagedGatewayEthernetProfile {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string profile_id = 1 [(validate.rules).string = {+ uuid: true+ ignore_empty: true+ }];+ string profile_name = 2 [(validate.rules).string = {max_len: 32}];+ bool shared = 4;+ ManagedGatewayNetworkInterfaceAddresses network_interface_addresses = 3;+}++message ManagedGatewayEthernetProfiles {+ repeated ManagedGatewayEthernetProfile profiles = 1;+}++message GetGatewayRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message GetGatewayIdentifiersForEUIRequest {+ bytes eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message ListGatewaysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // By default we list all gateways the caller has rights on.+ // Set the user or the organization (not both) to instead list the gateways+ // where the user or organization is collaborator on.+ OrganizationOrUserIdentifiers collaborator = 1 [(thethings.flags.field) = {hidden: true}];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "gateway_id",+ "-gateway_id",+ "gateway_eui",+ "-gateway_eui",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+ // Only return recently deleted gateways.+ bool deleted = 6;+ // Filter gateways by fields.+ message Filter {+ oneof field {+ google.protobuf.Timestamp updated_since = 1 [(validate.rules).timestamp.lt_now = true];+ }+ }+ repeated Filter filters = 7;+}++message CreateGatewayRequest {+ Gateway gateway = 1 [(validate.rules).message.required = true];+ // Collaborator to grant all rights on the newly created gateway.+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateGatewayRequest {+ Gateway gateway = 1 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message ListGatewayAPIKeysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path.+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "api_key_id",+ "-api_key_id",+ "name",+ "-name",+ "created_at",+ "-created_at",+ "expires_at",+ "-expires_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+}++message GetGatewayAPIKeyRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ // Unique public identifier for the API key.+ string key_id = 2;+}++message CreateGatewayAPIKeyRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ string name = 2 [(validate.rules).string.max_len = 50];+ repeated Right rights = 3 [(validate.rules).repeated = {+ min_items: 1,+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+ google.protobuf.Timestamp expires_at = 4 [(validate.rules).timestamp.gt_now = true];+}++message UpdateGatewayAPIKeyRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ APIKey api_key = 2 [(validate.rules).message.required = true];+ // The names of the api key fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteGatewayAPIKeyRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ string key_id = 2;+}++message ListGatewayCollaboratorsRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "id",+ "-id",+ "-rights",+ "rights"+ ]+ }];+}++message GetGatewayCollaboratorRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message SetGatewayCollaboratorRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ Collaborator collaborator = 2 [(validate.rules).message.required = true];+}++message DeleteGatewayCollaboratorRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator_ids = 2 [(validate.rules).message.required = true];+}++enum GatewayAntennaPlacement {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "PLACEMENT"+ };+ PLACEMENT_UNKNOWN = 0;+ INDOOR = 1;+ OUTDOOR = 2;+}++// GatewayAntenna is the message that defines a gateway antenna.+message GatewayAntenna {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Antenna gain relative to the gateway, in dBi.+ float gain = 1;+ // location is the antenna's location.+ Location location = 2;+ map<string, string> attributes = 3 [+ deprecated = true,+ (validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }+ ];+ GatewayAntennaPlacement placement = 4;+}++message GatewayStatus {+ // Current time of the gateway+ google.protobuf.Timestamp time = 1;+ // Boot time of the gateway+ // - can be left out to save bandwidth; old value will be kept+ google.protobuf.Timestamp boot_time = 2;+ // Versions of gateway subsystems+ // - each field can be left out to save bandwidth; old value will be kept+ // - map keys are written in snake_case+ // - for example:+ // firmware: "2.0.4"+ // forwarder: "v2-3.3.1"+ // fpga: "48"+ // dsp: "27"+ // hal: "v2-3.5.0"+ map<string, string> versions = 3 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[_-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 128}+ }+ }];+ // Location of each gateway's antenna+ // - if left out, server uses registry-set location as fallback+ repeated Location antenna_locations = 4 [(validate.rules).repeated.max_items = 8];+ // IP addresses of this gateway.+ // Repeated addresses can be used to communicate addresses of multiple interfaces (LAN, Public IP, ...).+ repeated string ip = 5 [(validate.rules).repeated = {+ max_items: 10,+ items: {+ string: {ip: true}+ }+ }];+ // Metrics+ // - can be used for forwarding gateway metrics such as temperatures or performance metrics+ // - map keys are written in snake_case+ map<string, float> metrics = 6 [(validate.rules).map = {+ max_pairs: 32,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[_-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ }];+ // Advanced metadata fields+ // - can be used for advanced information or experimental features that are not yet formally defined in the API+ // - field names are written in snake_case+ google.protobuf.Struct advanced = 99;+}++// Remote Address of the Gateway, as seen by the Gateway Server.+message GatewayRemoteAddress {+ string ip = 1; // IPv4 or IPv6 address.+}++// Connection stats as monitored by the Gateway Server.+message GatewayConnectionStats {+ google.protobuf.Timestamp connected_at = 1;+ google.protobuf.Timestamp disconnected_at = 11;+ string protocol = 2; // Protocol used to connect (for example, udp, mqtt, grpc)+ google.protobuf.Timestamp last_status_received_at = 3;+ GatewayStatus last_status = 4;+ google.protobuf.Timestamp last_uplink_received_at = 5;+ uint64 uplink_count = 6;+ google.protobuf.Timestamp last_downlink_received_at = 7;+ uint64 downlink_count = 8;+ google.protobuf.Timestamp last_tx_acknowledgment_received_at = 13;+ uint64 tx_acknowledgment_count = 14;++ message RoundTripTimes {+ google.protobuf.Duration min = 1 [(validate.rules).duration.required = true];+ google.protobuf.Duration max = 2 [(validate.rules).duration.required = true];+ google.protobuf.Duration median = 3 [(validate.rules).duration.required = true];+ uint32 count = 4;+ }+ RoundTripTimes round_trip_times = 9;++ message SubBand {+ uint64 min_frequency = 1;+ uint64 max_frequency = 2;+ // Duty-cycle limit of the sub-band as a fraction of time.+ float downlink_utilization_limit = 3;+ // Utilization rate of the available duty-cycle. This value should not exceed downlink_utilization_limit.+ float downlink_utilization = 4;+ }+ // Statistics for each sub band.+ repeated SubBand sub_bands = 10;++ // Gateway Remote Address.+ GatewayRemoteAddress gateway_remote_address = 12;++ // next: 13+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_configuration.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_configuration.protonew file mode 100644index 000000000..e56994871--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_configuration.proto@@ -0,0 +1,272 @@+// Copyright © 2022 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/gateway.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message GetGatewayConfigurationRequest {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ string format = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"+ max_len: 36+ }];+ string type = 3 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"+ max_len: 36+ }];+ string filename = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-._]?[a-z0-9]){2,}$|^$"+ max_len: 36+ }];+}++message GetGatewayConfigurationResponse {+ bytes contents = 1;+}++// The GatewayConfigurationService fetches the configuration of a gateway.+service GatewayConfigurationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Fetch configuration for gateways."};+ rpc GetGatewayConfiguration(GetGatewayConfigurationRequest) returns (GetGatewayConfigurationResponse) {+ option (google.api.http) = {+ additional_bindings: {get: "/gcs/gateways/configuration/{gateway_ids.gateway_id}/{format}/{filename}"}+ additional_bindings: {get: "/gcs/gateways/configuration/{gateway_ids.gateway_id}/{format}/{type}/{filename}"}+ };+ }+}++message UpdateManagedGatewayRequest {+ ManagedGateway gateway = 1 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message CreateManagedGatewayWiFiProfileRequest {+ ManagedGatewayWiFiProfile profile = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateManagedGatewayWiFiProfileRequest {+ ManagedGatewayWiFiProfile profile = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message ListManagedGatewayWiFiProfilesRequest {+ option (thethings.flags.message) = {+ select: false+ set: true+ };+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+}++message GetManagedGatewayWiFiProfileRequest {+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ string profile_id = 2 [(validate.rules).string.uuid = true];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteManagedGatewayWiFiProfileRequest {+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ string profile_id = 2 [(validate.rules).string.uuid = true];+}++message CreateManagedGatewayEthernetProfileRequest {+ ManagedGatewayEthernetProfile profile = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateManagedGatewayEthernetProfileRequest {+ ManagedGatewayEthernetProfile profile = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message ListManagedGatewayEthernetProfilesRequest {+ option (thethings.flags.message) = {+ select: false+ set: true+ };+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+}++message GetManagedGatewayEthernetProfileRequest {+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ string profile_id = 2 [(validate.rules).string.uuid = true];+ // The names of the gateway fields that should be returned.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteManagedGatewayEthernetProfileRequest {+ OrganizationOrUserIdentifiers collaborator = 1 [(validate.rules).message.required = true];+ string profile_id = 2 [(validate.rules).string.uuid = true];+}++service ManagedGatewayConfigurationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Configure managed gateways."};++ rpc Get(GetGatewayRequest) returns (ManagedGateway) {+ option (google.api.http) = {get: "/gcs/gateways/managed/{gateway_ids.gateway_id}"};+ }++ rpc Update(UpdateManagedGatewayRequest) returns (ManagedGateway) {+ option (google.api.http) = {+ put: "/gcs/gateways/managed/{gateway.ids.gateway_id}"+ body: "*"+ };+ }++ rpc StreamEvents(GatewayIdentifiers) returns (stream ManagedGatewayEventData) {+ option (google.api.http) = {+ post: "/gcs/gateways/managed/{gateway_id}/events"+ body: "*"+ };+ }++ rpc ScanWiFiAccessPoints(GatewayIdentifiers) returns (ManagedGatewayWiFiAccessPoints) {+ option (google.api.http) = {+ post: "/gcs/gateways/managed/{gateway_id}/wifi/scan"+ body: "*"+ };+ }+}++service ManagedGatewayWiFiProfileConfigurationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Configure WiFi profiles for managed gateways."};++ rpc Create(CreateManagedGatewayWiFiProfileRequest) returns (ManagedGatewayWiFiProfile) {+ option (google.api.http) = {+ additional_bindings: {+ post: "/gcs/gateways/profiles/wifi/organizations/{collaborator.organization_ids.organization_id}"+ body: "*"+ }+ additional_bindings: {+ post: "/gcs/gateways/profiles/wifi/users/{collaborator.user_ids.user_id}"+ body: "*"+ }+ };+ }++ rpc Update(UpdateManagedGatewayWiFiProfileRequest) returns (ManagedGatewayWiFiProfile) {+ option (google.api.http) = {+ additional_bindings: {+ put: "/gcs/gateways/profiles/wifi/organizations/{collaborator.organization_ids.organization_id}/{profile.profile_id}"+ body: "*"+ }+ additional_bindings: {+ put: "/gcs/gateways/profiles/wifi/users/{collaborator.user_ids.user_id}/{profile.profile_id}"+ body: "*"+ }+ };+ }++ rpc List(ListManagedGatewayWiFiProfilesRequest) returns (ManagedGatewayWiFiProfiles) {+ option (google.api.http) = {+ additional_bindings: {get: "/gcs/gateways/profiles/wifi/organizations/{collaborator.organization_ids.organization_id}"}+ additional_bindings: {get: "/gcs/gateways/profiles/wifi/users/{collaborator.user_ids.user_id}"}+ };+ }++ rpc Get(GetManagedGatewayWiFiProfileRequest) returns (ManagedGatewayWiFiProfile) {+ option (google.api.http) = {+ additional_bindings: {get: "/gcs/gateways/profiles/wifi/organizations/{collaborator.organization_ids.organization_id}/{profile_id}"}+ additional_bindings: {get: "/gcs/gateways/profiles/wifi/users/{collaborator.user_ids.user_id}/{profile_id}"}+ };+ }++ rpc Delete(DeleteManagedGatewayWiFiProfileRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ additional_bindings: {delete: "/gcs/gateways/profiles/wifi/organizations/{collaborator.organization_ids.organization_id}/{profile_id}"}+ additional_bindings: {delete: "/gcs/gateways/profiles/wifi/users/{collaborator.user_ids.user_id}/{profile_id}"}+ };+ }+}++service ManagedGatewayEthernetProfileConfigurationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Configure Ethernet profiles for managed gateways."};++ rpc Create(CreateManagedGatewayEthernetProfileRequest) returns (ManagedGatewayEthernetProfile) {+ option (google.api.http) = {+ additional_bindings: {+ post: "/gcs/gateways/profiles/ethernet/organizations/{collaborator.organization_ids.organization_id}"+ body: "*"+ }+ additional_bindings: {+ post: "/gcs/gateways/profiles/ethernet/users/{collaborator.user_ids.user_id}"+ body: "*"+ }+ };+ }++ rpc Update(UpdateManagedGatewayEthernetProfileRequest) returns (ManagedGatewayEthernetProfile) {+ option (google.api.http) = {+ additional_bindings: {+ put: "/gcs/gateways/profiles/ethernet/organizations/{collaborator.organization_ids.organization_id}/{profile.profile_id}"+ body: "*"+ }+ additional_bindings: {+ put: "/gcs/gateways/profiles/ethernet/users/{collaborator.user_ids.user_id}/{profile.profile_id}"+ body: "*"+ }+ };+ }++ rpc List(ListManagedGatewayEthernetProfilesRequest) returns (ManagedGatewayEthernetProfiles) {+ option (google.api.http) = {+ additional_bindings: {get: "/gcs/gateways/profiles/ethernet/organizations/{collaborator.organization_ids.organization_id}"}+ additional_bindings: {get: "/gcs/gateways/profiles/ethernet/users/{collaborator.user_ids.user_id}"}+ };+ }++ rpc Get(GetManagedGatewayEthernetProfileRequest) returns (ManagedGatewayEthernetProfile) {+ option (google.api.http) = {+ additional_bindings: {get: "/gcs/gateways/profiles/ethernet/organizations/{collaborator.organization_ids.organization_id}/{profile_id}"}+ additional_bindings: {get: "/gcs/gateways/profiles/ethernet/users/{collaborator.user_ids.user_id}/{profile_id}"}+ };+ }++ rpc Delete(DeleteManagedGatewayEthernetProfileRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ additional_bindings: {delete: "/gcs/gateways/profiles/ethernet/organizations/{collaborator.organization_ids.organization_id}/{profile_id}"}+ additional_bindings: {delete: "/gcs/gateways/profiles/ethernet/users/{collaborator.user_ids.user_id}/{profile_id}"}+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_services.protonew file mode 100644index 000000000..04b25bfd1--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/gateway_services.proto@@ -0,0 +1,221 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/gateway.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The GatewayRegistry service, exposed by the Identity Server, is used to manage+// gateway registrations.+service GatewayRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage gateways."};+ // Create a new gateway. This also sets the given organization or user as+ // first collaborator with all possible rights.+ rpc Create(CreateGatewayRequest) returns (Gateway) {+ option (google.api.http) = {+ post: "/users/{collaborator.user_ids.user_id}/gateways"+ body: "*"+ additional_bindings {+ post: "/organizations/{collaborator.organization_ids.organization_id}/gateways"+ body: "*"+ }+ };+ }++ // Get the gateway with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc Get(GetGatewayRequest) returns (Gateway) {+ option (google.api.http) = {get: "/gateways/{gateway_ids.gateway_id}"};+ }++ // Get the identifiers of the gateway that has the given EUI registered.+ rpc GetIdentifiersForEUI(GetGatewayIdentifiersForEUIRequest) returns (GatewayIdentifiers);++ // List gateways where the given user or organization is a direct collaborator.+ // If no user or organization is given, this returns the gateways the caller+ // has access to.+ // Similar to Get, this selects the fields given by the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc List(ListGatewaysRequest) returns (Gateways) {+ option (google.api.http) = {+ get: "/gateways"+ additional_bindings {get: "/users/{collaborator.user_ids.user_id}/gateways"}+ additional_bindings {get: "/organizations/{collaborator.organization_ids.organization_id}/gateways"}+ additional_bindings {+ post: "/gateways/filter"+ body: "*"+ }+ };+ }++ // Update the gateway, changing the fields specified by the field mask to the provided values.+ rpc Update(UpdateGatewayRequest) returns (Gateway) {+ option (google.api.http) = {+ put: "/gateways/{gateway.ids.gateway_id}"+ body: "*"+ };+ }++ // Delete the gateway. This may not release the gateway ID for reuse, but it does release the EUI.+ rpc Delete(GatewayIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/gateways/{gateway_id}"};+ }++ // Restore a recently deleted gateway. This does not restore the EUI,+ // as that was released when deleting the gateway.+ //+ // Deployment configuration may specify if, and for how long after deletion,+ // entities can be restored.+ rpc Restore(GatewayIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/gateways/{gateway_id}/restore"};+ }++ // Purge the gateway. This will release both gateway ID and EUI for reuse.+ // The gateway owner is responsible for clearing data from any (external) integrations+ // that may store and expose data by gateway ID.+ rpc Purge(GatewayIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/gateways/{gateway_id}/purge"};+ }+}++// The GatewayAccess service, exposed by the Identity Server, is used to manage+// API keys and collaborators of gateways.+service GatewayAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage access to gateways."};+ // List the rights the caller has on this gateway.+ rpc ListRights(GatewayIdentifiers) returns (Rights) {+ option (google.api.http) = {get: "/gateways/{gateway_id}/rights"};+ }++ // Create an API key scoped to this gateway.+ rpc CreateAPIKey(CreateGatewayAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ post: "/gateways/{gateway_ids.gateway_id}/api-keys"+ body: "*"+ };+ }++ // List the API keys for this gateway.+ rpc ListAPIKeys(ListGatewayAPIKeysRequest) returns (APIKeys) {+ option (google.api.http) = {get: "/gateways/{gateway_ids.gateway_id}/api-keys"};+ }++ // Get a single API key of this gateway.+ rpc GetAPIKey(GetGatewayAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {get: "/gateways/{gateway_ids.gateway_id}/api-keys/{key_id}"};+ }++ // Update the rights of an API key of the gateway.+ // This method can also be used to delete the API key, by giving it no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc UpdateAPIKey(UpdateGatewayAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ put: "/gateways/{gateway_ids.gateway_id}/api-keys/{api_key.id}"+ body: "*"+ };+ }++ // Delete a single API key of this gateway.+ rpc DeleteAPIKey(DeleteGatewayAPIKeyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/gateways/{gateway_ids.gateway_id}/api-keys/{key_id}"};+ }++ // Get the rights of a collaborator (member) of the gateway.+ // Pseudo-rights in the response (such as the "_ALL" right) are not expanded.+ rpc GetCollaborator(GetGatewayCollaboratorRequest) returns (GetCollaboratorResponse) {+ option (google.api.http) = {+ additional_bindings {get: "/gateways/{gateway_ids.gateway_id}/collaborator/user/{collaborator.user_ids.user_id}"}+ additional_bindings {get: "/gateways/{gateway_ids.gateway_id}/collaborator/organization/{collaborator.organization_ids.organization_id}"}+ };+ }++ // Set the rights of a collaborator (member) on the gateway.+ // This method can also be used to delete the collaborator, by giving them no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc SetCollaborator(SetGatewayCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/gateways/{gateway_ids.gateway_id}/collaborators"+ body: "*"+ };+ }++ // List the collaborators on this gateway.+ rpc ListCollaborators(ListGatewayCollaboratorsRequest) returns (Collaborators) {+ option (google.api.http) = {get: "/gateways/{gateway_ids.gateway_id}/collaborators"};+ }++ // DeleteCollaborator removes a collaborator from a gateway.+ rpc DeleteCollaborator(DeleteGatewayCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ additional_bindings {delete: "/gateways/{gateway_ids.gateway_id}/collaborators/user/{collaborator_ids.user_ids.user_id}"}+ additional_bindings {delete: "/gateways/{gateway_ids.gateway_id}/collaborators/organization/{collaborator_ids.organization_ids.organization_id}"}+ };+ }+}++message PullGatewayConfigurationRequest {+ GatewayIdentifiers gateway_ids = 1;+ google.protobuf.FieldMask field_mask = 2;+}++message AssertGatewayRightsRequest {+ repeated GatewayIdentifiers gateway_ids = 1 [+ (validate.rules).repeated.min_items = 1,+ (validate.rules).repeated.max_items = 100+ ];+ Rights required = 2 [(validate.rules).message.required = true];+}++// The GatewayBatchAccess service, exposed by the Identity Server, is used to+// check the rights of the caller on multiple gateways at once.+// EXPERIMENTAL: This service is subject to change.+service GatewayBatchAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage access to batches of gateways."};+ // Assert that the caller has the requested rights on all the requested gateways.+ // The check is successful if there are no errors.+ rpc AssertRights(AssertGatewayRightsRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {get: "/gateways/rights/batch"};+ }+}++message BatchDeleteGatewaysRequest {+ repeated ttn.lorawan.v3.GatewayIdentifiers gateway_ids = 1 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ }];+}++// The GatewayBatchRegistry service, exposed by the Identity Server, is used to manage+// gateway registrations in batches.+service GatewayBatchRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage batches of gateways."};+ // Delete a batch of gateways.+ // This operation is atomic; either all gateways are deleted or none.+ // The caller must have delete rights on all requested gateways.+ rpc Delete(BatchDeleteGatewaysRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/gateways/batch"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/gatewayserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/gatewayserver.protonew file mode 100644index 000000000..06efc352c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/gatewayserver.proto@@ -0,0 +1,130 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/error.proto";+import "ttn/lorawan/v3/gateway.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "ttn/lorawan/v3/messages.proto";+import "ttn/lorawan/v3/mqtt.proto";+import "ttn/lorawan/v3/regional.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// GatewayUp may contain zero or more uplink messages and/or a status message for the gateway.+message GatewayUp {+ // Uplink messages received by the gateway.+ repeated UplinkMessage uplink_messages = 1;+ // Gateway status produced by the gateway.+ GatewayStatus gateway_status = 2;+ // A Tx acknowledgment or error.+ TxAcknowledgment tx_acknowledgment = 3;+}++// GatewayDown contains downlink messages for the gateway.+message GatewayDown {+ // DownlinkMessage for the gateway.+ DownlinkMessage downlink_message = 1;+}++// The GtwGs service connects a gateway to a Gateway Server.+service GtwGs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Connect a gRPC gateway to a The Things Stack Gateway Server."};+ // Link a gateway to the Gateway Server for streaming upstream messages and downstream messages.+ rpc LinkGateway(stream GatewayUp) returns (stream GatewayDown);+ // Get configuration for the concentrator.+ rpc GetConcentratorConfig(google.protobuf.Empty) returns (ConcentratorConfig);+ // Get connection information to connect an MQTT gateway.+ rpc GetMQTTConnectionInfo(GatewayIdentifiers) returns (MQTTConnectionInfo) {+ option (google.api.http) = {get: "/gs/gateways/{gateway_id}/mqtt-connection-info"};+ }+ // Get legacy connection information to connect a The Things Network Stack V2 MQTT gateway.+ rpc GetMQTTV2ConnectionInfo(GatewayIdentifiers) returns (MQTTConnectionInfo) {+ option (google.api.http) = {get: "/gs/gateways/{gateway_id}/mqttv2-connection-info"};+ }+}++message ScheduleDownlinkResponse {+ // The amount of time between the message has been scheduled and it will be transmitted by the gateway.+ google.protobuf.Duration delay = 1 [(validate.rules).duration.required = true];+ // Downlink path chosen by the Gateway Server.+ DownlinkPath downlink_path = 2;+ // Whether RX1 has been chosen for the downlink message.+ // Both RX1 and RX2 can be used for transmitting the same message by the same gateway.+ bool rx1 = 3;+ // Whether RX2 has been chosen for the downlink message.+ // Both RX1 and RX2 can be used for transmitting the same message by the same gateway.+ bool rx2 = 4;+}++message ScheduleDownlinkErrorDetails {+ // Errors per path when downlink scheduling failed.+ repeated ErrorDetails path_errors = 1;+}++// The NsGs service connects a Network Server to a Gateway Server.+service NsGs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The NsGs service connects a Network Server to a Gateway Server. This is an inter-component service and is not intended for end users."};+ // Instructs the Gateway Server to schedule a downlink message.+ // The Gateway Server may refuse if there are any conflicts in the schedule or+ // if a duty cycle prevents the gateway from transmitting.+ rpc ScheduleDownlink(DownlinkMessage) returns (ScheduleDownlinkResponse);+}++message BatchGetGatewayConnectionStatsRequest {+ repeated GatewayIdentifiers gateway_ids = 1 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 100+ }];+ // The names of the gateway stats fields that should be returned.+ // This mask will be applied on each entry returned.+ google.protobuf.FieldMask field_mask = 2;+}++message BatchGetGatewayConnectionStatsResponse {+ // The map key is the gateway identifier.+ map<string, GatewayConnectionStats> entries = 1;+}++// The Gs service returns information about the Gateway Server and gateways connected to it.+service Gs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Retrieve gateway connection statistics."};+ // Get statistics about the current gateway connection to the Gateway Server.+ // This is not persisted between reconnects.+ rpc GetGatewayConnectionStats(GatewayIdentifiers) returns (GatewayConnectionStats) {+ option (google.api.http) = {get: "/gs/gateways/{gateway_id}/connection/stats"};+ }++ // Get statistics about gateway connections to the Gateway Server of a batch of gateways.+ // - Statistics are not persisted between reconnects.+ // - Gateways that are not connected or are part of a different cluster are ignored.+ // - The client should ensure that the requested gateways are in the requested cluster.+ // - The client should have the right to get the gateway connection stats on all requested gateways.+ rpc BatchGetGatewayConnectionStats(BatchGetGatewayConnectionStatsRequest) returns (BatchGetGatewayConnectionStatsResponse) {+ option (google.api.http) = {+ post: "/gs/gateways/connection/stats"+ body: "*"+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/gatewaytokens.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/gatewaytokens.protonew file mode 100644index 000000000..7fbf69d0f--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/gatewaytokens.proto@@ -0,0 +1,39 @@+// Copyright © 2024 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/timestamp.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// GatewayToken is a special auth token used by cluster components to authenticate on behalf of gateways.+message GatewayToken {+ message Payload {+ ttn.lorawan.v3.GatewayIdentifiers gateway_ids = 1;+ ttn.lorawan.v3.Rights rights = 2;+ google.protobuf.Timestamp created_at = 3;+ }+ // ID of the key used to hash the token.+ string key_id = 1;++ Payload payload = 2;++ // Checksum of the payload to verify the authenticity of the caller.+ bytes checksum = 3;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/identifiers.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/identifiers.protonew file mode 100644index 000000000..e3cf242a0--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/identifiers.proto@@ -0,0 +1,313 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ApplicationIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string application_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message ClientIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string client_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message EndDeviceIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string device_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ ApplicationIdentifiers application_ids = 2 [(validate.rules).message.required = true];+ // The LoRaWAN DevEUI.+ bytes dev_eui = 4 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // The LoRaWAN JoinEUI (AppEUI until LoRaWAN 1.0.3 end devices).+ bytes join_eui = 5 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // The LoRaWAN DevAddr.+ bytes dev_addr = 6 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+}++message GatewayIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string gateway_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];++ // Secondary identifier, which can only be used in specific requests.+ bytes eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message OrganizationIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // This ID shares namespace with user IDs.+ string organization_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message UserIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // This ID shares namespace with organization IDs.+ string user_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){1,}$", // NOTE: User IDs allow a shorter minimum length than other IDs.+ max_len: 36+ }];++ // Secondary identifier, which can only be used in specific requests.+ string email = 2 [(thethings.flags.field).hidden = true];+}++// OrganizationOrUserIdentifiers contains either organization or user identifiers.+message OrganizationOrUserIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ oneof ids {+ option (validate.required) = true;+ OrganizationIdentifiers organization_ids = 1;+ UserIdentifiers user_ids = 2;+ }+}++// EntityIdentifiers contains one of the possible entity identifiers.+message EntityIdentifiers {+ oneof ids {+ option (validate.required) = true;+ ApplicationIdentifiers application_ids = 1;+ ClientIdentifiers client_ids = 2;+ EndDeviceIdentifiers device_ids = 3;+ GatewayIdentifiers gateway_ids = 4;+ OrganizationIdentifiers organization_ids = 5;+ UserIdentifiers user_ids = 6;+ }+}++// Identifies an end device model with version information.+message EndDeviceVersionIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ string brand_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string model_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36,+ ignore_empty: true+ }];+ string hardware_version = 3 [(validate.rules).string.max_len = 32];+ string firmware_version = 4 [(validate.rules).string.max_len = 32];+ string band_id = 5 [(validate.rules).string.max_len = 32];+ reserved 6, 7, 8; // vendor_id, vendor_profile_id, serial_number+}++// Identifies a Network Server.+message NetworkIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // LoRa Alliance NetID.+ bytes net_id = 1 [+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ },+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ }+ ];+ // LoRaWAN NSID (EUI-64) that uniquely identifies the Network Server instance.+ bytes ns_id = 6 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // Optional tenant identifier for multi-tenant deployments.+ string tenant_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Cluster identifier of the Network Server.+ string cluster_id = 3 [(validate.rules).string.max_len = 64];+ // Cluster address of the Network Server.+ string cluster_address = 4 [(validate.rules).string.max_len = 256];+ // Optional tenant address for multi-tenant deployments.+ string tenant_address = 5 [(validate.rules).string.max_len = 256];+}++message LoRaAllianceProfileIdentifiers {+ // VendorID managed by the LoRa Alliance, as defined in TR005.+ uint32 vendor_id = 1;+ // ID of the LoRaWAN end device profile assigned by the vendor.+ uint32 vendor_profile_id = 2;+}++message EndDeviceIdentifiersList {+ repeated EndDeviceIdentifiers end_device_ids = 1;+}++message GatewayIdentifiersList {+ repeated GatewayIdentifiers gateway_ids = 1;+}++message MACSettingsProfileIdentifiers {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Application IDs.+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // Profile ID.+ string profile_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/identityserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/identityserver.protonew file mode 100644index 000000000..67e2aa13c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/identityserver.proto@@ -0,0 +1,158 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/oauth.proto";+import "ttn/lorawan/v3/rights.proto";+import "ttn/lorawan/v3/user.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message AuthInfoResponse {+ message APIKeyAccess {+ APIKey api_key = 1 [(validate.rules).message.required = true];+ EntityIdentifiers entity_ids = 2 [(validate.rules).message.required = true];+ }+ message GatewayToken {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ repeated Right rights = 6;+ }+ oneof access_method {+ AuthInfoResponse.APIKeyAccess api_key = 1;+ OAuthAccessToken oauth_access_token = 2;+ // Warning: A user authorized by session cookie will be granted all+ // current and future rights. When using this auth type, the respective+ // handlers need to ensure thorough CSRF and CORS protection using+ // appropriate middleware.+ UserSession user_session = 5;+ AuthInfoResponse.GatewayToken gateway_token = 6;+ }+ Rights universal_rights = 3;+ bool is_admin = 4;+}++// The EntityAccess service provides information about the access rights of an entity.+service EntityAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Check the access rights for an entity."};+ // AuthInfo returns information about the authentication that is used on the request.+ rpc AuthInfo(google.protobuf.Empty) returns (AuthInfoResponse) {+ option (google.api.http) = {get: "/auth_info"};+ }+}++message GetIsConfigurationRequest {}++message IsConfiguration {+ message UserRegistration {+ message Invitation {+ google.protobuf.BoolValue required = 1;+ google.protobuf.Duration token_ttl = 2;+ }+ Invitation invitation = 1;++ message ContactInfoValidation {+ google.protobuf.BoolValue required = 1;+ google.protobuf.Duration token_ttl = 2;+ // The minimum interval between validation emails.+ google.protobuf.Duration retry_interval = 3;+ }+ ContactInfoValidation contact_info_validation = 2;++ message AdminApproval {+ google.protobuf.BoolValue required = 1;+ }+ AdminApproval admin_approval = 3;++ message PasswordRequirements {+ google.protobuf.UInt32Value min_length = 1;+ google.protobuf.UInt32Value max_length = 2;+ google.protobuf.UInt32Value min_uppercase = 3;+ google.protobuf.UInt32Value min_digits = 4;+ google.protobuf.UInt32Value min_special = 5;+ }+ PasswordRequirements password_requirements = 4;++ bool enabled = 5;+ }+ UserRegistration user_registration = 3;++ message ProfilePicture {+ google.protobuf.BoolValue disable_upload = 1;+ google.protobuf.BoolValue use_gravatar = 2;+ }+ ProfilePicture profile_picture = 4;++ message EndDevicePicture {+ google.protobuf.BoolValue disable_upload = 1;+ }+ EndDevicePicture end_device_picture = 5;++ message UserRights {+ google.protobuf.BoolValue create_applications = 1;+ google.protobuf.BoolValue create_clients = 2;+ google.protobuf.BoolValue create_gateways = 3;+ google.protobuf.BoolValue create_organizations = 4;+ }+ UserRights user_rights = 6;+ message UserLogin {+ google.protobuf.BoolValue disable_credentials_login = 1;+ }+ UserLogin user_login = 7;+ message AdminRights {+ google.protobuf.BoolValue all = 1;+ }+ AdminRights admin_rights = 8;+ reserved 9;+ reserved "network_limits";+ reserved 10;+ reserved "application_limits";+ reserved 11;+ reserved "organization_limits";+ reserved 12;+ reserved "user_limits";+ reserved 13;+ reserved "admin_restrictions";+ message CollaboratorRights {+ google.protobuf.BoolValue set_others_as_contacts = 1;+ }+ CollaboratorRights collaborator_rights = 14;+ reserved 15;+ reserved "tenant_registration";++ // next: 16+}++message GetIsConfigurationResponse {+ IsConfiguration configuration = 1;+}++// The Is service provides information about the Identity Server.+service Is {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Get information about The Things Stack Identity Server."};+ // Get the configuration of the Identity Server. The response is typically used+ // to enable or disable features in a user interface.+ rpc GetConfiguration(GetIsConfigurationRequest) returns (GetIsConfigurationResponse) {+ option (google.api.http) = {get: "/is/configuration"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/join.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/join.protonew file mode 100644index 000000000..3edad9877--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/join.proto@@ -0,0 +1,81 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/duration.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/keys.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message JoinRequest {+ bytes raw_payload = 1 [(validate.rules).bytes.len = 23];+ Message payload = 2;+ bytes dev_addr = 3 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ MACVersion selected_mac_version = 4;+ bytes net_id = 5 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ DLSettings downlink_settings = 6 [(validate.rules).message.required = true];+ RxDelay rx_delay = 7 [(validate.rules).enum.defined_only = true];+ // Optional CFList.+ CFList cf_list = 8;+ reserved 9; // Reserved for CFListType.+ repeated string correlation_ids = 10 [(validate.rules).repeated.items.string.max_len = 100];++ // Consumed airtime for the transmission of the join request. Calculated by Network Server using the RawPayload size and the transmission settings.+ google.protobuf.Duration consumed_airtime = 11;+}++message JoinResponse {+ bytes raw_payload = 1 [(validate.rules).bytes = {+ min_len: 17,+ max_len: 33+ }];+ SessionKeys session_keys = 2 [(validate.rules).message.required = true];+ google.protobuf.Duration lifetime = 3;+ repeated string correlation_ids = 4 [(validate.rules).repeated.items.string.max_len = 100];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/joinserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/joinserver.protonew file mode 100644index 000000000..3e91ac914--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/joinserver.proto@@ -0,0 +1,526 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/struct.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/join.proto";+import "ttn/lorawan/v3/keys.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message SessionKeyRequest {+ // Join Server issued identifier for the session keys.+ bytes session_key_id = 1 [(validate.rules).bytes.max_len = 2048];+ // LoRaWAN DevEUI.+ bytes dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // The LoRaWAN JoinEUI (AppEUI until LoRaWAN 1.0.3 end devices).+ bytes join_eui = 3 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++message NwkSKeysResponse {+ // The (encrypted) Forwarding Network Session Integrity Key (or Network Session Key in 1.0 compatibility mode).+ KeyEnvelope f_nwk_s_int_key = 1 [(validate.rules).message.required = true];+ // The (encrypted) Serving Network Session Integrity Key.+ KeyEnvelope s_nwk_s_int_key = 2 [(validate.rules).message.required = true];+ // The (encrypted) Network Session Encryption Key.+ KeyEnvelope nwk_s_enc_key = 3 [(validate.rules).message.required = true];+}++// The NsJs service connects a Network Server to a Join Server.+service NsJs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The NsJs service connects a Network Server to a Join Server. This is an inter-component service and is not intended to be used by end users."};+ // Handle a join-request message.+ rpc HandleJoin(JoinRequest) returns (JoinResponse);+ // Request the network session keys for a particular session.+ rpc GetNwkSKeys(SessionKeyRequest) returns (NwkSKeysResponse);+}++message AppSKeyResponse {+ // The (encrypted) Application Session Key.+ KeyEnvelope app_s_key = 1 [(validate.rules).message.required = true];+}++// The AsJs service connects an Application Server to a Join Server.+service AsJs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The AsJs service connects an Application Server to a Join Server. This is an inter-component service and is not intended to be used by end users."};+ // Request the application session key for a particular session.+ rpc GetAppSKey(SessionKeyRequest) returns (AppSKeyResponse);+}++// The AppJs service connects an Application to a Join Server.+service AppJs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The AppJs service is used by an external AWS integration to connect to a Join Server instance."};+ // Request the application session key for a particular session.+ rpc GetAppSKey(SessionKeyRequest) returns (AppSKeyResponse);+}++message CryptoServicePayloadRequest {+ // End device identifiers for the cryptographic operation.+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ // LoRaWAN version to use for the cryptographic operation.+ MACVersion lorawan_version = 2 [(validate.rules).enum.defined_only = true];+ // Raw input payload.+ bytes payload = 3 [(validate.rules).bytes.max_len = 256];+ // Provisioner that provisioned the end device.+ string provisioner_id = 4 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Provisioning data for the provisioner.+ google.protobuf.Struct provisioning_data = 5;+}++message CryptoServicePayloadResponse {+ // Raw output payload.+ bytes payload = 1;+}++message JoinAcceptMICRequest {+ // Request data for the cryptographic operation.+ CryptoServicePayloadRequest payload_request = 1 [(validate.rules).message.required = true];+ // LoRaWAN join-request type.+ JoinRequestType join_request_type = 2 [(validate.rules).enum.defined_only = true];+ // LoRaWAN DevNonce.+ bytes dev_nonce = 3 [+ (validate.rules).bytes = {+ len: 2,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal2Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCD\""+ }+ ];+}++message DeriveSessionKeysRequest {+ // End device identifiers to use for key derivation.+ // The DevAddr must be set in this request. The DevEUI may need to be set, depending on the provisioner.+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ // LoRaWAN key derivation scheme.+ MACVersion lorawan_version = 2 [(validate.rules).enum.defined_only = true];+ // LoRaWAN JoinNonce (or AppNonce).+ bytes join_nonce = 3 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCDEF\""+ }+ ];+ // LoRaWAN DevNonce.+ bytes dev_nonce = 4 [+ (validate.rules).bytes = {+ len: 2,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal2Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCD\""+ }+ ];+ // LoRaWAN NetID.+ bytes net_id = 5 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ // Provisioner that provisioned the end device.+ string provisioner_id = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Provisioning data for the provisioner.+ google.protobuf.Struct provisioning_data = 7;+}++message GetRootKeysRequest {+ // End device identifiers to request the root keys for.+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ // Provisioner that provisioned the end device.+ string provisioner_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Provisioning data for the provisioner.+ google.protobuf.Struct provisioning_data = 3;+}++// Service for network layer cryptographic operations.+service NetworkCryptoService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The NetworkCryptoService supports network layer cryptographic operations. This service is not intended to be used by end users."};+ // Calculate the join-request message MIC.+ rpc JoinRequestMIC(CryptoServicePayloadRequest) returns (CryptoServicePayloadResponse);+ // Calculate the join-accept message MIC.+ rpc JoinAcceptMIC(JoinAcceptMICRequest) returns (CryptoServicePayloadResponse);+ // Encrypt the join-accept payload.+ rpc EncryptJoinAccept(CryptoServicePayloadRequest) returns (CryptoServicePayloadResponse);+ // Encrypt the rejoin-accept payload.+ rpc EncryptRejoinAccept(CryptoServicePayloadRequest) returns (CryptoServicePayloadResponse);+ // Derive network session keys (NwkSKey, or FNwkSKey, SNwkSKey and NwkSEncKey)+ rpc DeriveNwkSKeys(DeriveSessionKeysRequest) returns (NwkSKeysResponse);+ // Get the NwkKey. Crypto Servers may return status code FAILED_PRECONDITION when root keys are not exposed.+ rpc GetNwkKey(GetRootKeysRequest) returns (KeyEnvelope);+}++// Service for application layer cryptographic operations.+service ApplicationCryptoService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The ApplicationCryptoService supports application layer cryptographic operations. This service is not intended to be used by end users."};+ // Derive the application session key (AppSKey).+ rpc DeriveAppSKey(DeriveSessionKeysRequest) returns (AppSKeyResponse);+ // Get the AppKey. Crypto Servers may return status code FAILED_PRECONDITION when root keys are not exposed.+ rpc GetAppKey(GetRootKeysRequest) returns (KeyEnvelope);+}++message ProvisionEndDevicesRequest {+ option deprecated = true;++ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // ID of the provisioner service as configured in the Join Server.+ string provisioner_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Vendor-specific provisioning data.+ bytes provisioning_data = 3;++ message IdentifiersList {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ repeated EndDeviceIdentifiers end_device_ids = 2;+ }+ message IdentifiersRange {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // DevEUI to start issuing from.+ bytes start_dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ }+ message IdentifiersFromData {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ }+ oneof end_devices {+ // List of device identifiers that will be provisioned.+ // The device identifiers must contain device_id and dev_eui.+ // If set, the application_ids must equal the provision request's application_ids.+ // The number of entries in data must match the number of given identifiers.+ IdentifiersList list = 4;+ // Provision devices in a range.+ // The device_id will be generated by the provisioner from the vendor-specific data.+ // The dev_eui will be issued from the given start_dev_eui.+ IdentifiersRange range = 5;+ // Provision devices with identifiers from the given data.+ // The device_id and dev_eui will be generated by the provisioner from the vendor-specific data.+ IdentifiersFromData from_data = 6;+ }+}++// The JsEndDeviceRegistry service allows clients to manage their end devices on the Join Server.+service JsEndDeviceRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage end devices on The Things Stack Join Server."};+ // Get returns the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Get(GetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {get: "/js/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"};+ }++ // Set creates or updates the device.+ rpc Set(SetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ put: "/js/applications/{end_device.ids.application_ids.application_id}/devices/{end_device.ids.device_id}"+ body: "*"+ additional_bindings {+ post: "/js/applications/{end_device.ids.application_ids.application_id}/devices"+ body: "*"+ };+ };+ }++ // This rpc is deprecated; use EndDeviceTemplateConverter service instead.+ // TODO: Remove (https://github.com/TheThingsNetwork/lorawan-stack/issues/999)+ rpc Provision(ProvisionEndDevicesRequest) returns (stream EndDevice) {+ option deprecated = true;+ option (google.api.http) = {+ put: "/js/applications/{application_ids.application_id}/provision-devices"+ body: "*"+ };+ }++ // Delete deletes the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Delete(EndDeviceIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/js/applications/{application_ids.application_id}/devices/{device_id}"};+ }+}++// JsEndDeviceBatchRegistry service allows clients to manage batches of end devices on the Join Server.+service JsEndDeviceBatchRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage batches of end devices on The Things Stack Join Server."};+ // Delete a list of devices within the same application.+ // This operation is atomic; either all devices are deleted or none.+ // Devices not found are skipped and no error is returned.+ rpc Delete(BatchDeleteEndDevicesRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/js/applications/{application_ids.application_id}/devices/batch"};+ }+}++message ApplicationActivationSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The KEK label to use for wrapping application keys.+ string kek_label = 1 [(validate.rules).string.max_len = 2048];+ // The (encrypted) Key Encryption Key.+ KeyEnvelope kek = 2;+ // Home NetID.+ bytes home_net_id = 3 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ // The AS-ID of the Application Server to use.+ string application_server_id = 4 [(validate.rules).string.max_len = 100];+}++message GetApplicationActivationSettingsRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 2;+}++message SetApplicationActivationSettingsRequest {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ ApplicationActivationSettings settings = 2 [(validate.rules).message.required = true];+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteApplicationActivationSettingsRequest {+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+}++// The ApplicationActivationSettingRegistry service allows clients to manage their application activation settings.+service ApplicationActivationSettingRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage application activation settings."};+ // Get returns application activation settings.+ rpc Get(GetApplicationActivationSettingsRequest) returns (ApplicationActivationSettings) {+ option (google.api.http) = {get: "/js/applications/{application_ids.application_id}/settings"};+ }++ // Set creates or updates application activation settings.+ rpc Set(SetApplicationActivationSettingsRequest) returns (ApplicationActivationSettings) {+ option (google.api.http) = {+ post: "/js/applications/{application_ids.application_id}/settings"+ body: "*"+ };+ }++ // Delete deletes application activation settings.+ rpc Delete(DeleteApplicationActivationSettingsRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/js/applications/{application_ids.application_id}/settings"};+ }+}++message JoinEUIPrefix {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ uint32 length = 2;+}++message JoinEUIPrefixes {+ repeated JoinEUIPrefix prefixes = 1;+}++message GetDefaultJoinEUIResponse {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+}++// The Js service returns configuration for a Join Server.+service Js {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Fetch configuration for The Things Stack Join Server."};+ // Request the JoinEUI prefixes that are configured for this Join Server.+ rpc GetJoinEUIPrefixes(google.protobuf.Empty) returns (JoinEUIPrefixes) {+ option (google.api.http) = {get: "/js/join_eui_prefixes"};+ }++ // Request the default JoinEUI that is configured for this Join Server.+ rpc GetDefaultJoinEUI(google.protobuf.Empty) returns (GetDefaultJoinEUIResponse) {+ option (google.api.http) = {get: "/js/default_join_eui"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/keys.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/keys.protonew file mode 100644index 000000000..a9c63c755--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/keys.proto@@ -0,0 +1,99 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message KeyEnvelope {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The unencrypted AES key.+ bytes key = 1 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ // The label of the RFC 3394 key-encryption-key (KEK) that was used to encrypt the key.+ string kek_label = 2 [(validate.rules).string.max_len = 2048];+ bytes encrypted_key = 3 [+ (validate.rules).bytes.max_len = 1024,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];+}++// Root keys for a LoRaWAN device.+// These are stored on the Join Server.+message RootKeys {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Join Server issued identifier for the root keys.+ string root_key_id = 1 [(validate.rules).string.max_len = 2048];+ // The (encrypted) Application Key.+ KeyEnvelope app_key = 2;+ // The (encrypted) Network Key.+ KeyEnvelope nwk_key = 3;+}++// Session keys for a LoRaWAN session.+// Only the components for which the keys were meant, will have the key-encryption-key (KEK) to decrypt the individual keys.+message SessionKeys {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Join Server issued identifier for the session keys.+ // This ID can be used to request the keys from the Join Server in case the are lost.+ bytes session_key_id = 1 [(validate.rules).bytes.max_len = 2048];+ // The (encrypted) Forwarding Network Session Integrity Key (or Network Session Key in 1.0 compatibility mode).+ // This key is stored by the (forwarding) Network Server.+ KeyEnvelope f_nwk_s_int_key = 2;+ // The (encrypted) Serving Network Session Integrity Key.+ // This key is stored by the (serving) Network Server.+ KeyEnvelope s_nwk_s_int_key = 3;+ // The (encrypted) Network Session Encryption Key.+ // This key is stored by the (serving) Network Server.+ KeyEnvelope nwk_s_enc_key = 4;+ // The (encrypted) Application Session Key.+ // This key is stored by the Application Server.+ KeyEnvelope app_s_key = 5;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/lorawan.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/lorawan.protonew file mode 100644index 000000000..b5fd0824c--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/lorawan.proto@@ -0,0 +1,1588 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Message represents a LoRaWAN message+message Message {+ MHDR m_hdr = 1 [(validate.rules).message.required = true];+ bytes mic = 2 [(validate.rules).bytes = {+ min_len: 0,+ max_len: 4+ }];++ // Payload represents either MACPayload, RejoinRequestPayload, JoinRequestPayload or JoinAcceptPayload+ // - MACPayload length is in range [7:M] bytes, where M is PHY specific.+ // - JoinRequestPayload length is 18 bytes.+ // - JoinAcceptPayload length is either 12 or 28 bytes.+ // - RejoinRequestPayload length is 14 for Type 0 and 2, 19 for Type 1.+ oneof Payload {+ option (validate.required) = true;++ MACPayload mac_payload = 3;+ JoinRequestPayload join_request_payload = 4;+ JoinAcceptPayload join_accept_payload = 5;+ RejoinRequestPayload rejoin_request_payload = 6;+ }++ reserved 7; // Reserved for proprietary payload.+}++enum MType {+ option (thethings.json.enum) = {marshal_as_string: true};+ JOIN_REQUEST = 0;+ JOIN_ACCEPT = 1;+ UNCONFIRMED_UP = 2;+ UNCONFIRMED_DOWN = 3;+ CONFIRMED_UP = 4;+ CONFIRMED_DOWN = 5;+ REJOIN_REQUEST = 6;+ PROPRIETARY = 7;+}++enum Major {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "LORAWAN"+ };+ LORAWAN_R1 = 0;+}++enum MACVersion {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "MAC"+ };+ option (thethings.flags.enum) = {alias_map: "go.thethings.network/lorawan-stack/v3/pkg/ttnpb.MACVersion_customvalue"};++ MAC_UNKNOWN = 0 [(thethings.json.enum_value) = {+ aliases: ["unknown"]+ }];+ MAC_V1_0 = 1 [(thethings.json.enum_value) = {+ aliases: [+ "1.0",+ "1.0.0"+ ]+ }];+ MAC_V1_0_1 = 2 [(thethings.json.enum_value) = {+ aliases: ["1.0.1"]+ }];+ MAC_V1_0_2 = 3 [(thethings.json.enum_value) = {+ aliases: ["1.0.2"]+ }];+ MAC_V1_1 = 4 [(thethings.json.enum_value) = {+ aliases: [+ "1.1",+ "1.1.0"+ ]+ }];+ MAC_V1_0_3 = 5 [(thethings.json.enum_value) = {+ aliases: ["1.0.3"]+ }];+ MAC_V1_0_4 = 6 [(thethings.json.enum_value) = {+ aliases: ["1.0.4"]+ }];+}++enum PHYVersion {+ option allow_alias = true;+ option (thethings.json.enum) = {marshal_as_string: true};+ option (thethings.flags.enum) = {alias_map: "go.thethings.network/lorawan-stack/v3/pkg/ttnpb.PHYVersion_customvalue"};++ PHY_UNKNOWN = 0 [(thethings.json.enum_value) = {+ aliases: ["unknown"]+ }];++ PHY_V1_0 = 1 [(thethings.json.enum_value) = {+ aliases: [+ "1.0",+ "1.0.0",+ "V1_0"+ ]+ }];+ TS001_V1_0 = 1;+ PHY_V1_0_1 = 2 [(thethings.json.enum_value) = {+ aliases: [+ "1.0.1",+ "V1_0_1"+ ]+ }];+ TS001_V1_0_1 = 2;++ PHY_V1_0_2_REV_A = 3 [(thethings.json.enum_value) = {+ aliases: [+ "1.0.2",+ "1.0.2-a",+ "V1_0_2",+ "V1_0_2_REV_A"+ ]+ }];+ RP001_V1_0_2 = 3;+ PHY_V1_0_2_REV_B = 4 [(thethings.json.enum_value) = {+ aliases: [+ "1.0.2-b",+ "V1_0_2_REV_B"+ ]+ }];+ RP001_V1_0_2_REV_B = 4;+ PHY_V1_1_REV_A = 5 [(thethings.json.enum_value) = {+ aliases: [+ "1.1-a",+ "1.1.0-a",+ "V1_1_REV_A"+ ]+ }];+ RP001_V1_1_REV_A = 5;+ PHY_V1_1_REV_B = 6 [(thethings.json.enum_value) = {+ aliases: [+ "1.1-b",+ "1.1.0-b",+ "V1_1_REV_B"+ ]+ }];+ RP001_V1_1_REV_B = 6;+ PHY_V1_0_3_REV_A = 7 [(thethings.json.enum_value) = {+ aliases: [+ "1.0.3-a",+ "V1_0_3_REV_A"+ ]+ }];+ RP001_V1_0_3_REV_A = 7;++ RP002_V1_0_0 = 8;+ RP002_V1_0_1 = 9;+ RP002_V1_0_2 = 10;+ RP002_V1_0_3 = 11;+ RP002_V1_0_4 = 12;+}++enum DataRateIndex {+ option (thethings.json.enum) = {+ marshal_as_number: true,+ prefix: "DATA_RATE"+ };+ option (thethings.flags.enum) = {alias_map: "go.thethings.network/lorawan-stack/v3/pkg/ttnpb.DataRateIndex_customvalue"};++ DATA_RATE_0 = 0;+ DATA_RATE_1 = 1;+ DATA_RATE_2 = 2;+ DATA_RATE_3 = 3;+ DATA_RATE_4 = 4;+ DATA_RATE_5 = 5;+ DATA_RATE_6 = 6;+ DATA_RATE_7 = 7;+ DATA_RATE_8 = 8;+ DATA_RATE_9 = 9;+ DATA_RATE_10 = 10;+ DATA_RATE_11 = 11;+ DATA_RATE_12 = 12;+ DATA_RATE_13 = 13;+ DATA_RATE_14 = 14;+ DATA_RATE_15 = 15;+}++enum DataRateOffset {+ option (thethings.json.enum) = {+ marshal_as_number: true,+ prefix: "DATA_RATE_OFFSET"+ };+ option (thethings.flags.enum) = {alias_map: "go.thethings.network/lorawan-stack/v3/pkg/ttnpb.DataRateOffset_customvalue"};++ DATA_RATE_OFFSET_0 = 0;+ DATA_RATE_OFFSET_1 = 1;+ DATA_RATE_OFFSET_2 = 2;+ DATA_RATE_OFFSET_3 = 3;+ DATA_RATE_OFFSET_4 = 4;+ DATA_RATE_OFFSET_5 = 5;+ DATA_RATE_OFFSET_6 = 6;+ DATA_RATE_OFFSET_7 = 7;+}++message MHDR {+ MType m_type = 1 [(validate.rules).enum.defined_only = true];+ Major major = 2 [(validate.rules).enum.defined_only = true];+}++message MACPayload {+ FHDR f_hdr = 1 [(validate.rules).message.required = true];+ uint32 f_port = 2 [(validate.rules).uint32.lte = 255];+ bytes frm_payload = 3;+ google.protobuf.Struct decoded_payload = 4;+ // Full 32-bit FCnt value. Used internally by Network Server.+ uint32 full_f_cnt = 5;+}++message FHDR {+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ FCtrl f_ctrl = 2 [(validate.rules).message.required = true];+ uint32 f_cnt = 3 [(validate.rules).uint32.lte = 65535];+ bytes f_opts = 4 [(validate.rules).bytes.max_len = 15];+}++message FCtrl {+ bool adr = 1;+ bool adr_ack_req = 2; // Only on uplink.+ bool ack = 3;+ bool f_pending = 4; // Only on downlink.+ bool class_b = 5; // Only on uplink.+}++message JoinRequestPayload {+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_nonce = 3 [+ (validate.rules).bytes = {+ len: 2,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal2Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New2BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCD\""+ }+ ];+}++enum JoinRequestType {+ option (thethings.json.enum) = {marshal_as_string: true};++ REJOIN_CONTEXT = 0; // Resets DevAddr, Session Keys, Frame Counters, Radio Parameters.+ REJOIN_SESSION = 1; // Equivalent to the initial JoinRequest.+ REJOIN_KEYS = 2; // Resets DevAddr, Session Keys, Frame Counters, while keeping the Radio Parameters.+ JOIN = 255; // Normal join-request.+}++enum RejoinRequestType {+ option (thethings.json.enum) = {marshal_as_string: true};++ CONTEXT = 0; // Resets DevAddr, Session Keys, Frame Counters, Radio Parameters.+ SESSION = 1; // Equivalent to the initial JoinRequest.+ KEYS = 2; // Resets DevAddr, Session Keys, Frame Counters, while keeping the Radio Parameters.+}++message RejoinRequestPayload {+ RejoinRequestType rejoin_type = 1 [(validate.rules).enum.defined_only = true];+ bytes net_id = 2 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ bytes join_eui = 3 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_eui = 4 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ uint32 rejoin_cnt = 5; // Contains RJCount0 or RJCount1 depending on rejoin_type.+}++message JoinAcceptPayload {+ bytes encrypted = 1;+ bytes join_nonce = 2 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCDEF\""+ }+ ];+ bytes net_id = 3 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ bytes dev_addr = 4 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ DLSettings dl_settings = 5 [(validate.rules).message.required = true];+ RxDelay rx_delay = 6 [(validate.rules).enum.defined_only = true];+ CFList cf_list = 7;+}++message DLSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ DataRateOffset rx1_dr_offset = 1 [(validate.rules).enum.defined_only = true];+ DataRateIndex rx2_dr = 2 [(validate.rules).enum.defined_only = true];+ // OptNeg is set if Network Server implements LoRaWAN 1.1 or greater.+ bool opt_neg = 3;+}++enum CFListType {+ option (thethings.json.enum) = {marshal_as_string: true};++ FREQUENCIES = 0;+ CHANNEL_MASKS = 1;+}++message CFList {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ CFListType type = 1 [(validate.rules).enum.defined_only = true];+ // Frequencies to be broadcasted, in hecto-Hz.+ // These values are broadcasted as 24 bits unsigned integers.+ // This field should not contain default values.+ repeated uint32 freq = 2;+ // ChMasks controlling the channels to be used.+ // Length of this field must be equal to the amount of uplink channels+ // defined by the selected frequency plan.+ repeated bool ch_masks = 3;+}++enum Class {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "CLASS"+ };++ CLASS_A = 0;+ CLASS_B = 1;+ CLASS_C = 2;+}++enum TxSchedulePriority {+ option (thethings.json.enum) = {marshal_as_string: true};+ LOWEST = 0;+ LOW = 1;+ BELOW_NORMAL = 2;+ NORMAL = 3;+ ABOVE_NORMAL = 4;+ HIGH = 5;+ HIGHEST = 6;+}++message LoRaDataRate {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Bandwidth (Hz).+ uint32 bandwidth = 1;+ uint32 spreading_factor = 2;+ string coding_rate = 3;+}++message FSKDataRate {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Bit rate (bps).+ uint32 bit_rate = 1;+}++message LRFHSSDataRate {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ uint32 modulation_type = 1;+ // Operating Channel Width (Hz).+ uint32 operating_channel_width = 2;+ string coding_rate = 3;+}++message DataRate {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ oneof modulation {+ option (validate.required) = true;++ LoRaDataRate lora = 1;+ FSKDataRate fsk = 2;+ LRFHSSDataRate lrfhss = 3;+ }+}++// TxSettings contains the settings for a transmission.+// This message is used on both uplink and downlink.+// On downlink, this is a scheduled transmission.+message TxSettings {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Transmission settings for downlink.+ message Downlink {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Index of the antenna on which the uplink was received and/or downlink must be sent.+ uint32 antenna_index = 1;+ // Transmission power (dBm). Only on downlink.+ float tx_power = 2;+ // Invert LoRa polarization; false for LoRaWAN uplink, true for downlink.+ bool invert_polarization = 3;+ }++ // Data rate.+ DataRate data_rate = 1 [(validate.rules).message.required = true];+ reserved 2; // data_rate_index+ reserved 3; // coding_rate+ // Frequency (Hz).+ uint64 frequency = 4 [(validate.rules).uint64.gte = 100000];+ // Send a CRC in the packet; only on uplink; on downlink, CRC should not be enabled.+ bool enable_crc = 5;+ // Timestamp of the gateway concentrator when the uplink message was received, or when the downlink message should be transmitted (microseconds).+ // On downlink, set timestamp to 0 and time to null to use immediate scheduling.+ uint32 timestamp = 6;+ // Time of the gateway when the uplink message was received, or when the downlink message should be transmitted.+ // For downlink, this requires the gateway to have GPS time synchronization.+ google.protobuf.Timestamp time = 7;+ // Transmission settings for downlink.+ Downlink downlink = 8;+ // Concentrator timestamp for the downlink as calculated by the Gateway Server scheduler.+ // This value takes into account necessary offsets such as the RTT (Round Trip Time) and TOA (Time Of Arrival).+ // This field is set and used only by the Gateway Server.+ int64 concentrator_timestamp = 9;+}++message GatewayAntennaIdentifiers {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ uint32 antenna_index = 2;+}++message ClassBCGatewayIdentifiers {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ uint32 antenna_index = 2;+ uint32 group_index = 3;+}++message UplinkToken {+ GatewayAntennaIdentifiers ids = 1 [(validate.rules).message.required = true];+ uint32 timestamp = 2;+ // Absolute time observed by the server when the uplink message has been received.+ google.protobuf.Timestamp server_time = 3;+ // Absolute concentrator time as observed by the Gateway Server, accounting for rollovers.+ int64 concentrator_time = 4;+ // Absolute time observed by the gateway when the uplink has been received.+ google.protobuf.Timestamp gateway_time = 5;+}++message DownlinkPath {+ // Set uplink token for class A, B or C downlink to the uplink token received from the corresponding RxMetadata. Uplink tokens are opaque to the Network Server.+ // Set fixed to force using the specified gateway antenna identifiers for downlink. This can only be used for class B or C downlinks.+ oneof path {+ option (validate.required) = true;++ bytes uplink_token = 1;+ GatewayAntennaIdentifiers fixed = 2;+ }+}++// TxRequest is a request for transmission.+// If sent to a roaming partner, this request is used to generate the DLMetadata Object (see Backend Interfaces 1.0, Table 22).+// If the gateway has a scheduler, this request is sent to the gateway, in the order of gateway_ids.+// Otherwise, the Gateway Server attempts to schedule the request and creates the TxSettings.+message TxRequest {+ Class class = 1;+ // Downlink paths used to select a gateway for downlink.+ // In class A, the downlink paths are required to only contain uplink tokens.+ // In class B and C, the downlink paths may contain uplink tokens and fixed gateways antenna identifiers.+ repeated DownlinkPath downlink_paths = 2;++ // Rx1 delay (Rx2 delay is Rx1 delay + 1 second).+ RxDelay rx1_delay = 3 [(validate.rules).enum.defined_only = true];+ // LoRaWAN data rate for Rx1.+ DataRate rx1_data_rate = 12;+ reserved 4; // rx1_data_rate_index+ // Frequency (Hz) for Rx1.+ uint64 rx1_frequency = 5;+ // LoRaWAN data rate for Rx2.+ DataRate rx2_data_rate = 13;+ reserved 6; // rx2_data_rate_index+ // Frequency (Hz) for Rx2.+ uint64 rx2_frequency = 7;+ // Priority for scheduling.+ // Requests with a higher priority are allocated more channel time than messages with a lower priority, in duty-cycle limited regions.+ // A priority of HIGH or higher sets the HiPriorityFlag in the DLMetadata Object.+ TxSchedulePriority priority = 8 [(validate.rules).enum.defined_only = true];++ // Time when the downlink message should be transmitted.+ // This value is only valid for class C downlink; class A downlink uses uplink tokens and class B downlink is scheduled on ping slots.+ // This requires the gateway to have GPS time sychronization.+ // If the absolute time is not set, the first available time will be used that does not conflict or violate regional limitations.+ google.protobuf.Timestamp absolute_time = 9;++ // Frequency plan ID from which the frequencies in this message are retrieved.+ string frequency_plan_id = 10 [(validate.rules).string.max_len = 64];+ reserved 11; // lorawan_phy_version++ // Advanced metadata fields+ // - can be used for advanced information or experimental features that are not yet formally defined in the API+ // - field names are written in snake_case+ google.protobuf.Struct advanced = 99;+}++enum MACCommandIdentifier {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "CID"+ };++ CID_RFU_0 = 0;+ CID_RESET = 1;+ CID_LINK_CHECK = 2;+ CID_LINK_ADR = 3;+ CID_DUTY_CYCLE = 4;+ CID_RX_PARAM_SETUP = 5;+ CID_DEV_STATUS = 6;+ CID_NEW_CHANNEL = 7;+ CID_RX_TIMING_SETUP = 8;+ CID_TX_PARAM_SETUP = 9;+ CID_DL_CHANNEL = 10;+ CID_REKEY = 11;+ CID_ADR_PARAM_SETUP = 12;+ CID_DEVICE_TIME = 13;+ CID_FORCE_REJOIN = 14;+ CID_REJOIN_PARAM_SETUP = 15;+ CID_PING_SLOT_INFO = 16;+ CID_PING_SLOT_CHANNEL = 17;+ CID_BEACON_TIMING = 18; // Deprecated+ CID_BEACON_FREQ = 19;+ CID_DEVICE_MODE = 32;++ CID_RELAY_CONF = 64;+ CID_RELAY_END_DEVICE_CONF = 65;+ CID_RELAY_FILTER_LIST = 66;+ CID_RELAY_UPDATE_UPLINK_LIST = 67;+ CID_RELAY_CTRL_UPLINK_LIST = 68;+ CID_RELAY_CONFIGURE_FWD_LIMIT = 69;+ CID_RELAY_NOTIFY_NEW_END_DEVICE = 70;+}++enum RelayCADPeriodicity {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_CAD_PERIODICITY"+ };++ RELAY_CAD_PERIODICITY_1_SECOND = 0;+ RELAY_CAD_PERIODICITY_500_MILLISECONDS = 1;+ RELAY_CAD_PERIODICITY_250_MILLISECONDS = 2;+ RELAY_CAD_PERIODICITY_100_MILLISECONDS = 3;+ RELAY_CAD_PERIODICITY_50_MILLISECONDS = 4;+ RELAY_CAD_PERIODICITY_20_MILLISECONDS = 5; // sic+}++enum RelaySecondChAckOffset {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_SECOND_CH_ACK_OFFSET"+ };++ RELAY_SECOND_CH_ACK_OFFSET_0 = 0; // 0 kHz+ RELAY_SECOND_CH_ACK_OFFSET_200 = 1; // 200 kHz+ RELAY_SECOND_CH_ACK_OFFSET_400 = 2; // 400 kHz+ RELAY_SECOND_CH_ACK_OFFSET_800 = 3; // 800 kHz+ RELAY_SECOND_CH_ACK_OFFSET_1600 = 4; // 1.6 MHz+ RELAY_SECOND_CH_ACK_OFFSET_3200 = 5; // 3.2 MHz+}++enum RelayLimitBucketSize {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_LIMIT_BUCKET_SIZE"+ };++ RELAY_LIMIT_BUCKET_SIZE_1 = 0;+ RELAY_LIMIT_BUCKET_SIZE_2 = 1;+ RELAY_LIMIT_BUCKET_SIZE_4 = 2;+ RELAY_LIMIT_BUCKET_SIZE_12 = 3; // sic+}++enum RelaySmartEnableLevel {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_SMART_ENABLE_LEVEL"+ };++ RELAY_SMART_ENABLE_LEVEL_8 = 0;+ RELAY_SMART_ENABLE_LEVEL_16 = 1;+ RELAY_SMART_ENABLE_LEVEL_32 = 2;+ RELAY_SMART_ENABLE_LEVEL_64 = 3;+}++enum RelayWORChannel {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_WOR_CHANNEL"+ };++ RELAY_WOR_CHANNEL_DEFAULT = 0;+ RELAY_WOR_CHANNEL_SECONDARY = 1;+}++enum RelayResetLimitCounter {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_RESET_LIMIT_COUNTER"+ };++ RELAY_RESET_LIMIT_COUNTER_ZERO = 0;+ RELAY_RESET_LIMIT_COUNTER_RELOAD_RATE = 1;+ RELAY_RESET_LIMIT_COUNTER_MAX_VALUE = 2;+ RELAY_RESET_LIMIT_COUNTER_NO_RESET = 3;+}++enum RelayCtrlUplinkListAction {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RELAY_CTRL_UPLINK_LIST_ACTION"+ };++ RELAY_CTRL_UPLINK_LIST_ACTION_READ_W_F_CNT = 0;+ RELAY_CTRL_UPLINK_LIST_ACTION_REMOVE_TRUSTED_END_DEVICE = 1;+}++message RelaySecondChannel {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // The frequency (Hz) offset used for the WOR acknowledgement.+ RelaySecondChAckOffset ack_offset = 1 [(validate.rules).enum.defined_only = true];+ // The data rate index used by the WOR and WOR acknowledgement.+ DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true];+ // The frequency (Hz) used by the wake on radio message.+ uint64 frequency = 3 [(validate.rules).uint64.gte = 100000];+}++message RelayUplinkForwardLimits {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // The multiplier used to compute the total bucket size for the limits.+ // The multiplier is multiplied by the reload rate in order to compute the total bucket size.+ RelayLimitBucketSize bucket_size = 1 [(validate.rules).enum.defined_only = true];+ // The number of tokens which are replenished in the bucket every hour.+ uint32 reload_rate = 2 [(validate.rules).uint32.lte = 62];+}++message RelayForwardLimits {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // The multiplier used to compute the total bucket size for the limits.+ // The multiplier is multiplied by the reload rate in order to compute the total bucket size.+ RelayLimitBucketSize bucket_size = 1 [(validate.rules).enum.defined_only = true];+ // The number of tokens which are replenished in the bucket every hour.+ uint32 reload_rate = 2 [(validate.rules).uint32.lte = 126];+}++message RelayEndDeviceAlwaysMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+}+message RelayEndDeviceDynamicMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // The number of consecutive uplinks without a valid downlink before the end device attempts+ // to use the relay mode to transmit messages.+ RelaySmartEnableLevel smart_enable_level = 1 [(validate.rules).enum.defined_only = true];+}+message RelayEndDeviceControlledMode {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+}++message MACCommand {+ MACCommandIdentifier cid = 1 [(validate.rules).enum = {+ defined_only: true,+ not_in: [0]+ }];++ oneof payload {+ bytes raw_payload = 2;+ ResetInd reset_ind = 3;+ ResetConf reset_conf = 4;+ LinkCheckAns link_check_ans = 5;+ LinkADRReq link_adr_req = 6;+ LinkADRAns link_adr_ans = 7;+ DutyCycleReq duty_cycle_req = 8;+ RxParamSetupReq rx_param_setup_req = 9;+ RxParamSetupAns rx_param_setup_ans = 10;+ DevStatusAns dev_status_ans = 11;+ NewChannelReq new_channel_req = 12;+ NewChannelAns new_channel_ans = 13;+ DLChannelReq dl_channel_req = 14;+ DLChannelAns dl_channel_ans = 15;+ RxTimingSetupReq rx_timing_setup_req = 16;+ TxParamSetupReq tx_param_setup_req = 17;+ RekeyInd rekey_ind = 18;+ RekeyConf rekey_conf = 19;+ ADRParamSetupReq adr_param_setup_req = 20;+ DeviceTimeAns device_time_ans = 21;+ ForceRejoinReq force_rejoin_req = 22;+ RejoinParamSetupReq rejoin_param_setup_req = 23;+ RejoinParamSetupAns rejoin_param_setup_ans = 24;+ PingSlotInfoReq ping_slot_info_req = 25;+ PingSlotChannelReq ping_slot_channel_req = 26;+ PingSlotChannelAns ping_slot_channel_ans = 27;+ BeaconTimingAns beacon_timing_ans = 28;+ BeaconFreqReq beacon_freq_req = 29;+ BeaconFreqAns beacon_freq_ans = 30;+ DeviceModeInd device_mode_ind = 31;+ DeviceModeConf device_mode_conf = 32;++ RelayConfReq relay_conf_req = 33;+ RelayConfAns relay_conf_ans = 34;+ RelayEndDeviceConfReq relay_end_device_conf_req = 35;+ RelayEndDeviceConfAns relay_end_device_conf_ans = 36;+ RelayUpdateUplinkListReq relay_update_uplink_list_req = 39;+ RelayUpdateUplinkListAns relay_update_uplink_list_ans = 40;+ RelayCtrlUplinkListReq relay_ctrl_uplink_list_req = 41;+ RelayCtrlUplinkListAns relay_ctrl_uplink_list_ans = 42;+ RelayConfigureFwdLimitReq relay_configure_fwd_limit_req = 43;+ RelayConfigureFwdLimitAns relay_configure_fwd_limit_ans = 44;+ RelayNotifyNewEndDeviceReq relay_notify_new_end_device_req = 45;+ }++ reserved 37;+ reserved "relay_filter_list_req";+ reserved 38;+ reserved "relay_filter_list_ans";++ message ResetInd {+ Minor minor_version = 1 [(validate.rules).enum = {+ defined_only: true,+ in: [1]+ }];+ }+ message ResetConf {+ Minor minor_version = 1 [(validate.rules).enum = {+ defined_only: true,+ in: [1]+ }];+ }+ message LinkCheckAns {+ // Indicates the link margin in dB of the received LinkCheckReq, relative to the demodulation floor.+ uint32 margin = 1 [(validate.rules).uint32.lte = 254];+ uint32 gateway_count = 2 [(validate.rules).uint32.lte = 255];+ }+ message LinkADRReq {+ DataRateIndex data_rate_index = 1 [(validate.rules).enum.defined_only = true];+ uint32 tx_power_index = 2 [(validate.rules).uint32.lte = 15];+ repeated bool channel_mask = 3 [(validate.rules).repeated.max_items = 16];+ reserved 4; // For RFU 7th bit of Redundancy.+ uint32 channel_mask_control = 5 [(validate.rules).uint32.lte = 7];+ uint32 nb_trans = 6 [(validate.rules).uint32.lte = 15];+ }+ message LinkADRAns {+ bool channel_mask_ack = 1;+ bool data_rate_index_ack = 2;+ bool tx_power_index_ack = 3;+ }+ message DutyCycleReq {+ AggregatedDutyCycle max_duty_cycle = 1 [(validate.rules).enum.defined_only = true];+ }+ message RxParamSetupReq {+ DataRateIndex rx2_data_rate_index = 1 [(validate.rules).enum.defined_only = true];+ DataRateOffset rx1_data_rate_offset = 2 [(validate.rules).enum.defined_only = true];+ uint64 rx2_frequency = 3 [(validate.rules).uint64.gte = 100000]; // Rx2 frequency (Hz).+ }+ message RxParamSetupAns {+ bool rx2_data_rate_index_ack = 1;+ bool rx1_data_rate_offset_ack = 2;+ bool rx2_frequency_ack = 3;+ }+ message DevStatusAns {+ // Device battery status.+ // 0 indicates that the device is connected to an external power source.+ // 1..254 indicates a battery level.+ // 255 indicates that the device was not able to measure the battery level.+ uint32 battery = 1 [(validate.rules).uint32.lte = 255];+ // SNR of the last downlink (dB; [-32, +31]).+ int32 margin = 2 [(validate.rules).int32 = {+ gte: -32,+ lte: 31+ }];+ }+ message NewChannelReq {+ uint32 channel_index = 1 [(validate.rules).uint32.lte = 255];+ uint64 frequency = 2 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }]; // Channel frequency (Hz).+ DataRateIndex min_data_rate_index = 3 [(validate.rules).enum.defined_only = true];+ DataRateIndex max_data_rate_index = 4 [(validate.rules).enum.defined_only = true];+ }+ message NewChannelAns {+ bool frequency_ack = 1;+ bool data_rate_ack = 2;+ }+ message DLChannelReq {+ uint32 channel_index = 1 [(validate.rules).uint32.lte = 255];+ uint64 frequency = 2 [(validate.rules).uint64.gte = 100000]; // Downlink channel frequency (Hz).+ }+ message DLChannelAns {+ bool channel_index_ack = 1;+ bool frequency_ack = 2;+ }+ message RxTimingSetupReq {+ RxDelay delay = 1 [(validate.rules).enum.defined_only = true];+ }+ message TxParamSetupReq {+ // Indicates the maximum EIRP value in dBm, indexed by the following vector:+ // [ 8 10 12 13 14 16 18 20 21 24 26 27 29 30 33 36 ]+ DeviceEIRP max_eirp_index = 1 [(validate.rules).enum.defined_only = true];+ bool uplink_dwell_time = 2;+ bool downlink_dwell_time = 3;+ }+ message RekeyInd {+ Minor minor_version = 1 [(validate.rules).enum.defined_only = true];+ }+ message RekeyConf {+ Minor minor_version = 1 [(validate.rules).enum.defined_only = true];+ }+ message ADRParamSetupReq {+ // Exponent e that configures the ADR_ACK_LIMIT = 2^e messages.+ ADRAckLimitExponent adr_ack_limit_exponent = 1 [(validate.rules).enum.defined_only = true];+ // Exponent e that configures the ADR_ACK_DELAY = 2^e messages.+ ADRAckDelayExponent adr_ack_delay_exponent = 2 [(validate.rules).enum.defined_only = true];+ }+ message DeviceTimeAns {+ google.protobuf.Timestamp time = 7 [(validate.rules).timestamp.required = true];+ }+ message ForceRejoinReq {+ RejoinRequestType rejoin_type = 1 [(validate.rules).enum.defined_only = true];+ DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true];+ uint32 max_retries = 3 [(validate.rules).uint32.lte = 7];+ // Exponent e that configures the rejoin period = 32 * 2^e + rand(0,32) seconds.+ RejoinPeriodExponent period_exponent = 4 [(validate.rules).enum.defined_only = true];+ }+ message RejoinParamSetupReq {+ // Exponent e that configures the rejoin counter = 2^(e+4) messages.+ RejoinCountExponent max_count_exponent = 1 [(validate.rules).enum.defined_only = true];+ // Exponent e that configures the rejoin timer = 2^(e+10) seconds.+ RejoinTimeExponent max_time_exponent = 2 [(validate.rules).enum.defined_only = true];+ }+ message RejoinParamSetupAns {+ bool max_time_exponent_ack = 1;+ }+ message PingSlotInfoReq {+ PingSlotPeriod period = 1 [(validate.rules).enum.defined_only = true];+ }+ message PingSlotChannelReq {+ uint64 frequency = 1 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }]; // Ping slot channel frequency (Hz).+ DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true];+ }+ message PingSlotChannelAns {+ bool frequency_ack = 1;+ bool data_rate_index_ack = 2;+ }+ message BeaconTimingAns {+ uint32 delay = 1 [(validate.rules).uint32.lte = 65535]; // (uint16) See LoRaWAN specification.+ uint32 channel_index = 2 [(validate.rules).uint32.lte = 255];+ }+ message BeaconFreqReq {+ uint64 frequency = 1 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }]; // Frequency of the Class B beacons (Hz).+ }+ message BeaconFreqAns {+ bool frequency_ack = 1;+ }+ message DeviceModeInd {+ Class class = 1 [(validate.rules).enum.defined_only = true];+ }+ message DeviceModeConf {+ Class class = 1 [(validate.rules).enum.defined_only = true];+ }++ message RelayConfReq {+ message Configuration {+ RelaySecondChannel second_channel = 1;+ uint32 default_channel_index = 2 [(validate.rules).uint32.lte = 255];+ RelayCADPeriodicity cad_periodicity = 3 [(validate.rules).enum.defined_only = true];+ }+ Configuration configuration = 1;+ }+ message RelayConfAns {+ bool second_channel_frequency_ack = 1;+ bool second_channel_ack_offset_ack = 2;+ bool second_channel_data_rate_index_ack = 3;+ bool second_channel_index_ack = 4;+ bool default_channel_index_ack = 5;+ bool cad_periodicity_ack = 6;+ }+ message RelayEndDeviceConfReq {+ message Configuration {+ oneof mode {+ option (validate.required) = true;++ RelayEndDeviceAlwaysMode always = 1;+ RelayEndDeviceDynamicMode dynamic = 2;+ RelayEndDeviceControlledMode end_device_controlled = 3;+ }+ uint32 backoff = 4 [(validate.rules).uint32.lte = 63];+ RelaySecondChannel second_channel = 5;++ string serving_device_id = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ }+ Configuration configuration = 1;+ }+ message RelayEndDeviceConfAns {+ bool second_channel_frequency_ack = 1;+ reserved 2; // second_channel_ack_offset_ack does not exist in the relay specification.+ reserved "second_channel_ack_offset_ack";+ bool second_channel_data_rate_index_ack = 3;+ bool second_channel_index_ack = 4;+ bool backoff_ack = 5;+ }+ message RelayUpdateUplinkListReq {+ uint32 rule_index = 1 [(validate.rules).uint32.lte = 15];+ RelayUplinkForwardLimits forward_limits = 2;+ bytes dev_addr = 3 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ uint32 w_f_cnt = 4;+ bytes root_wor_s_key = 5 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];++ string device_id = 6 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ bytes session_key_id = 7;+ }+ message RelayUpdateUplinkListAns {}+ message RelayCtrlUplinkListReq {+ uint32 rule_index = 1 [(validate.rules).uint32.lte = 15];+ RelayCtrlUplinkListAction action = 2;+ }+ message RelayCtrlUplinkListAns {+ bool rule_index_ack = 1;+ uint32 w_f_cnt = 2;+ }+ message RelayConfigureFwdLimitReq {+ RelayResetLimitCounter reset_limit_counter = 1;+ RelayForwardLimits join_request_limits = 2;+ RelayForwardLimits notify_limits = 3;+ RelayForwardLimits global_uplink_limits = 4;+ RelayForwardLimits overall_limits = 5;+ }+ message RelayConfigureFwdLimitAns {}+ message RelayNotifyNewEndDeviceReq {+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ int32 snr = 2 [(validate.rules).int32 = {+ lte: 11,+ gte: -20+ }];+ int32 rssi = 3 [(validate.rules).int32 = {+ lte: -15,+ gte: -142+ }];+ }+}++message MACCommands {+ repeated MACCommand commands = 1;+}++enum AggregatedDutyCycle {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "DUTY_CYCLE"+ };++ DUTY_CYCLE_1 = 0; // 100%.+ DUTY_CYCLE_2 = 1; // 50%.+ DUTY_CYCLE_4 = 2; // 25%.+ DUTY_CYCLE_8 = 3; // 12.5%.+ DUTY_CYCLE_16 = 4; // 6.25%.+ DUTY_CYCLE_32 = 5; // 3.125%.+ DUTY_CYCLE_64 = 6; // 1.5625%.+ DUTY_CYCLE_128 = 7; // Roughly 0.781%.+ DUTY_CYCLE_256 = 8; // Roughly 0.390%.+ DUTY_CYCLE_512 = 9; // Roughly 0.195%.+ DUTY_CYCLE_1024 = 10; // Roughly 0.098%.+ DUTY_CYCLE_2048 = 11; // Roughly 0.049%.+ DUTY_CYCLE_4096 = 12; // Roughly 0.024%.+ DUTY_CYCLE_8192 = 13; // Roughly 0.012%.+ DUTY_CYCLE_16384 = 14; // Roughly 0.006%.+ DUTY_CYCLE_32768 = 15; // Roughly 0.003%.+}++enum PingSlotPeriod {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "PING_EVERY"+ };++ PING_EVERY_1S = 0; // Every second.+ PING_EVERY_2S = 1; // Every 2 seconds.+ PING_EVERY_4S = 2; // Every 4 seconds.+ PING_EVERY_8S = 3; // Every 8 seconds.+ PING_EVERY_16S = 4; // Every 16 seconds.+ PING_EVERY_32S = 5; // Every 32 seconds.+ PING_EVERY_64S = 6; // Every 64 seconds.+ PING_EVERY_128S = 7; // Every 128 seconds.+}++enum RejoinCountExponent {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "REJOIN_COUNT"+ };++ REJOIN_COUNT_16 = 0;+ REJOIN_COUNT_32 = 1;+ REJOIN_COUNT_64 = 2;+ REJOIN_COUNT_128 = 3;+ REJOIN_COUNT_256 = 4;+ REJOIN_COUNT_512 = 5;+ REJOIN_COUNT_1024 = 6;+ REJOIN_COUNT_2048 = 7;+ REJOIN_COUNT_4096 = 8;+ REJOIN_COUNT_8192 = 9;+ REJOIN_COUNT_16384 = 10;+ REJOIN_COUNT_32768 = 11;+ REJOIN_COUNT_65536 = 12;+ REJOIN_COUNT_131072 = 13;+ REJOIN_COUNT_262144 = 14;+ REJOIN_COUNT_524288 = 15;+}++enum RejoinTimeExponent {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "REJOIN_TIME"+ };++ REJOIN_TIME_0 = 0; // Every ~17.1 minutes.+ REJOIN_TIME_1 = 1; // Every ~34.1 minutes.+ REJOIN_TIME_2 = 2; // Every ~1.1 hours.+ REJOIN_TIME_3 = 3; // Every ~2.3 hours.+ REJOIN_TIME_4 = 4; // Every ~4.6 hours.+ REJOIN_TIME_5 = 5; // Every ~9.1 hours.+ REJOIN_TIME_6 = 6; // Every ~18.2 hours.+ REJOIN_TIME_7 = 7; // Every ~1.5 days.+ REJOIN_TIME_8 = 8; // Every ~3.0 days.+ REJOIN_TIME_9 = 9; // Every ~6.1 days.+ REJOIN_TIME_10 = 10; // Every ~12.1 days.+ REJOIN_TIME_11 = 11; // Every ~3.5 weeks.+ REJOIN_TIME_12 = 12; // Every ~1.6 months.+ REJOIN_TIME_13 = 13; // Every ~3.2 months.+ REJOIN_TIME_14 = 14; // Every ~6.4 months.+ REJOIN_TIME_15 = 15; // Every ~1.1 year.+}++enum RejoinPeriodExponent {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "REJOIN_PERIOD"+ };++ REJOIN_PERIOD_0 = 0; // Every 32 to 64 seconds.+ REJOIN_PERIOD_1 = 1; // Every 64 to 96 seconds.+ REJOIN_PERIOD_2 = 2; // Every 128 to 160 seconds.+ REJOIN_PERIOD_3 = 3; // Every 256 to 288 seconds.+ REJOIN_PERIOD_4 = 4; // Every 512 to 544 seconds.+ REJOIN_PERIOD_5 = 5; // Every 1024 to 1056 seconds.+ REJOIN_PERIOD_6 = 6; // Every 2048 to 2080 seconds.+ REJOIN_PERIOD_7 = 7; // Every 4096 to 4128 seconds.+}++enum DeviceEIRP {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "DEVICE_EIRP"+ };++ DEVICE_EIRP_8 = 0; // 8 dBm.+ DEVICE_EIRP_10 = 1; // 10 dBm.+ DEVICE_EIRP_12 = 2; // 12 dBm.+ DEVICE_EIRP_13 = 3; // 13 dBm.+ DEVICE_EIRP_14 = 4; // 14 dBm.+ DEVICE_EIRP_16 = 5; // 16 dBm.+ DEVICE_EIRP_18 = 6; // 18 dBm.+ DEVICE_EIRP_20 = 7; // 20 dBm.+ DEVICE_EIRP_21 = 8; // 21 dBm.+ DEVICE_EIRP_24 = 9; // 24 dBm.+ DEVICE_EIRP_26 = 10; // 26 dBm.+ DEVICE_EIRP_27 = 11; // 27 dBm.+ DEVICE_EIRP_29 = 12; // 29 dBm.+ DEVICE_EIRP_30 = 13; // 30 dBm.+ DEVICE_EIRP_33 = 14; // 33 dBm.+ DEVICE_EIRP_36 = 15; // 36 dBm.+}++enum ADRAckLimitExponent {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "ADR_ACK_LIMIT"+ };++ ADR_ACK_LIMIT_1 = 0;+ ADR_ACK_LIMIT_2 = 1;+ ADR_ACK_LIMIT_4 = 2;+ ADR_ACK_LIMIT_8 = 3;+ ADR_ACK_LIMIT_16 = 4;+ ADR_ACK_LIMIT_32 = 5;+ ADR_ACK_LIMIT_64 = 6;+ ADR_ACK_LIMIT_128 = 7;+ ADR_ACK_LIMIT_256 = 8;+ ADR_ACK_LIMIT_512 = 9;+ ADR_ACK_LIMIT_1024 = 10;+ ADR_ACK_LIMIT_2048 = 11;+ ADR_ACK_LIMIT_4096 = 12;+ ADR_ACK_LIMIT_8192 = 13;+ ADR_ACK_LIMIT_16384 = 14;+ ADR_ACK_LIMIT_32768 = 15;+}++enum ADRAckDelayExponent {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "ADR_ACK_DELAY"+ };++ ADR_ACK_DELAY_1 = 0;+ ADR_ACK_DELAY_2 = 1;+ ADR_ACK_DELAY_4 = 2;+ ADR_ACK_DELAY_8 = 3;+ ADR_ACK_DELAY_16 = 4;+ ADR_ACK_DELAY_32 = 5;+ ADR_ACK_DELAY_64 = 6;+ ADR_ACK_DELAY_128 = 7;+ ADR_ACK_DELAY_256 = 8;+ ADR_ACK_DELAY_512 = 9;+ ADR_ACK_DELAY_1024 = 10;+ ADR_ACK_DELAY_2048 = 11;+ ADR_ACK_DELAY_4096 = 12;+ ADR_ACK_DELAY_8192 = 13;+ ADR_ACK_DELAY_16384 = 14;+ ADR_ACK_DELAY_32768 = 15;+}++enum RxDelay {+ option (thethings.json.enum) = {+ marshal_as_number: true,+ prefix: "RX_DELAY"+ };+ option (thethings.flags.enum) = {alias_map: "go.thethings.network/lorawan-stack/v3/pkg/ttnpb.RxDelay_customvalue"};++ RX_DELAY_0 = 0; // 1 second.+ RX_DELAY_1 = 1; // 1 second.+ RX_DELAY_2 = 2; // 2 seconds.+ RX_DELAY_3 = 3; // 3 seconds.+ RX_DELAY_4 = 4; // 4 seconds.+ RX_DELAY_5 = 5; // 5 seconds.+ RX_DELAY_6 = 6; // 6 seconds.+ RX_DELAY_7 = 7; // 7 seconds.+ RX_DELAY_8 = 8; // 8 seconds.+ RX_DELAY_9 = 9; // 9 seconds.+ RX_DELAY_10 = 10; // 10 seconds.+ RX_DELAY_11 = 11; // 11 seconds.+ RX_DELAY_12 = 12; // 12 seconds.+ RX_DELAY_13 = 13; // 13 seconds.+ RX_DELAY_14 = 14; // 14 seconds.+ RX_DELAY_15 = 15; // 15 seconds.+}++enum Minor {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "MINOR"+ };++ MINOR_RFU_0 = 0;+ MINOR_1 = 1;+ MINOR_RFU_2 = 2;+ MINOR_RFU_3 = 3;+ MINOR_RFU_4 = 4;+ MINOR_RFU_5 = 5;+ MINOR_RFU_6 = 6;+ MINOR_RFU_7 = 7;+ MINOR_RFU_8 = 8;+ MINOR_RFU_9 = 9;+ MINOR_RFU_10 = 10;+ MINOR_RFU_11 = 11;+ MINOR_RFU_12 = 12;+ MINOR_RFU_13 = 13;+ MINOR_RFU_14 = 14;+ MINOR_RFU_15 = 15;+}++message FrequencyValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ uint64 value = 1 [(validate.rules).uint64.gte = 100000];+}++message ZeroableFrequencyValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ uint64 value = 1 [(validate.rules).uint64 = {+ lte: 0,+ gte: 100000+ }];+}++message DataRateOffsetValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ DataRateOffset value = 1 [(validate.rules).enum.defined_only = true];+}+message DataRateIndexValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ DataRateIndex value = 1 [(validate.rules).enum.defined_only = true];+}+message PingSlotPeriodValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ PingSlotPeriod value = 1 [(validate.rules).enum.defined_only = true];+}+message AggregatedDutyCycleValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ AggregatedDutyCycle value = 1 [(validate.rules).enum.defined_only = true];+}+message RxDelayValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ RxDelay value = 1 [(validate.rules).enum.defined_only = true];+}+message ADRAckLimitExponentValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};++ ADRAckLimitExponent value = 1 [(validate.rules).enum.defined_only = true];+}+message ADRAckDelayExponentValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};++ ADRAckDelayExponent value = 1 [(validate.rules).enum.defined_only = true];+}+message DeviceEIRPValue {+ option (thethings.flags.message) = {+ select: true,+ set: true,+ wrapper: true+ };+ option (thethings.json.message) = {wrapper: true};+ DeviceEIRP value = 1 [(validate.rules).enum.defined_only = true];+}++message RelayForwardUplinkReq {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ DataRate data_rate = 1 [(validate.rules).message.required = true];+ int32 snr = 2 [(validate.rules).int32 = {+ lte: 11,+ gte: -20+ }];+ int32 rssi = 3 [(validate.rules).int32 = {+ lte: -15,+ gte: -142+ }];+ RelayWORChannel wor_channel = 4 [(validate.rules).enum.defined_only = true];+ uint64 frequency = 5 [(validate.rules).uint64.gte = 100000]; // Uplink channel frequency (Hz).+ bytes raw_payload = 6;+}++message RelayForwardDownlinkReq {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ bytes raw_payload = 1;+}++message RelayUplinkToken {+ EndDeviceIdentifiers ids = 1 [(validate.rules).message.required = true];+ bytes session_key_id = 2;+ uint32 full_f_cnt = 3;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/messages.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/messages.protonew file mode 100644index 000000000..0d09cff9e--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/messages.proto@@ -0,0 +1,754 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/duration.proto";+import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/error.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/keys.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "ttn/lorawan/v3/metadata.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Uplink message from the end device to the network+message UplinkMessage {+ // Mapping from UDP message (other fields can be set in "advanced"):+ //+ // - time: rx_metadata.time+ // - tmst: rx_metadata.timestamp+ // - freq: settings.frequency+ // - modu: settings.modulation+ // - datr: settings.data_rate_index (and derived fields)+ // - codr: settings.coding_rate+ // - size: len(raw_payload)+ // - data: raw_payload (and derived payload)+ // - rsig: rx_metadata+ // - ant: rx_metadata.antenna_index+ // - chan: rx_metadata.channel_index+ // - rssis: rx_metadata.rssi+ // - lsnr: rx_metadata.snr++ // Mapping from BACKEND message:+ //+ // - PHYPayload: raw_payload+ // - FRMPayload: payload.mac_payload.frm_payload+ // - DevEUI: end_device.dev_eui+ // - DevAddr: end_device.dev_addr+ // - ULMetadata:+ // - DevEUI: end_device.dev_eui+ // - DevAddr: end_device.dev_addr+ // - FPort: payload.mac_payload.f_port+ // - FCntUp: payload.mac_payload.f_hdr.f_cnt+ // - Confirmed: payload.mhdr.m_type+ // - DataRate: settings.data_rate_index (and derived fields)+ // - ULFreq: settings.frequency+ // - RecvTime: included in each rx_metadata+ // - GWCnt: derived from rx_metadata contents+ // - GWInfo:+ // - ID: rx_metadata.gateway_id+ // - RSSI: rx_metadata.rssi+ // - SNR: rx_metadata.snr+ // - Lat: rx_metadata.location.latitude+ // - Lon: rx_metadata.location.longitude++ bytes raw_payload = 1;+ Message payload = 2;+ reserved 3; // end_device_ids (obsolete).+ TxSettings settings = 4 [(validate.rules).message.required = true];+ repeated RxMetadata rx_metadata = 5;+ // Server time when a component received the message.+ // The Gateway Server and Network Server set this value to their local server time of reception.+ google.protobuf.Timestamp received_at = 6;+ repeated string correlation_ids = 7 [(validate.rules).repeated.items.string.max_len = 100];+ reserved 8; // gateway_channel_index (obsolete).+ // Index of the device channel that received the message.+ // Set by Network Server.+ uint32 device_channel_index = 9 [(validate.rules).uint32 = {lte: 255}];++ // Consumed airtime for the transmission of the uplink message. Calculated by Network Server using the RawPayload size and the transmission settings.+ google.protobuf.Duration consumed_airtime = 10;++ // Cyclic Redundancy Check (CRC) status of demodulating the frame.+ // If unset, the modulation does not support CRC or the gateway did not provide a CRC status.+ // If set to false, this message should not be processed.+ google.protobuf.BoolValue crc_status = 11;+}++// Downlink message from the network to the end device+message DownlinkMessage {+ // Mapping from UDP message:+ //+ // imme: -+ // tmst: scheduled.timestamp+ // tmms: scheduled.time+ // freq: scheduled.frequency+ // rfch: (0)+ // powe: scheduled.tx_power+ // modu: scheduled.modulation+ // datr: scheduled.data_rate_index (derived)+ // codr: scheduled.coding_rate+ // fdev: (derived from bandwidth)+ // ipol: scheduled.invert_polarization+ // prea: [scheduled.advanced]+ // size: (derived from len(raw_payload))+ // data: raw_payload+ // ncrc: [scheduled.advanced]++ // Mapping from BACKEND message:+ //+ // - PHYPayload: raw_payload+ // - FRMPayload: payload.mac_payload.frm_payload+ // - DevEUI: end_device_ids.dev_eui+ // - DevAddr: end_device_ids.dev_addr+ // - DLMetadata:+ // - DevEUI: end_device_ids.dev_eui+ // - DevAddr: end_device_ids.dev_addr+ // - FPort: payload.mac_payload.f_port+ // - FCntDown: payload.mac_payload.f_hdr.f_cnt+ // - Confirmed: payload.mhdr.m_type+ // - RxDelay1: request.rx1_delay+ // - DLFreq1: request.rx1_frequency+ // - DLFreq2: request.rx2_frequency+ // - DataRate1: request_rx1_data_rate_index+ // - DataRate2: request.rx2_data_rate_index+ // - GWInfo:+ // - ID: request.gateway_ids.gateway_id+ // - HiPriorityFlag: request.priority >= HIGH++ bytes raw_payload = 1;+ Message payload = 2;+ EndDeviceIdentifiers end_device_ids = 3;+ oneof settings {+ option (validate.required) = true;++ TxRequest request = 4;+ TxSettings scheduled = 5;+ }+ repeated string correlation_ids = 6 [(validate.rules).repeated.items.string.max_len = 100];+ bytes session_key_id = 7 [(validate.rules).bytes.max_len = 2048];+}++message TxAcknowledgment {+ // Correlation IDs for the downlink message.+ // Set automatically by the UDP and LBS frontends.+ // For gRPC and the MQTT v3 frontends, the correlation IDs must match the ones of the downlink message the Tx acknowledgment message refers to.+ repeated string correlation_ids = 1 [(validate.rules).repeated.items.string.max_len = 100];++ enum Result {+ option (thethings.json.enum) = {marshal_as_string: true};++ SUCCESS = 0;+ UNKNOWN_ERROR = 1;+ TOO_LATE = 2;+ TOO_EARLY = 3;+ COLLISION_PACKET = 4;+ COLLISION_BEACON = 5;+ TX_FREQ = 6;+ TX_POWER = 7;+ GPS_UNLOCKED = 8;+ }+ Result result = 2 [(validate.rules).enum.defined_only = true];++ // The acknowledged downlink message. Set by the Gateway Server.+ DownlinkMessage downlink_message = 3;+}++message GatewayTxAcknowledgment {+ GatewayIdentifiers gateway_ids = 1;+ TxAcknowledgment tx_ack = 2;+}++message GatewayUplinkMessage {+ UplinkMessage message = 1 [(validate.rules).message.required = true];+ // LoRaWAN band ID of the gateway.+ string band_id = 2;+}++message LastBatteryPercentage {+ // Frame counter value of last uplink containing DevStatusAns.+ uint32 f_cnt = 1;+ // The battery percentage of the end device.+ // The value is defined in the [0, 100] interval.+ google.protobuf.FloatValue value = 2 [(validate.rules).float = {+ gte: 0,+ lte: 100+ }];+ // Time when last DevStatus MAC command was received.+ google.protobuf.Timestamp received_at = 3;+}++message ApplicationUplink {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Join Server issued identifier for the session keys used by this uplink.+ bytes session_key_id = 1 [(validate.rules).bytes.max_len = 2048];+ // LoRaWAN FPort of the uplink message.+ uint32 f_port = 2 [(validate.rules).uint32 = {+ lte: 255,+ not_in: [224]+ }];+ // LoRaWAN FCntUp of the uplink message.+ uint32 f_cnt = 3;++ // The frame payload of the uplink message.+ // The payload is still encrypted if the skip_payload_crypto field of the EndDevice+ // is true, which is indicated by the presence of the app_s_key field.+ bytes frm_payload = 4;++ // The decoded frame payload of the uplink message.+ // This field is set by the message processor that is configured for the end device (see formatters) or application (see default_formatters).+ google.protobuf.Struct decoded_payload = 5;+ // Warnings generated by the message processor while decoding the frm_payload.+ repeated string decoded_payload_warnings = 12;++ // The normalized frame payload of the uplink message.+ // This field is set by the message processor that is configured for the end device (see formatters) or application (see default_formatters).+ // If the message processor is a custom script, there is no uplink normalizer script and the decoded output is valid+ // normalized payload, this field contains the decoded payload.+ repeated google.protobuf.Struct normalized_payload = 17;+ // Warnings generated by the message processor while normalizing the decoded payload.+ repeated string normalized_payload_warnings = 18;++ // A list of metadata for each antenna of each gateway that received this message.+ repeated RxMetadata rx_metadata = 6;++ // Transmission settings used by the end device.+ TxSettings settings = 7 [(validate.rules).message.required = true];++ // Server time when the Network Server received the message.+ google.protobuf.Timestamp received_at = 8;++ // The AppSKey of the current session.+ // This field is only present if the skip_payload_crypto field of the EndDevice+ // is true.+ // Can be used to decrypt uplink payloads and encrypt downlink payloads.+ KeyEnvelope app_s_key = 9;+ // The last AFCntDown of the current session.+ // This field is only present if the skip_payload_crypto field of the EndDevice+ // is true.+ // Can be used with app_s_key to encrypt downlink payloads.+ uint32 last_a_f_cnt_down = 10;++ // Indicates whether the end device used confirmed data uplink.+ bool confirmed = 11;++ // Consumed airtime for the transmission of the uplink message. Calculated by Network Server using the raw payload size and the transmission settings.+ google.protobuf.Duration consumed_airtime = 13;++ // Packet error rate of the recent uplinks in the current session.+ // Calculated by the Network Server. The value is defined in the [0, 1] interval.+ float packet_error_rate = 19;++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 14;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 15;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 16;++ // Last battery percentage of the end device.+ // Received via the DevStatus MAC command at last_dev_status_received_at or earlier.+ // Set by the Network Server while handling the message.+ LastBatteryPercentage last_battery_percentage = 20;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 21 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 22+}++message ApplicationUplinkNormalized {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ // Join Server issued identifier for the session keys used by this uplink.+ bytes session_key_id = 1 [(validate.rules).bytes.max_len = 2048];+ // LoRaWAN FPort of the uplink message.+ uint32 f_port = 2 [(validate.rules).uint32 = {+ gte: 1,+ lte: 255,+ not_in: [224]+ }];+ // LoRaWAN FCntUp of the uplink message.+ uint32 f_cnt = 3;++ // The frame payload of the uplink message.+ // This field is always decrypted with AppSKey.+ bytes frm_payload = 4;++ // The normalized frame payload of the uplink message.+ // This field is set for each item in normalized_payload in the corresponding ApplicationUplink message.+ google.protobuf.Struct normalized_payload = 5 [(validate.rules).message.required = true];+ // This field is set to normalized_payload_warnings in the corresponding ApplicationUplink message.+ repeated string normalized_payload_warnings = 6;++ // A list of metadata for each antenna of each gateway that received this message.+ repeated RxMetadata rx_metadata = 7;++ // Transmission settings used by the end device.+ TxSettings settings = 8 [(validate.rules).message.required = true];++ // Server time when the Network Server received the message.+ google.protobuf.Timestamp received_at = 9 [(validate.rules).timestamp.required = true];++ // Indicates whether the end device used confirmed data uplink.+ bool confirmed = 10;++ // Consumed airtime for the transmission of the uplink message. Calculated by Network Server using the raw payload size and the transmission settings.+ google.protobuf.Duration consumed_airtime = 11;++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 12;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 13;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 14;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 15 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 16+}++message ApplicationLocation {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ string service = 1;+ Location location = 2 [(validate.rules).message.required = true];+ map<string, string> attributes = 3 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];+}++message ApplicationJoinAccept {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ // Join Server issued identifier for the session keys negotiated in this join.+ bytes session_key_id = 1 [(validate.rules).bytes.max_len = 2048];+ // Encrypted Application Session Key (if Join Server sent it to Network Server).+ KeyEnvelope app_s_key = 2;+ // Downlink messages in the queue that got invalidated because of the session change.+ repeated ApplicationDownlink invalidated_downlinks = 3;+ // Indicates whether the security context refers to the pending session, i.e. when this join-accept is an answer to a+ // rejoin-request.+ bool pending_session = 4;+ // Server time when the Network Server received the message.+ google.protobuf.Timestamp received_at = 8 [(validate.rules).timestamp.required = true];++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 9;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 10;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 11;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 12 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 13+}++message ApplicationDownlink {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Join Server issued identifier for the session keys used by this downlink.+ bytes session_key_id = 1 [+ (validate.rules).bytes.max_len = 2048,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];+ uint32 f_port = 2 [(validate.rules).uint32 = {+ lte: 255,+ not_in: [224]+ }];+ uint32 f_cnt = 3;++ // The frame payload of the downlink message.+ // The payload is encrypted if the skip_payload_crypto field of the EndDevice+ // is true.+ bytes frm_payload = 4 [+ (validate.rules).bytes.max_len = 255,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];++ // The decoded frame payload of the downlink message.+ // When scheduling downlink with a message processor configured for the end device (see formatters) or application (see default_formatters),+ // this fields acts as input for the downlink encoder, and the output is set to frm_payload.+ // When reading downlink (listing the queue, downlink message events, etc), this fields acts as output of the downlink decoder, and the input is frm_payload.+ google.protobuf.Struct decoded_payload = 5;+ // Warnings generated by the message processor while encoding frm_payload (scheduling downlink) or decoding the frm_payload (reading downlink).+ repeated string decoded_payload_warnings = 10;++ bool confirmed = 6;++ message ClassBC {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Possible gateway identifiers, antenna index, and group index to use for this downlink message.+ // The Network Server selects one of these gateways for downlink, based on connectivity, signal quality, channel utilization and an available slot.+ // If none of the gateways can be selected, the downlink message fails.+ // If empty, a gateway and antenna is selected automatically from the gateways seen in recent uplinks.+ // If group index is set, gateways will be grouped by the index for the Network Server to select one gateway per group.+ repeated ClassBCGatewayIdentifiers gateways = 7;+ // Absolute time when the downlink message should be transmitted.+ // This requires the gateway to have GPS time synchronization.+ // If the time is in the past or if there is a scheduling conflict, the downlink message fails.+ // If null, the time is selected based on slot availability. This is recommended in class B mode.+ google.protobuf.Timestamp absolute_time = 8;+ }+ // Optional gateway and timing information for class B and C.+ // If set, this downlink message will only be transmitted as class B or C downlink.+ // If not set, this downlink message may be transmitted in class A, B and C.+ ClassBC class_b_c = 7;+ // Priority for scheduling the downlink message.+ TxSchedulePriority priority = 8 [(validate.rules).enum.defined_only = true];++ repeated string correlation_ids = 9 [(validate.rules).repeated.items.string.max_len = 100];++ message ConfirmedRetry {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };++ // The number of attempted confirmed downlink acknowledgements.+ uint32 attempt = 1;+ // The maximum number of confirmed downlink acknowledgement attempts.+ // If null, the Application Server configuration is used instead.+ google.protobuf.UInt32Value max_attempts = 2 [(validate.rules).uint32 = {+ gt: 0,+ lte: 100+ }];+ }++ ConfirmedRetry confirmed_retry = 11;++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 12;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 13;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 14;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 15 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 16+}++message ApplicationDownlinks {+ repeated ApplicationDownlink downlinks = 1;+}++message ApplicationDownlinkFailed {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ ApplicationDownlink downlink = 1 [(validate.rules).message.required = true];+ ErrorDetails error = 2 [(validate.rules).message.required = true];++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 3;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 4;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 5;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 7+}++message ApplicationInvalidatedDownlinks {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ repeated ApplicationDownlink downlinks = 1;+ uint32 last_f_cnt_down = 2;+ bytes session_key_id = 3 [(validate.rules).bytes.max_len = 2048];++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 4;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 5;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 6;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 7 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 8+}++message DownlinkQueueOperationErrorDetails {+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ bytes session_key_id = 2 [(validate.rules).bytes.max_len = 2048];+ uint32 min_f_cnt_down = 3;++ bytes pending_dev_addr = 4 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ bytes pending_session_key_id = 5 [(validate.rules).bytes.max_len = 2048];+ uint32 pending_min_f_cnt_down = 6;+}++message ApplicationServiceData {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ string service = 1;+ google.protobuf.Struct data = 2;++ // End device location metadata, set by the Application Server while handling the message.+ map<string, Location> locations = 3;++ // End device version identifiers, set by the Application Server while handling the message.+ EndDeviceVersionIdentifiers version_ids = 4;++ // Network identifiers, set by the Network Server that handles the message.+ NetworkIdentifiers network_ids = 5;++ // Attributes for devices, set by the Application Server while handling the message.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // next: 7+}++// Application uplink message.+message ApplicationUp {+ option (thethings.flags.message) = {+ select: true,+ set: false+ };+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ repeated string correlation_ids = 2 [(validate.rules).repeated.items.string.max_len = 100];+ // Server time when the Application Server received the message.+ google.protobuf.Timestamp received_at = 12;++ oneof up {+ option (validate.required) = true;++ ApplicationUplink uplink_message = 3;+ ApplicationUplinkNormalized uplink_normalized = 15;+ ApplicationJoinAccept join_accept = 4;+ ApplicationDownlink downlink_ack = 5;+ ApplicationDownlink downlink_nack = 6;+ ApplicationDownlink downlink_sent = 7;+ ApplicationDownlinkFailed downlink_failed = 8;+ ApplicationDownlink downlink_queued = 9;+ ApplicationInvalidatedDownlinks downlink_queue_invalidated = 10;+ ApplicationLocation location_solved = 11;+ ApplicationServiceData service_data = 13;+ }++ // Signals if the message is coming from the Network Server or is simulated.+ // The Application Server automatically sets this field, and callers must not manually set it.+ bool simulated = 14;++ // next: 17+}++enum PayloadFormatter {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "FORMATTER"+ };++ // No payload formatter to work with raw payload only.+ FORMATTER_NONE = 0;+ // Use payload formatter for the end device type from a repository.+ FORMATTER_REPOSITORY = 1;+ // gRPC service payload formatter. The parameter is the host:port of the service.+ FORMATTER_GRPC_SERVICE = 2;+ // Custom payload formatter that executes Javascript code. The parameter is a JavaScript filename.+ FORMATTER_JAVASCRIPT = 3;+ // CayenneLPP payload formatter.+ FORMATTER_CAYENNELPP = 4;+ // More payload formatters can be added.+}++message MessagePayloadFormatters {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Payload formatter for uplink messages, must be set together with its parameter.+ PayloadFormatter up_formatter = 1 [(validate.rules).enum.defined_only = true];+ // Parameter for the up_formatter, must be set together. The API enforces a maximum length of 16KB, but the size may be restricted further by deployment configuration.+ string up_formatter_parameter = 2 [(validate.rules).string.max_len = 40960];+ // Payload formatter for downlink messages, must be set together with its parameter.+ PayloadFormatter down_formatter = 3 [(validate.rules).enum.defined_only = true];+ // Parameter for the down_formatter, must be set together. The API enforces a maximum length of 16KB, but the size may be restricted further by deployment configuration.+ string down_formatter_parameter = 4 [(validate.rules).string.max_len = 40960];+}++message DownlinkQueueRequest {+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+ repeated ApplicationDownlink downlinks = 2 [(validate.rules).repeated.max_items = 100000];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/metadata.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/metadata.protonew file mode 100644index 000000000..fd9f16e9a--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/metadata.proto@@ -0,0 +1,227 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/struct.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Contains metadata for a received message. Each antenna that receives+// a message corresponds to one RxMetadata.+message RxMetadata {+ GatewayIdentifiers gateway_ids = 1 [(validate.rules).message.required = true];+ PacketBrokerMetadata packet_broker = 18;+ RelayMetadata relay = 23;++ uint32 antenna_index = 2;+ // Timestamp at the end of the transmission, provided by the gateway. The accuracy is undefined.+ google.protobuf.Timestamp time = 3;+ // Gateway concentrator timestamp when the Rx finished (microseconds).+ uint32 timestamp = 4;+ // Gateway's internal fine timestamp when the Rx finished (nanoseconds).+ uint64 fine_timestamp = 5;+ // Encrypted gateway's internal fine timestamp when the Rx finished (nanoseconds).+ bytes encrypted_fine_timestamp = 6;+ string encrypted_fine_timestamp_key_id = 7;+ // Received signal strength indicator (dBm).+ // This value equals `channel_rssi`.+ float rssi = 8;+ // Received signal strength indicator of the signal (dBm).+ google.protobuf.FloatValue signal_rssi = 16;+ // Received signal strength indicator of the channel (dBm).+ float channel_rssi = 9;+ // Standard deviation of the RSSI during preamble.+ float rssi_standard_deviation = 10;+ // Signal-to-noise ratio (dB).+ float snr = 11;+ // Frequency offset (Hz).+ int64 frequency_offset = 12;+ // Antenna location; injected by the Gateway Server.+ Location location = 13;+ // Gateway downlink path constraint; injected by the Gateway Server.+ DownlinkPathConstraint downlink_path_constraint = 14 [(validate.rules).enum.defined_only = true];+ // Uplink token to be included in the Tx request in class A downlink; injected by gateway, Gateway Server or fNS.+ bytes uplink_token = 15;+ // Index of the gateway channel that received the message.+ uint32 channel_index = 17 [(validate.rules).uint32 = {lte: 255}];+ // Hopping width; a number describing the number of steps of the LR-FHSS grid.+ uint32 hopping_width = 19;+ // Frequency drift in Hz between start and end of an LR-FHSS packet (signed).+ int32 frequency_drift = 20;+ // Timestamp at the end of the transmission, provided by the gateway.+ // Guaranteed to be based on a GPS PPS signal, with an accuracy of 1 millisecond.+ google.protobuf.Timestamp gps_time = 21;+ // Timestamp at which the Gateway Server has received the message.+ google.protobuf.Timestamp received_at = 22;+ // Advanced metadata fields+ // - can be used for advanced information or experimental features that are not yet formally defined in the API+ // - field names are written in snake_case+ google.protobuf.Struct advanced = 99;++ // next: 24+}++message Location {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The North–South position (degrees; -90 to +90), where 0 is the equator, North pole is positive, South pole is negative.+ double latitude = 1 [(validate.rules).double = {+ gte: -90,+ lte: 90+ }];+ // The East-West position (degrees; -180 to +180), where 0 is the Prime Meridian (Greenwich), East is positive , West is negative.+ double longitude = 2 [(validate.rules).double = {+ gte: -180,+ lte: 180+ }];+ // The altitude (meters), where 0 is the mean sea level.+ int32 altitude = 3;+ // The accuracy of the location (meters).+ int32 accuracy = 4;+ // Source of the location information.+ LocationSource source = 5 [+ (validate.rules).enum.defined_only = true,+ (thethings.flags.field) = {set: false}+ ];+}++enum LocationSource {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "SOURCE"+ };++ // The source of the location is not known or not set.+ SOURCE_UNKNOWN = 0;+ // The location is determined by GPS.+ SOURCE_GPS = 1;+ // The location is set in and updated from a registry.+ SOURCE_REGISTRY = 3;+ // The location is estimated with IP geolocation.+ SOURCE_IP_GEOLOCATION = 4;+ // The location is estimated with WiFi RSSI geolocation.+ SOURCE_WIFI_RSSI_GEOLOCATION = 5;+ // The location is estimated with BT/BLE RSSI geolocation.+ SOURCE_BT_RSSI_GEOLOCATION = 6;+ // The location is estimated with LoRa RSSI geolocation.+ SOURCE_LORA_RSSI_GEOLOCATION = 7;+ // The location is estimated with LoRa TDOA geolocation.+ SOURCE_LORA_TDOA_GEOLOCATION = 8;+ // The location is estimated by a combination of geolocation sources.+ SOURCE_COMBINED_GEOLOCATION = 9;+ // More estimation methods can be added.+}++message PacketBrokerMetadata {+ // Message identifier generated by Packet Broker Router.+ string message_id = 1;+ // LoRa Alliance NetID of the Packet Broker Forwarder Member.+ bytes forwarder_net_id = 2 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ // Tenant ID managed by the Packet Broker Forwarder Member.+ string forwarder_tenant_id = 3;+ // Forwarder Cluster ID of the Packet Broker Forwarder.+ string forwarder_cluster_id = 4;+ // Forwarder gateway EUI.+ bytes forwarder_gateway_eui = 9 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ // Forwarder gateway ID.+ google.protobuf.StringValue forwarder_gateway_id = 10;+ // LoRa Alliance NetID of the Packet Broker Home Network Member.+ bytes home_network_net_id = 5 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+ // Tenant ID managed by the Packet Broker Home Network Member.+ // This value is empty if it cannot be determined by the Packet Broker Router.+ string home_network_tenant_id = 6;+ // Home Network Cluster ID of the Packet Broker Home Network.+ string home_network_cluster_id = 8;+ // Hops that the message passed. Each Packet Broker Router service appends an entry.+ repeated PacketBrokerRouteHop hops = 7;+}++message PacketBrokerRouteHop {+ // Time when the service received the message.+ google.protobuf.Timestamp received_at = 1;+ // Sender of the message, typically the authorized client identifier.+ string sender_name = 2;+ // Sender IP address or host name.+ string sender_address = 3;+ // Receiver of the message.+ string receiver_name = 4;+ // Receiver agent.+ string receiver_agent = 5;+}++message RelayMetadata {+ // End device identifiers of the relay.+ string device_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // Wake on radio channel.+ RelayWORChannel wor_channel = 2 [(validate.rules).enum.defined_only = true];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/mqtt.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/mqtt.protonew file mode 100644index 000000000..c706bddc7--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/mqtt.proto@@ -0,0 +1,30 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";+package ttn.lorawan.v3;++import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The connection information of an MQTT frontend.+message MQTTConnectionInfo {+ // The public listen address of the frontend.+ string public_address = 1 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ // The public listen address of the TLS frontend.+ string public_tls_address = 2 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];+ // The username to be used for authentication.+ string username = 3;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver.protonew file mode 100644index 000000000..619421ed6--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver.proto@@ -0,0 +1,193 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "ttn/lorawan/v3/messages.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Response of GenerateDevAddr.+message GenerateDevAddrResponse {+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+}++// Request of GetDefaultMACSettings.+message GetDefaultMACSettingsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ string frequency_plan_id = 1 [(validate.rules).string.max_len = 64];+ PHYVersion lorawan_phy_version = 2 [(validate.rules).enum.defined_only = true];+}++message GetNetIDResponse {+ bytes net_id = 1 [+ (validate.rules).bytes = {+ len: 3,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"000013\""+ }+ ];+}++message GetDeviceAdressPrefixesResponse {+ repeated bytes dev_addr_prefixes = 1 [+ (validate.rules).repeated = {+ items: {+ bytes: {len: 5}+ }+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalDevAddrPrefixSlice",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.UnmarshalDevAddrPrefixSlice"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ example: "[\"2600AB00/24\"]" // NOTE: openapiv2 generator does not support customizing array items.+ }+ ];+}++// The Ns service manages the Network Server.+service Ns {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage The Things Stack Network Server."};+ // GenerateDevAddr requests a device address assignment from the Network Server.+ rpc GenerateDevAddr(google.protobuf.Empty) returns (GenerateDevAddrResponse) {+ option (google.api.http) = {get: "/ns/dev_addr"};+ }+ // GetDefaultMACSettings retrieves the default MAC settings for a frequency plan.+ rpc GetDefaultMACSettings(GetDefaultMACSettingsRequest) returns (MACSettings) {+ option (google.api.http) = {get: "/ns/default_mac_settings/{frequency_plan_id}/{lorawan_phy_version}"};+ }++ rpc GetNetID(google.protobuf.Empty) returns (GetNetIDResponse) {+ option (google.api.http) = {get: "/ns/net_id"};+ }++ rpc GetDeviceAddressPrefixes(google.protobuf.Empty) returns (GetDeviceAdressPrefixesResponse) {+ option (google.api.http) = {get: "/ns/dev_addr_prefixes"};+ }+}++// The AsNs service connects an Application Server to a Network Server.+service AsNs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The AsNs service connects an Application Server to a Network Server. This is an inter-component service and is not intended to be used by end users."};+ // Replace the entire downlink queue with the specified messages.+ // This can also be used to empty the queue by specifying no messages.+ // Note that this will trigger an immediate downlink if a downlink slot is available.+ rpc DownlinkQueueReplace(DownlinkQueueRequest) returns (google.protobuf.Empty);+ // Push downlink messages to the end of the downlink queue.+ // Note that this will trigger an immediate downlink if a downlink slot is available.+ rpc DownlinkQueuePush(DownlinkQueueRequest) returns (google.protobuf.Empty);+ // List the items currently in the downlink queue.+ rpc DownlinkQueueList(EndDeviceIdentifiers) returns (ApplicationDownlinks);+}++// The GsNs service connects a Gateway Server to a Network Server.+service GsNs {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The GsNS service connects a Gateway Server to a Network Server. This is an inter-component service and is not intended to be used by end users."};+ // Called by the Gateway Server when an uplink message arrives.+ rpc HandleUplink(UplinkMessage) returns (google.protobuf.Empty);+ // Called by the Gateway Server when a Tx acknowledgment arrives.+ rpc ReportTxAcknowledgment(GatewayTxAcknowledgment) returns (google.protobuf.Empty);+}++// The NsEndDeviceRegistry service allows clients to manage their end devices on the Network Server.+service NsEndDeviceRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage end devices on The Things Stack Network Server."};+ // Get returns the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Get(GetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {get: "/ns/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"};+ }++ // Set creates or updates the device.+ rpc Set(SetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ put: "/ns/applications/{end_device.ids.application_ids.application_id}/devices/{end_device.ids.device_id}"+ body: "*"+ additional_bindings {+ post: "/ns/applications/{end_device.ids.application_ids.application_id}/devices"+ body: "*"+ };+ };+ }++ // ResetFactoryDefaults resets device state to factory defaults.+ rpc ResetFactoryDefaults(ResetAndGetEndDeviceRequest) returns (EndDevice) {+ option (google.api.http) = {+ patch: "/ns/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"+ body: "*"+ };+ }++ // Delete deletes the device that matches the given identifiers.+ // If there are multiple matches, an error will be returned.+ rpc Delete(EndDeviceIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/ns/applications/{application_ids.application_id}/devices/{device_id}"};+ }+}++// The NsEndDeviceBatchRegistry service allows clients to manage batches of end devices on the Network Server.+service NsEndDeviceBatchRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage batches of end devices on The Things Stack Network Server."};+ // Delete a list of devices within the same application.+ // This operation is atomic; either all devices are deleted or none.+ // Devices not found are skipped and no error is returned.+ rpc Delete(BatchDeleteEndDevicesRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/ns/applications/{application_ids.application_id}/devices/batch"};+ }++ // Set the MAC settings profile for a batch of end devices.+ rpc SetMACSettingsProfile(BatchSetMACSettingsProfileRequest) returns (EndDevices) {+ option (google.api.http) = {+ post: "/ns/applications/{application_ids.application_id}/devices/mac_settings_profile/batch"+ body: "*"+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_mac_settings_profile.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_mac_settings_profile.protonew file mode 100644index 000000000..30c27f517--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_mac_settings_profile.proto@@ -0,0 +1,136 @@+// Copyright © 2024 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message CreateMACSettingsProfileRequest {+ // The MAC settings profile to create.+ MACSettingsProfile mac_settings_profile = 1 [(validate.rules).message.required = true];+}++message CreateMACSettingsProfileResponse {+ // The MAC settings profile.+ MACSettingsProfile mac_settings_profile = 1 [(validate.rules).message.required = true];+}++message GetMACSettingsProfileRequest {+ // The identifiers of the MAC settings profile.+ MACSettingsProfileIdentifiers mac_settings_profile_ids = 1 [(validate.rules).message.required = true];+ // The names of the fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message GetMACSettingsProfileResponse {+ // The MAC settings profile.+ MACSettingsProfile mac_settings_profile = 1 [(validate.rules).message.required = true];+}++message UpdateMACSettingsProfileRequest {+ // The identifiers of the MAC settings profile.+ MACSettingsProfileIdentifiers mac_settings_profile_ids = 1 [(validate.rules).message.required = true];+ // The MAC settings profile to update.+ MACSettingsProfile mac_settings_profile = 2 [(validate.rules).message.required = true];+ // The names of the fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message UpdateMACSettingsProfileResponse {+ // The MAC settings profile.+ MACSettingsProfile mac_settings_profile = 1 [(validate.rules).message.required = true];+}++message DeleteMACSettingsProfileRequest {+ // The identifiers of the MAC settings profile.+ MACSettingsProfileIdentifiers mac_settings_profile_ids = 1 [(validate.rules).message.required = true];+}++message DeleteMACSettingsProfileResponse {}++message ListMACSettingsProfilesRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // The identifiers of the application.+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];+ // The names of the fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "ids.profile_id",+ "-ids.profile_id"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+}++message ListMACSettingsProfilesResponse {+ // The MAC settings profiles.+ repeated MACSettingsProfile mac_settings_profiles = 1;+}++// The NsMACSettingsProfileRegistry service allows clients to manage MAC settings profiles on the Network Server.+// EXPERIMENTAL: This service is subject to change.+service NsMACSettingsProfileRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage MAC settings profiles on The Things Stack Network Server."};++ // Create creates a new MAC settings profile.+ rpc Create(CreateMACSettingsProfileRequest) returns (CreateMACSettingsProfileResponse) {+ option (google.api.http) = {+ post: "/ns/applications/{mac_settings_profile.ids.application_ids.application_id}/mac_settings_profiles"+ body: "*"+ };+ }++ // Get returns the MAC settings profile that matches the given identifiers.+ rpc Get(GetMACSettingsProfileRequest) returns (GetMACSettingsProfileResponse) {+ option (google.api.http) = {get: "/ns/applications/{mac_settings_profile_ids.application_ids.application_id}/mac_settings_profiles/{mac_settings_profile_ids.profile_id}"};+ }++ // Update updates the MAC settings profile that matches the given identifiers.+ rpc Update(UpdateMACSettingsProfileRequest) returns (UpdateMACSettingsProfileResponse) {+ option (google.api.http) = {+ put: "/ns/applications/{mac_settings_profile_ids.application_ids.application_id}/mac_settings_profiles/{mac_settings_profile_ids.profile_id}"+ body: "*"+ };+ }++ // Delete deletes the MAC settings profile that matches the given identifiers.+ rpc Delete(DeleteMACSettingsProfileRequest) returns (DeleteMACSettingsProfileResponse) {+ option (google.api.http) = {delete: "/ns/applications/{mac_settings_profile_ids.application_ids.application_id}/mac_settings_profiles/{mac_settings_profile_ids.profile_id}"};+ }++ // List lists the MAC settings profiles.+ rpc List(ListMACSettingsProfilesRequest) returns (ListMACSettingsProfilesResponse) {+ option (google.api.http) = {get: "/ns/applications/{application_ids.application_id}/mac_settings_profiles"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_relay.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_relay.protonew file mode 100644index 000000000..7c8f321df--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/networkserver_relay.proto@@ -0,0 +1,203 @@+// Copyright © 2023 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message CreateRelayRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Relay configuration.+ RelaySettings settings = 2 [(validate.rules).message.required = true];+}++message CreateRelayResponse {+ // Relay configuration.+ RelaySettings settings = 1;+}++message GetRelayRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Field mask of the fields to return.+ google.protobuf.FieldMask field_mask = 2;+}++message GetRelayResponse {+ // Relay configuration.+ RelaySettings settings = 1;+}++message UpdateRelayRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Relay configuration.+ RelaySettings settings = 2 [(validate.rules).message.required = true];++ // Field mask of the fields to update.+ google.protobuf.FieldMask field_mask = 3;+}++message UpdateRelayResponse {+ // Relay configuration.+ RelaySettings settings = 1;+}++message DeleteRelayRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];+}++message DeleteRelayResponse {}++message CreateRelayUplinkForwardingRuleRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Index of the uplink forwarding rule.+ uint32 index = 2 [(validate.rules).uint32.lte = 15];++ // Uplink forwarding rule.+ RelayUplinkForwardingRule rule = 3 [(validate.rules).message.required = true];+}++message CreateRelayUplinkForwardingRuleResponse {+ // Uplink forwarding rule.+ RelayUplinkForwardingRule rule = 1;+}++message GetRelayUplinkForwardingRuleRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Index of the uplink forwarding rule.+ uint32 index = 2 [(validate.rules).uint32.lte = 15];++ // Field mask of the fields to return.+ google.protobuf.FieldMask field_mask = 3;+}++message GetRelayUplinkForwardingRuleResponse {+ // Uplink forwarding rule.+ RelayUplinkForwardingRule rule = 1;+}++message ListRelayUplinkForwardingRulesRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Field mask of the fields to return.+ google.protobuf.FieldMask field_mask = 2;+}++message ListRelayUplinkForwardingRulesResponse {+ // Uplink forwarding rules.+ repeated RelayUplinkForwardingRule rules = 1;+}++message UpdateRelayUplinkForwardingRuleRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Index of the uplink forwarding rule.+ uint32 index = 2 [(validate.rules).uint32.lte = 15];++ // Uplink forwarding rule.+ RelayUplinkForwardingRule rule = 3 [(validate.rules).message.required = true];++ // Field mask of the fields to update.+ google.protobuf.FieldMask field_mask = 4;+}++message UpdateRelayUplinkForwardingRuleResponse {+ // Uplink forwarding rule.+ RelayUplinkForwardingRule rule = 1;+}++message DeleteRelayUplinkForwardingRuleRequest {+ // End device identifiers of the relay.+ EndDeviceIdentifiers end_device_ids = 1 [(validate.rules).message.required = true];++ // Index of the uplink forwarding rule.+ uint32 index = 2 [(validate.rules).uint32.lte = 15];+}++message DeleteRelayUplinkForwardingRuleResponse {}++// The NsRelayConfigurationService provides configuration management capabilities for relays.+service NsRelayConfigurationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage configuration of LoRaWAN® relay devices."};+ // Create a relay.+ rpc CreateRelay(CreateRelayRequest) returns (CreateRelayResponse) {+ option (google.api.http) = {+ post: "/ns/applications/{end_device_ids.application_ids.application_id}/relays"+ body: "*"+ };+ }+ // Get a relay.+ rpc GetRelay(GetRelayRequest) returns (GetRelayResponse) {+ option (google.api.http) = {get: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}"};+ }+ // Update a relay.+ rpc UpdateRelay(UpdateRelayRequest) returns (UpdateRelayResponse) {+ option (google.api.http) = {+ put: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}"+ body: "*"+ };+ }+ // Delete a relay.+ rpc DeleteRelay(DeleteRelayRequest) returns (DeleteRelayResponse) {+ option (google.api.http) = {delete: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}"};+ }++ // Create an uplink forwarding rule.+ rpc CreateRelayUplinkForwardingRule(CreateRelayUplinkForwardingRuleRequest) returns (CreateRelayUplinkForwardingRuleResponse) {+ option (google.api.http) = {+ post: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}/uplink-forwarding-rules"+ body: "*"+ };+ }+ // Get an uplink forwarding rule.+ rpc GetRelayUplinkForwardingRule(GetRelayUplinkForwardingRuleRequest) returns (GetRelayUplinkForwardingRuleResponse) {+ option (google.api.http) = {get: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}/uplink-forwarding-rules/{index}"};+ }+ // List uplink forwarding rules.+ rpc ListRelayUplinkForwardingRules(ListRelayUplinkForwardingRulesRequest) returns (ListRelayUplinkForwardingRulesResponse) {+ option (google.api.http) = {get: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}/uplink-forwarding-rules"};+ }+ // Update an uplink forwarding rule.+ rpc UpdateRelayUplinkForwardingRule(UpdateRelayUplinkForwardingRuleRequest) returns (UpdateRelayUplinkForwardingRuleResponse) {+ option (google.api.http) = {+ put: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}/uplink-forwarding-rules/{index}"+ body: "*"+ };+ }+ // Delete an uplink forwarding rule.+ rpc DeleteRelayUplinkForwardingRule(DeleteRelayUplinkForwardingRuleRequest) returns (DeleteRelayUplinkForwardingRuleResponse) {+ option (google.api.http) = {delete: "/ns/applications/{end_device_ids.application_ids.application_id}/relays/{end_device_ids.device_id}/uplink-forwarding-rules/{index}"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/notification_service.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/notification_service.protonew file mode 100644index 000000000..f405a8f46--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/notification_service.proto@@ -0,0 +1,257 @@+// Copyright © 2022 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/any.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message Notification {+ // The immutable ID of the notification. Generated by the server.+ string id = 1;++ // The time when the notification was triggered.+ google.protobuf.Timestamp created_at = 2;++ // The entity this notification is about.+ EntityIdentifiers entity_ids = 3;++ // The type of this notification.+ // TODO: Replace with type NotificationType in v4 https://github.com/TheThingsNetwork/lorawan-stack/issues/7384.+ string notification_type = 4 [(validate.rules).string = {+ in: [+ "unknown",+ "api_key_created",+ "api_key_changed",+ "client_requested",+ "collaborator_changed",+ "entity_state_changed",+ "invitation",+ "login_token",+ "password_changed",+ "temporary_password",+ "user_requested",+ "validate"+ ]+ }];++ // The data related to the notification.+ google.protobuf.Any data = 5;++ // If the notification was triggered by a user action, this contains the identifiers of the user that triggered the notification.+ UserIdentifiers sender_ids = 6;++ // If the notification was triggered by an event pipeline, this contains the identifiers of that pipeline.+ // EventPipelineIdentifiers event_pipeline_ids = 7;+ reserved "event_pipeline_ids";+ reserved 7;++ // Relation of the notification receiver to the entity.+ repeated NotificationReceiver receivers = 8;++ // Whether an email was sent for the notification.+ bool email = 9 [deprecated = true];++ // The status of the notification.+ NotificationStatus status = 10;++ // The time when the notification status was updated.+ google.protobuf.Timestamp status_updated_at = 11;+}++enum NotificationType {+ option (thethings.json.enum) = {marshal_as_string: true};++ UNKNOWN = 0;+ API_KEY_CREATED = 1;+ API_KEY_CHANGED = 2;+ CLIENT_REQUESTED = 3;+ COLLABORATOR_CHANGED = 4;+ ENTITY_STATE_CHANGED = 5;+ INVITATION = 6;+ LOGIN_TOKEN = 7;+ PASSWORD_CHANGED = 8;+ TEMPORARY_PASSWORD = 9;+ USER_REQUESTED = 10;+ VALIDATE = 11;+}++enum NotificationReceiver {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "NOTIFICATION_RECEIVER"+ };++ NOTIFICATION_RECEIVER_UNKNOWN = 0;++ // Notification is received by collaborators of the entity.+ // If the collaborator is an organization, the notification is received by organization members.+ NOTIFICATION_RECEIVER_COLLABORATOR = 1;++ // Notification is received by administrative contact of the entity.+ // If this is an organization, the notification is received by organization members.+ NOTIFICATION_RECEIVER_ADMINISTRATIVE_CONTACT = 3;++ // Notification is received by technical contact of the entity.+ // If this is an organization, the notification is received by organization members.+ NOTIFICATION_RECEIVER_TECHNICAL_CONTACT = 4;+}++enum NotificationStatus {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "NOTIFICATION_STATUS"+ };++ NOTIFICATION_STATUS_UNSEEN = 0;+ NOTIFICATION_STATUS_SEEN = 1;+ NOTIFICATION_STATUS_ARCHIVED = 2;+}++message CreateNotificationRequest {+ // The entity this notification is about.+ EntityIdentifiers entity_ids = 1 [(validate.rules).message.required = true];++ // The type of this notification.+ string notification_type = 2 [(validate.rules).string = {+ in: [+ "unknown",+ "api_key_created",+ "api_key_changed",+ "client_requested",+ "collaborator_changed",+ "entity_state_changed",+ "invitation",+ "login_token",+ "password_changed",+ "temporary_password",+ "user_requested",+ "validate"+ ]+ }];++ // The data related to the notification.+ google.protobuf.Any data = 3;++ // If the notification was triggered by a user action, this contains the identifiers of the user that triggered the notification.+ UserIdentifiers sender_ids = 4;++ // Receivers of the notification.+ repeated NotificationReceiver receivers = 5 [(validate.rules).repeated = {+ min_items: 1,+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];++ // Whether an email should be sent for the notification.+ bool email = 6 [deprecated = true];+}++message CreateNotificationResponse {+ string id = 1;+}++message ListNotificationsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ // The IDs of the receiving user.+ UserIdentifiers receiver_ids = 1 [(validate.rules).message.required = true];++ // Select notifications with these statuses.+ // An empty list is interpreted as "all".+ repeated NotificationStatus status = 2 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];++ // Limit the number of results per page.+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 4;+}++message ListNotificationsResponse {+ repeated Notification notifications = 1;+}++message UpdateNotificationStatusRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ // The IDs of the receiving user.+ UserIdentifiers receiver_ids = 1 [(validate.rules).message.required = true];++ // The IDs of the notifications to update the status of.+ repeated string ids = 2 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 1000,+ unique: true,+ items: {+ string: {len: 36}+ }+ }];++ // The status to set on the notifications.+ NotificationStatus status = 3 [(validate.rules).enum = {defined_only: true}];+}++// The NotificationService is used to send notifications.+service NotificationService {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Read and manage notifications."};+ // Create a new notification. Can only be called by internal services using cluster auth.+ rpc Create(CreateNotificationRequest) returns (CreateNotificationResponse);++ // List the notifications for a user or an organization.+ // When called with user credentials and empty receiver_ids, this will list+ // notifications for the current user and its organizations.+ rpc List(ListNotificationsRequest) returns (ListNotificationsResponse) {+ option (google.api.http) = {+ additional_bindings {get: "/users/{receiver_ids.user_id}/notifications"}+ };+ }++ // Batch-update multiple notifications to the same status.+ rpc UpdateStatus(UpdateNotificationStatusRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ patch: "/users/{receiver_ids.user_id}/notifications"+ body: "*"+ };+ }+}++message EntityStateChangedNotification {+ State state = 1 [(validate.rules).enum.defined_only = true];+ string state_description = 2 [(validate.rules).string.max_len = 128];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/oauth.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/oauth.protonew file mode 100644index 000000000..ed362d076--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/oauth.proto@@ -0,0 +1,110 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/timestamp.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message OAuthClientAuthorizationIdentifiers {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+}++message OAuthClientAuthorization {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+ repeated Right rights = 3;+ google.protobuf.Timestamp created_at = 4;+ google.protobuf.Timestamp updated_at = 5;+}++message OAuthClientAuthorizations {+ repeated OAuthClientAuthorization authorizations = 1;+}++message ListOAuthClientAuthorizationsRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 2 [(validate.rules).string = {+ in: [+ "",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 4;+}++message OAuthAuthorizationCode {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string user_session_id = 9 [(validate.rules).string.max_len = 64];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+ repeated Right rights = 3;+ string code = 4;+ string redirect_uri = 5 [(validate.rules).string.uri_ref = true];+ string state = 6;+ google.protobuf.Timestamp created_at = 7;+ google.protobuf.Timestamp expires_at = 8;+}++message OAuthAccessTokenIdentifiers {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+ string id = 3;+}++message OAuthAccessToken {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string user_session_id = 9 [(validate.rules).string.max_len = 64];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+ string id = 3;+ string access_token = 4;+ string refresh_token = 5;+ repeated Right rights = 6;+ google.protobuf.Timestamp created_at = 7;+ google.protobuf.Timestamp expires_at = 8;+}++message OAuthAccessTokens {+ repeated OAuthAccessToken tokens = 1;+}++message ListOAuthAccessTokensRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ ClientIdentifiers client_ids = 2 [(validate.rules).message.required = true];+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/oauth_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/oauth_services.protonew file mode 100644index 000000000..204536f12--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/oauth_services.proto@@ -0,0 +1,46 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/oauth.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The OAuthAuthorizationRegistry service, exposed by the Identity Server,+// is used to manage OAuth client authorizations for users.+service OAuthAuthorizationRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage OAuth client authorizations for users."};+ // List OAuth clients that are authorized by the user.+ rpc List(ListOAuthClientAuthorizationsRequest) returns (OAuthClientAuthorizations) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/authorizations"};+ }+ // List OAuth access tokens issued to the OAuth client on behalf of the user.+ rpc ListTokens(ListOAuthAccessTokensRequest) returns (OAuthAccessTokens) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/authorizations/{client_ids.client_id}/tokens"};+ }+ // Delete (de-authorize) an OAuth client for the user.+ rpc Delete(OAuthClientAuthorizationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_ids.user_id}/authorizations/{client_ids.client_id}"};+ }+ // Delete (invalidate) an OAuth access token.+ rpc DeleteToken(OAuthAccessTokenIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_ids.user_id}/authorizations/{client_ids.client_id}/tokens/{id}"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/organization.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/organization.protonew file mode 100644index 000000000..4fbb1fed8--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/organization.proto@@ -0,0 +1,251 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message Organization {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The identifiers of the organization. These are public and can be seen by any authenticated user in the network.+ OrganizationIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // When the organization was created. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the organization was last updated. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the organization was deleted. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp deleted_at = 8 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // The name of the organization. This information is public and can be seen by any authenticated user in the network.+ string name = 4 [(validate.rules).string.max_len = 50];+ // A description for the organization.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this organization. Typically used for organizing organizations or for storing integration-specific data.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Contact information for this organization. Typically used to indicate who to contact with security/billing questions about the organization.+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];++ OrganizationOrUserIdentifiers administrative_contact = 9;+ OrganizationOrUserIdentifiers technical_contact = 10;++ reserved 11;+ reserved "application_limit";+ reserved 12;+ reserved "client_limit";+ reserved 13;+ reserved "gateway_limit";++ // Determines if a notification will be sent to the collaborators. If false it, notifications will be sent only to the+ // administrative or technical contact.+ bool fanout_notifications = 14;++ // next: 15+}++message Organizations {+ repeated Organization organizations = 1;+}++message GetOrganizationRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ // The names of the organization fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message ListOrganizationsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // By default we list all organizations the caller has rights on.+ // Set the user to instead list the organizations+ // where the user or organization is collaborator on.+ // NOTE: It is currently not possible to have organizations collaborating on+ // other organizations.+ OrganizationOrUserIdentifiers collaborator = 1 [(thethings.flags.field) = {hidden: true}];+ // The names of the organization fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 3 [(validate.rules).string = {+ in: [+ "",+ "organization_id",+ "-organization_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 4 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 5;+ // Only return recently deleted organizations.+ bool deleted = 6;+}++message CreateOrganizationRequest {+ Organization organization = 1 [(validate.rules).message.required = true];+ // Collaborator to grant all rights on the newly created application.+ // NOTE: It is currently not possible to have organizations collaborating on+ // other organizations.+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message UpdateOrganizationRequest {+ Organization organization = 1 [(validate.rules).message.required = true];+ // The names of the organization fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message ListOrganizationAPIKeysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path.+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "api_key_id",+ "-api_key_id",+ "name",+ "-name",+ "created_at",+ "-created_at",+ "expires_at",+ "-expires_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+}++message GetOrganizationAPIKeyRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ // Unique public identifier for the API key.+ string key_id = 2;+}++message CreateOrganizationAPIKeyRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ string name = 2 [(validate.rules).string.max_len = 50];+ repeated Right rights = 3 [(validate.rules).repeated = {+ min_items: 1,+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+ google.protobuf.Timestamp expires_at = 4 [(validate.rules).timestamp.gt_now = true];+}++message UpdateOrganizationAPIKeyRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ APIKey api_key = 2 [(validate.rules).message.required = true];+ // The names of the api key fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteOrganizationAPIKeyRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ string key_id = 2;+}++message ListOrganizationCollaboratorsRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "id",+ "-id",+ "-rights",+ "rights"+ ]+ }];+}++message GetOrganizationCollaboratorRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ // NOTE: It is currently not possible to have organizations collaborating on other organizations.+ OrganizationOrUserIdentifiers collaborator = 2 [(validate.rules).message.required = true];+}++message SetOrganizationCollaboratorRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ Collaborator collaborator = 2 [(validate.rules).message.required = true];+}++message DeleteOrganizationCollaboratorRequest {+ OrganizationIdentifiers organization_ids = 1 [(validate.rules).message.required = true];+ OrganizationOrUserIdentifiers collaborator_ids = 2 [(validate.rules).message.required = true];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/organization_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/organization_services.protonew file mode 100644index 000000000..68f73fcf9--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/organization_services.proto@@ -0,0 +1,165 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/organization.proto";+import "ttn/lorawan/v3/rights.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The OrganizationRegistry service, exposed by the Identity Server, is used to manage+// organization registrations.+service OrganizationRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage organizations."};+ // Create a new organization. This also sets the given user as+ // first collaborator with all possible rights.+ rpc Create(CreateOrganizationRequest) returns (Organization) {+ option (google.api.http) = {+ post: "/users/{collaborator.user_ids.user_id}/organizations"+ body: "*"+ };+ }++ // Get the organization with the given identifiers, selecting the fields specified+ // in the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc Get(GetOrganizationRequest) returns (Organization) {+ option (google.api.http) = {get: "/organizations/{organization_ids.organization_id}"};+ }++ // List organizations where the given user or organization is a direct collaborator.+ // If no user or organization is given, this returns the organizations the caller+ // has access to.+ // Similar to Get, this selects the fields given by the field mask.+ // More or less fields may be returned, depending on the rights of the caller.+ rpc List(ListOrganizationsRequest) returns (Organizations) {+ option (google.api.http) = {+ get: "/organizations"+ additional_bindings {get: "/users/{collaborator.user_ids.user_id}/organizations"}+ };+ }++ // Update the organization, changing the fields specified by the field mask to the provided values.+ rpc Update(UpdateOrganizationRequest) returns (Organization) {+ option (google.api.http) = {+ put: "/organizations/{organization.ids.organization_id}"+ body: "*"+ };+ }++ // Delete the organization. This may not release the organization ID for reuse.+ rpc Delete(OrganizationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/organizations/{organization_id}"};+ }++ // Restore a recently deleted organization.+ //+ // Deployment configuration may specify if, and for how long after deletion,+ // entities can be restored.+ rpc Restore(OrganizationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/organizations/{organization_id}/restore"};+ }++ // Purge the organization. This will release the organization ID for reuse.+ // The user is responsible for clearing data from any (external) integrations+ // that may store and expose data by user or organization ID.+ rpc Purge(OrganizationIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/organizations/{organization_id}/purge"};+ }+}++// The OrganizationAcces service, exposed by the Identity Server, is used to manage+// API keys and collaborators of organizations.+service OrganizationAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage access to organizations"};+ // List the rights the caller has on this organization.+ rpc ListRights(OrganizationIdentifiers) returns (Rights) {+ option (google.api.http) = {get: "/organizations/{organization_id}/rights"};+ }++ // Create an API key scoped to this organization.+ // Organization API keys can give access to the organization itself, as well as+ // any application, gateway and OAuth client this organization is a collaborator of.+ rpc CreateAPIKey(CreateOrganizationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ post: "/organizations/{organization_ids.organization_id}/api-keys"+ body: "*"+ };+ }++ // List the API keys for this organization.+ rpc ListAPIKeys(ListOrganizationAPIKeysRequest) returns (APIKeys) {+ option (google.api.http) = {get: "/organizations/{organization_ids.organization_id}/api-keys"};+ }++ // Get a single API key of this organization.+ rpc GetAPIKey(GetOrganizationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {get: "/organizations/{organization_ids.organization_id}/api-keys/{key_id}"};+ }++ // Update the rights of an API key of the organization.+ // This method can also be used to delete the API key, by giving it no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc UpdateAPIKey(UpdateOrganizationAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ put: "/organizations/{organization_ids.organization_id}/api-keys/{api_key.id}"+ body: "*"+ };+ }++ // Delete a single API key of this organization.+ rpc DeleteAPIKey(DeleteOrganizationAPIKeyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/organizations/{organization_ids.organization_id}/api-keys/{key_id}"};+ }++ // Get the rights of a collaborator (member) of the organization.+ // Pseudo-rights in the response (such as the "_ALL" right) are not expanded.+ rpc GetCollaborator(GetOrganizationCollaboratorRequest) returns (GetCollaboratorResponse) {+ option (google.api.http) = {+ additional_bindings {get: "/organizations/{organization_ids.organization_id}/collaborator/user/{collaborator.user_ids.user_id}"}+ };+ }++ // Set the rights of a collaborator (member) on the organization.+ // Organization collaborators can get access to the organization itself, as well as+ // any application, gateway and OAuth client this organization is a collaborator of.+ // This method can also be used to delete the collaborator, by giving them no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc SetCollaborator(SetOrganizationCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/organizations/{organization_ids.organization_id}/collaborators"+ body: "*"+ };+ }++ // List the collaborators on this organization.+ rpc ListCollaborators(ListOrganizationCollaboratorsRequest) returns (Collaborators) {+ option (google.api.http) = {get: "/organizations/{organization_ids.organization_id}/collaborators"};+ }++ // DeleteCollaborator removes a collaborator from an organization.+ rpc DeleteCollaborator(DeleteOrganizationCollaboratorRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ // NOTE: It is currently not possible to have organizations collaborating on other organizations.+ delete: "/organizations/{organization_ids.organization_id}/collaborators/user/{collaborator_ids.user_ids.user_id}"+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/packetbrokeragent.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/packetbrokeragent.protonew file mode 100644index 000000000..04acc5dee--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/packetbrokeragent.proto@@ -0,0 +1,492 @@+// Copyright © 2021 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "google/protobuf/wrappers.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/gateway.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/messages.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The GsPba service connects a Gateway Server to a Packet Broker Agent.+service GsPba {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The GsPba service connects a Gateway Server to a Packet Broker Agent. This is an inter-component service and is not intended to be used by end users."};+ rpc PublishUplink(GatewayUplinkMessage) returns (google.protobuf.Empty);++ // Update the gateway, changing the fields specified by the field mask to the provided values.+ // To mark a gateway as online, call this rpc setting online to true, include status_public in field_mask and+ // keep calling this rpc before the returned online_ttl passes to keep the gateway online.+ rpc UpdateGateway(UpdatePacketBrokerGatewayRequest) returns (UpdatePacketBrokerGatewayResponse);+}++// Gateway respresentation for Packet Broker.+// This is a subset and superset of the Gateway message using the same data types and field tags to achieve initial wire compatibility.+// There is no (longer) wire compatibility needed; new fields may use any tag.+message PacketBrokerGateway {+ message GatewayIdentifiers {+ string gateway_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[_-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ bytes eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ }+ GatewayIdentifiers ids = 1 [(validate.rules).message.required = true];+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];+ OrganizationOrUserIdentifiers administrative_contact = 10;+ OrganizationOrUserIdentifiers technical_contact = 11;+ repeated GatewayAntenna antennas = 13 [(validate.rules).repeated.max_items = 8];+ bool status_public = 14;+ bool location_public = 15;+ repeated string frequency_plan_ids = 20 [(validate.rules).repeated = {+ max_items: 8,+ items: {+ string: {max_len: 64}+ }+ }];+ bool update_location_from_status = 21;+ bool online = 28;+ // Received packets rate (number of packets per hour).+ // This field gets updated when a value is set.+ google.protobuf.FloatValue rx_rate = 29;+ // Transmitted packets rate (number of packets per hour).+ // This field gets updated when a value is set.+ google.protobuf.FloatValue tx_rate = 30;+}++message UpdatePacketBrokerGatewayRequest {+ PacketBrokerGateway gateway = 1 [(validate.rules).message.required = true];++ // The names of the gateway fields that are considered for update.+ //+ // Online status is only updated if status_public is set. If status_public is set and false, the status will be reset.+ // If status_public is set and true, the online status is taken from the online field. The return message contains+ // the duration online_ttl for how long the gateway is considered online.+ //+ // Location is only updated if location_public is set. If location_public is set and false, the location will be reset.+ // If location_public is set and true, the first antenna location will be used as gateway location.+ google.protobuf.FieldMask field_mask = 5;+}++message UpdatePacketBrokerGatewayResponse {+ // Time to live of the online status.+ google.protobuf.Duration online_ttl = 1;+}++// The NsPba service connects a Network Server to a Packet Broker Agent.+service NsPba {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "The NsPba service connects a Network Server to a Packet Broker Agent. This is an inter-component service and is not intended to be used by end users."};+ // PublishDownlink instructs the Packet Broker Agent to publish a downlink+ // message to Packet Broker Router.+ rpc PublishDownlink(DownlinkMessage) returns (google.protobuf.Empty);+}++message PacketBrokerNetworkIdentifier {+ // LoRa Alliance NetID.+ uint32 net_id = 1;+ // Tenant identifier if the registration leases DevAddr blocks from a NetID.+ string tenant_id = 2 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+}++message PacketBrokerDevAddrBlock {+ DevAddrPrefix dev_addr_prefix = 1;+ string home_network_cluster_id = 2;+}++message PacketBrokerNetwork {+ // Packet Broker network identifier.+ PacketBrokerNetworkIdentifier id = 1;+ // Name of the network.+ string name = 2;+ // DevAddr blocks that are assigned to this registration.+ repeated PacketBrokerDevAddrBlock dev_addr_blocks = 3;+ // Contact information.+ // This field is deprecated. Use administrative_contact and technical_contact instead.+ repeated ContactInfo contact_info = 4 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];+ ContactInfo administrative_contact = 6;+ ContactInfo technical_contact = 7;+ // Whether the network is listed so it can be viewed by other networks.+ bool listed = 5;++ // next: 8+}++message PacketBrokerNetworks {+ repeated PacketBrokerNetwork networks = 1;+}++message PacketBrokerInfo {+ // The current registration, unset if there isn't a registration.+ PacketBrokerNetwork registration = 1;+ // Whether the server is configured as Forwarder (with gateways).+ bool forwarder_enabled = 2;+ // Whether the server is configured as Home Network (with end devices).+ bool home_network_enabled = 3;+ // Whether the registration can be changed.+ bool register_enabled = 4;+}++message PacketBrokerRegisterRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Whether the network should be listed in Packet Broker.+ // If unset, the value is taken from the registration settings.+ google.protobuf.BoolValue listed = 1;+}++message PacketBrokerRoutingPolicyUplink {+ // Forward join-request messages.+ bool join_request = 1;+ // Forward uplink messages with FPort of 0.+ bool mac_data = 2;+ // Forward uplink messages with FPort between 1 and 255.+ bool application_data = 3;+ // Forward RSSI and SNR.+ bool signal_quality = 4;+ // Forward gateway location, RSSI, SNR and fine timestamp.+ bool localization = 5;+}++message PacketBrokerRoutingPolicyDownlink {+ // Allow join-accept messages.+ bool join_accept = 1;+ // Allow downlink messages with FPort of 0.+ bool mac_data = 2;+ // Allow downlink messages with FPort between 1 and 255.+ bool application_data = 3;+}++message PacketBrokerDefaultRoutingPolicy {+ // Timestamp when the policy got last updated.+ google.protobuf.Timestamp updated_at = 1;+ // Uplink policy.+ PacketBrokerRoutingPolicyUplink uplink = 2;+ // Downlink policy.+ PacketBrokerRoutingPolicyDownlink downlink = 3;+}++message PacketBrokerRoutingPolicy {+ // Packet Broker identifier of the Forwarder.+ PacketBrokerNetworkIdentifier forwarder_id = 1;+ // Packet Broker identifier of the Home Network.+ PacketBrokerNetworkIdentifier home_network_id = 2;+ // Timestamp when the policy got last updated.+ google.protobuf.Timestamp updated_at = 3;+ // Uplink policy.+ PacketBrokerRoutingPolicyUplink uplink = 4;+ // Downlink policy.+ PacketBrokerRoutingPolicyDownlink downlink = 5;+}++message SetPacketBrokerDefaultRoutingPolicyRequest {+ // Uplink policy.+ PacketBrokerRoutingPolicyUplink uplink = 1 [(validate.rules).message.required = true];+ // Downlink policy.+ PacketBrokerRoutingPolicyDownlink downlink = 2 [(validate.rules).message.required = true];+}++message ListHomeNetworkRoutingPoliciesRequest {+ // Limit the number of results per page.+ uint32 limit = 1 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 2;+}++message PacketBrokerRoutingPolicies {+ repeated PacketBrokerRoutingPolicy policies = 1;+}++message SetPacketBrokerRoutingPolicyRequest {+ // Packet Broker identifier of the Home Network.+ PacketBrokerNetworkIdentifier home_network_id = 1;+ // Uplink policy.+ PacketBrokerRoutingPolicyUplink uplink = 2 [(validate.rules).message.required = true];+ // Downlink policy.+ PacketBrokerRoutingPolicyDownlink downlink = 3 [(validate.rules).message.required = true];+}++message PacketBrokerGatewayVisibility {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Show location.+ bool location = 1;+ // Show antenna placement (indoor/outdoor).+ bool antenna_placement = 2;+ // Show antenna count.+ bool antenna_count = 3;+ // Show whether the gateway produces fine timestamps.+ bool fine_timestamps = 4;+ // Show contact information.+ bool contact_info = 5;+ // Show status (online/offline).+ bool status = 6;+ // Show frequency plan.+ bool frequency_plan = 8;+ // Show receive and transmission packet rates.+ bool packet_rates = 9;+}++message PacketBrokerDefaultGatewayVisibility {+ // Timestamp when the policy got last updated.+ google.protobuf.Timestamp updated_at = 1;+ PacketBrokerGatewayVisibility visibility = 2;+}++message SetPacketBrokerDefaultGatewayVisibilityRequest {+ PacketBrokerGatewayVisibility visibility = 1 [(validate.rules).message.required = true];+}++message ListPacketBrokerNetworksRequest {+ // Limit the number of results per page.+ uint32 limit = 1 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 2;+ // If true, list only the Forwarders and Home Networks with whom a routing policy has been defined in either direction.+ bool with_routing_policy = 3;+ // Filter by tenant ID.+ string tenant_id_contains = 4 [(validate.rules).string.max_len = 100];+ // Filter by name.+ string name_contains = 5 [(validate.rules).string.max_len = 100];+}++message ListPacketBrokerHomeNetworksRequest {+ // Limit the number of results per page.+ uint32 limit = 1 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 2;+ // Filter by tenant ID.+ string tenant_id_contains = 3 [(validate.rules).string.max_len = 100];+ // Filter by name.+ string name_contains = 4 [(validate.rules).string.max_len = 100];+}++message ListForwarderRoutingPoliciesRequest {+ // Packet Broker identifier of the Home Network.+ PacketBrokerNetworkIdentifier home_network_id = 1;+ // Limit the number of results per page.+ uint32 limit = 2;+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+}++// The Pba service allows clients to manage peering through Packet Broker.+service Pba {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage peering via Packet Broker."};+ // Get information about the Packet Broker registration.+ // Viewing Packet Packet information requires administrative access.+ rpc GetInfo(google.protobuf.Empty) returns (PacketBrokerInfo) {+ option (google.api.http) = {get: "/pba/info"};+ }++ // Register with Packet Broker. If no registration exists, it will be created. Any existing registration will be updated.+ // Registration settings not in the request message are taken from Packet Broker Agent configuration and caller context.+ // Packet Broker registration requires administrative access.+ // Packet Broker registration is only supported for tenants and requires Packet Broker Agent to be configured with+ // NetID level authentication. Use rpc GetInfo and check register_enabled to check whether this rpc is enabled.+ rpc Register(PacketBrokerRegisterRequest) returns (PacketBrokerNetwork) {+ option (google.api.http) = {+ put: "/pba/registration"+ body: "*"+ additional_bindings {+ post: "/pba/registration"+ body: "*"+ }+ };+ }++ // Deregister from Packet Broker.+ // Packet Broker deregistration requires administrative access.+ // Packet Broker deregistration is only supported for tenants and requires Packet Broker Agent to be configured with+ // NetID level authentication. Use rpc GetInfo and check register_enabled to check whether this rpc is enabled.+ rpc Deregister(google.protobuf.Empty) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/pba/registration"};+ }++ // List the routing policies that Packet Broker Agent as Forwarder configured with Home Networks.+ // Listing routing policies requires administrative access.+ rpc ListHomeNetworkRoutingPolicies(ListHomeNetworkRoutingPoliciesRequest) returns (PacketBrokerRoutingPolicies) {+ option (google.api.http) = {get: "/pba/home-networks/policies"};+ }++ // Get the routing policy for the given Home Network.+ // Getting routing policies requires administrative access.+ rpc GetHomeNetworkRoutingPolicy(PacketBrokerNetworkIdentifier) returns (PacketBrokerRoutingPolicy) {+ option (google.api.http) = {+ get: "/pba/home-networks/policies/{net_id}"+ additional_bindings {get: "/pba/home-networks/policies/{net_id}/{tenant_id}"}+ };+ }++ // Set the routing policy for the given Home Network.+ // Setting routing policies requires administrative access.+ rpc SetHomeNetworkRoutingPolicy(SetPacketBrokerRoutingPolicyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/pba/home-networks/policies/{home_network_id.net_id}"+ body: "*"+ additional_bindings {+ post: "/pba/home-networks/policies/{home_network_id.net_id}"+ body: "*"+ }+ additional_bindings {+ put: "/pba/home-networks/policies/{home_network_id.net_id}/{home_network_id.tenant_id}"+ body: "*"+ }+ additional_bindings {+ post: "/pba/home-networks/policies/{home_network_id.net_id}/{home_network_id.tenant_id}"+ body: "*"+ }+ };+ }++ // Delete the routing policy for the given Home Network.+ // Deleting routing policies requires administrative access.+ rpc DeleteHomeNetworkRoutingPolicy(PacketBrokerNetworkIdentifier) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete: "/pba/home-networks/policies/{net_id}"+ additional_bindings {delete: "/pba/home-networks/policies/{net_id}/{tenant_id}"}+ };+ }++ // Get the default routing policy.+ // Getting routing policies requires administrative access.+ rpc GetHomeNetworkDefaultRoutingPolicy(google.protobuf.Empty) returns (PacketBrokerDefaultRoutingPolicy) {+ option (google.api.http) = {get: "/pba/home-networks/policies/default"};+ }++ // Set the default routing policy.+ // Setting routing policies requires administrative access.+ rpc SetHomeNetworkDefaultRoutingPolicy(SetPacketBrokerDefaultRoutingPolicyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/pba/home-networks/policies/default"+ body: "*"+ additional_bindings {+ post: "/pba/home-networks/policies/default"+ body: "*"+ }+ };+ }++ // Deletes the default routing policy.+ // Deleting routing policies requires administrative access.+ rpc DeleteHomeNetworkDefaultRoutingPolicy(google.protobuf.Empty) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/pba/home-networks/policies/default"};+ }++ // Get the default gateway visibility.+ // Getting gateway visibilities requires administrative access.+ rpc GetHomeNetworkDefaultGatewayVisibility(google.protobuf.Empty) returns (PacketBrokerDefaultGatewayVisibility) {+ option (google.api.http) = {get: "/pba/home-networks/gateway-visibilities/default"};+ }++ // Set the default gateway visibility.+ // Setting gateway visibilities requires administrative access.+ rpc SetHomeNetworkDefaultGatewayVisibility(SetPacketBrokerDefaultGatewayVisibilityRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/pba/home-networks/gateway-visibilities/default"+ body: "*"+ additional_bindings {+ post: "/pba/home-networks/gateway-visibilities/default"+ body: "*"+ }+ };+ }++ // Deletes the default gateway visibility.+ // Deleting gateway visibilities requires administrative access.+ rpc DeleteHomeNetworkDefaultGatewayVisibility(google.protobuf.Empty) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/pba/home-networks/gateway-visibilities/default"};+ }++ // List all listed networks.+ // Listing networks requires administrative access.+ rpc ListNetworks(ListPacketBrokerNetworksRequest) returns (PacketBrokerNetworks) {+ option (google.api.http) = {get: "/pba/networks"};+ }++ // List the listed home networks for which routing policies can be configured.+ // Listing home networks requires administrative access.+ rpc ListHomeNetworks(ListPacketBrokerHomeNetworksRequest) returns (PacketBrokerNetworks) {+ option (google.api.http) = {get: "/pba/home-networks"};+ }++ // List the routing policies that Forwarders configured with Packet Broker Agent as Home Network.+ // Listing routing policies requires administrative access.+ rpc ListForwarderRoutingPolicies(ListForwarderRoutingPoliciesRequest) returns (PacketBrokerRoutingPolicies) {+ option (google.api.http) = {get: "/pba/forwarders/policies"};+ }+}++message PacketBrokerAgentUplinkToken {+ bytes forwarder_net_id = 1;+ string forwarder_tenant_id = 2;+ string forwarder_cluster_id = 3;+}++message PacketBrokerAgentGatewayUplinkToken {+ string gateway_uid = 1;+ bytes token = 2;+}++message PacketBrokerAgentCompoundUplinkToken {+ bytes gateway = 1;+ bytes forwarder = 2;+ PacketBrokerAgentUplinkToken agent = 3;+}++message PacketBrokerAgentEncryptedPayload {+ bytes ciphertext = 1;+ bytes nonce = 2;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/picture.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/picture.protonew file mode 100644index 000000000..ed5471250--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/picture.proto@@ -0,0 +1,37 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";+package ttn.lorawan.v3;++import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message Picture {+ message Embedded {+ // MIME type of the picture.+ string mime_type = 1 [(validate.rules).string.max_len = 32];+ // Picture data. A data URI can be constructed as follows:+ // `data:<mime_type>;base64,<data>`.+ bytes data = 2 [(validate.rules).bytes.max_len = 8388608];+ }++ // Embedded picture.+ // Omitted if there are external URLs available (in sizes).+ Embedded embedded = 1;++ // URLs of the picture for different sizes, if available on a CDN.+ map<uint32, string> sizes = 2 [(validate.rules).map.values.string.uri_ref = true];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/qrcodegenerator.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/qrcodegenerator.protonew file mode 100644index 000000000..820a858e2--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/qrcodegenerator.proto@@ -0,0 +1,183 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/picture.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message QRCodeFormat {+ string name = 1 [(validate.rules).string.max_len = 100];+ string description = 2 [(validate.rules).string.max_len = 200];+ // The entity fields required to generate the QR code.+ google.protobuf.FieldMask field_mask = 3;+}++message QRCodeFormats {+ // Available formats. The map key is the format identifier.+ map<string, QRCodeFormat> formats = 1 [(validate.rules).map.keys.string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message GetQRCodeFormatRequest {+ // QR code format identifier. Enumerate available formats with rpc ListFormats in the EndDeviceQRCodeGenerator service.+ string format_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+}++message GenerateEndDeviceQRCodeRequest {+ // QR code format identifier. Enumerate available formats with rpc ListFormats in the EndDeviceQRCodeGenerator service.+ string format_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }];+ // End device to use as input to generate the QR code.+ EndDevice end_device = 2 [(validate.rules).message.required = true];++ message Image {+ // Requested QR code image dimension in pixels.+ uint32 image_size = 1 [(validate.rules).uint32 = {+ gte: 10,+ lte: 1000+ }];+ }+ // If set, the server will render the QR code image according to these settings.+ Image image = 3;+}++message GenerateQRCodeResponse {+ // Text representation of the QR code contents.+ string text = 1;+ // QR code in PNG format, if requested.+ Picture image = 2;+}++message ParseEndDeviceQRCodeRequest {+ // QR code format identifier.+ // Enumerate available formats with the rpc `ListFormats`.+ // If this field is not specified, the server will attempt to parse the data with each known format.+ string format_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Raw QR code contents.+ bytes qr_code = 2 [(validate.rules).bytes = {+ min_len: 10,+ max_len: 1024+ }];+}++message ParseEndDeviceQRCodeResponse {+ // Identifier of the format used to successfully parse the QR code data.+ string format_id = 1;+ EndDeviceTemplate end_device_template = 2;+}++// The EndDeviceQRCodeGenerator service provides functionality to generate and parse QR codes.+service EndDeviceQRCodeGenerator {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Generate and parse end device QR codes."};+ // Return the QR code format.+ rpc GetFormat(GetQRCodeFormatRequest) returns (QRCodeFormat) {+ option (google.api.http) = {get: "/qr-codes/end-devices/formats/{format_id}"};+ }++ // Returns the supported formats.+ rpc ListFormats(google.protobuf.Empty) returns (QRCodeFormats) {+ option (google.api.http) = {get: "/qr-codes/end-devices/formats"};+ }++ // Generates a QR code.+ rpc Generate(GenerateEndDeviceQRCodeRequest) returns (GenerateQRCodeResponse) {+ option (google.api.http) = {+ post: "/qr-codes/end-devices",+ body: "*"+ };+ }++ // Parse QR Codes of known formats and return the information contained within.+ rpc Parse(ParseEndDeviceQRCodeRequest) returns (ParseEndDeviceQRCodeResponse) {+ option (google.api.http) = {+ post: "/qr-codes/end-devices/parse",+ body: "*"+ additional_bindings {+ post: "/qr-codes/end-devices/{format_id}/parse"+ body: "*"+ }+ };+ }+}++message ParseGatewayQRCodeRequest {+ // QR code format identifier.+ // If this field is not specified, the server will default to ttigpro1.+ string format_id = 1 [(validate.rules).string = {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",+ max_len: 36+ }];+ // Raw QR code contents.+ bytes qr_code = 2 [(validate.rules).bytes = {+ min_len: 10,+ max_len: 1024+ }];+}++message ParseGatewayQRCodeResponse {+ // Identifier of the format used to parse the QR code data.+ string format_id = 1;+ bytes gateway_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ string owner_token = 3;+}++// The GatewayQRCodeGenerator service provides functionality to generate and parse QR codes for gateways.+service GatewayQRCodeGenerator {+ // Parse QR Codes of known formats and return the information contained within.+ rpc Parse(ParseGatewayQRCodeRequest) returns (ParseGatewayQRCodeResponse) {+ option (google.api.http) = {+ post: "/qr-codes/gateways/parse",+ body: "*"+ additional_bindings {+ post: "/qr-codes/gateways/{format_id}/parse"+ body: "*"+ }+ };+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/regional.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/regional.protonew file mode 100644index 000000000..32063603d--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/regional.proto@@ -0,0 +1,61 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/duration.proto";+import "ttn/lorawan/v3/gateway.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message ConcentratorConfig {+ message Channel {+ // Frequency (Hz).+ uint64 frequency = 1;+ uint32 radio = 2;+ }+ repeated Channel channels = 1;++ message LoRaStandardChannel {+ // Frequency (Hz).+ uint64 frequency = 1;+ uint32 radio = 2;+ // Bandwidth (Hz).+ uint32 bandwidth = 3;+ uint32 spreading_factor = 4;+ }+ LoRaStandardChannel lora_standard_channel = 2;+ message FSKChannel {+ // Frequency (Hz).+ uint64 frequency = 1;+ uint32 radio = 2;+ }+ FSKChannel fsk_channel = 3;++ message LBTConfiguration {+ // Received signal strength (dBm).+ float rssi_target = 1;+ // Received signal strength offset (dBm).+ float rssi_offset = 2;+ google.protobuf.Duration scan_time = 3;+ }+ LBTConfiguration lbt = 4;++ Channel ping_slot = 5;++ repeated GatewayRadio radios = 6;+ uint32 clock_source = 7;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/rights.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/rights.protonew file mode 100644index 000000000..f6f942ce7--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/rights.proto@@ -0,0 +1,273 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/timestamp.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Right is the enum that defines all the different rights to do something in the network.+enum Right {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "RIGHT"+ };++ right_invalid = 0;++ // The right to view user information.+ RIGHT_USER_INFO = 1;+ // The right to edit basic user settings.+ RIGHT_USER_SETTINGS_BASIC = 2;+ // The right to list users accounts.+ RIGHT_USER_LIST = 87;+ // The right to create an user account.+ RIGHT_USER_CREATE = 88;+ // The right to view and edit user API keys.+ RIGHT_USER_SETTINGS_API_KEYS = 3;+ // The right to delete user account.+ RIGHT_USER_DELETE = 4;+ // The right to delete user account.+ RIGHT_USER_PURGE = 66;+ // The right to view and edit authorized OAuth clients of the user.+ RIGHT_USER_AUTHORIZED_CLIENTS = 5;+ // The right to list applications the user is a collaborator of.+ RIGHT_USER_APPLICATIONS_LIST = 6;+ // The right to create an application under the user account.+ RIGHT_USER_APPLICATIONS_CREATE = 7;+ // The right to list gateways the user is a collaborator of.+ RIGHT_USER_GATEWAYS_LIST = 8;+ // The right to create a gateway under the account of the user.+ RIGHT_USER_GATEWAYS_CREATE = 9;+ // The right to list OAuth clients the user is a collaborator of.+ RIGHT_USER_CLIENTS_LIST = 10;+ // The right to create an OAuth client under the account of the user.+ RIGHT_USER_CLIENTS_CREATE = 11;+ // The right to list organizations the user is a member of.+ RIGHT_USER_ORGANIZATIONS_LIST = 12;+ // The right to create an organization under the user account.+ RIGHT_USER_ORGANIZATIONS_CREATE = 13;+ // The right to read notifications sent to the user.+ RIGHT_USER_NOTIFICATIONS_READ = 59;+ // The pseudo-right for all (current and future) user rights.+ RIGHT_USER_ALL = 14;++ // The right to view application information.+ RIGHT_APPLICATION_INFO = 15;+ // The right to edit basic application settings.+ RIGHT_APPLICATION_SETTINGS_BASIC = 16;+ // The right to view and edit application API keys.+ RIGHT_APPLICATION_SETTINGS_API_KEYS = 17;+ // The right to view and edit application collaborators.+ RIGHT_APPLICATION_SETTINGS_COLLABORATORS = 18;+ // The right to view and edit application packages and associations.+ RIGHT_APPLICATION_SETTINGS_PACKAGES = 56;+ // The right to delete application.+ RIGHT_APPLICATION_DELETE = 19;+ // The right to purge application.+ RIGHT_APPLICATION_PURGE = 64;+ // The right to view devices in application.+ RIGHT_APPLICATION_DEVICES_READ = 20;+ // The right to create devices in application.+ RIGHT_APPLICATION_DEVICES_WRITE = 21;+ // The right to view device keys in application.+ // Note that keys may not be stored in a way that supports viewing them.+ RIGHT_APPLICATION_DEVICES_READ_KEYS = 22;+ // The right to edit device keys in application.+ RIGHT_APPLICATION_DEVICES_WRITE_KEYS = 23;+ // The right to read application traffic (uplink and downlink).+ RIGHT_APPLICATION_TRAFFIC_READ = 24;+ // The right to write uplink application traffic.+ RIGHT_APPLICATION_TRAFFIC_UP_WRITE = 25;+ // The right to write downlink application traffic.+ RIGHT_APPLICATION_TRAFFIC_DOWN_WRITE = 26;+ // The right to link as Application to a Network Server for traffic exchange,+ // i.e. read uplink and write downlink (API keys only).+ // This right is typically only given to an Application Server.+ // This right implies RIGHT_APPLICATION_INFO, RIGHT_APPLICATION_TRAFFIC_READ,+ // and RIGHT_APPLICATION_TRAFFIC_DOWN_WRITE.+ RIGHT_APPLICATION_LINK = 27;+ // The pseudo-right for all (current and future) application rights.+ RIGHT_APPLICATION_ALL = 28;++ // The pseudo-right for all (current and future) OAuth client rights.+ RIGHT_CLIENT_ALL = 29;+ // The right to read client information.+ RIGHT_CLIENT_INFO = 60;+ // The right to edit basic client settings.+ RIGHT_CLIENT_SETTINGS_BASIC = 61;+ // The right to view and edit client collaborators.+ RIGHT_CLIENT_SETTINGS_COLLABORATORS = 62;+ // The right to delete a client.+ RIGHT_CLIENT_DELETE = 63;+ // The right to purge a client.+ RIGHT_CLIENT_PURGE = 68;++ // The right to view gateway information.+ RIGHT_GATEWAY_INFO = 30;+ // The right to edit basic gateway settings.+ RIGHT_GATEWAY_SETTINGS_BASIC = 31;+ // The right to view and edit gateway API keys.+ RIGHT_GATEWAY_SETTINGS_API_KEYS = 32;+ // The right to view and edit gateway collaborators.+ RIGHT_GATEWAY_SETTINGS_COLLABORATORS = 33;+ // The right to delete gateway.+ RIGHT_GATEWAY_DELETE = 34;+ // The right to purge gateway.+ RIGHT_GATEWAY_PURGE = 67;+ // The right to read gateway traffic.+ RIGHT_GATEWAY_TRAFFIC_READ = 35;+ // The right to write downlink gateway traffic.+ RIGHT_GATEWAY_TRAFFIC_DOWN_WRITE = 36;+ // The right to link as Gateway to a Gateway Server for traffic exchange,+ // i.e. write uplink and read downlink (API keys only)+ // This right is typically only given to a gateway.+ // This right implies RIGHT_GATEWAY_INFO.+ RIGHT_GATEWAY_LINK = 37;+ // The right to view gateway status.+ RIGHT_GATEWAY_STATUS_READ = 38;+ // The right to view view gateway location.+ RIGHT_GATEWAY_LOCATION_READ = 39;+ // The right to store secrets associated with this gateway.+ RIGHT_GATEWAY_WRITE_SECRETS = 57;+ // The right to retrieve secrets associated with this gateway.+ RIGHT_GATEWAY_READ_SECRETS = 58;+ // The pseudo-right for all (current and future) gateway rights.+ RIGHT_GATEWAY_ALL = 40;++ // The right to view organization information.+ RIGHT_ORGANIZATION_INFO = 41;+ // The right to edit basic organization settings.+ RIGHT_ORGANIZATION_SETTINGS_BASIC = 42;+ // The right to view and edit organization API keys.+ RIGHT_ORGANIZATION_SETTINGS_API_KEYS = 43;+ // The right to view and edit organization members.+ RIGHT_ORGANIZATION_SETTINGS_MEMBERS = 44;+ // The right to delete organization.+ RIGHT_ORGANIZATION_DELETE = 45;+ // The right to purge organization.+ RIGHT_ORGANIZATION_PURGE = 65;+ // The right to list the applications the organization is a collaborator of.+ RIGHT_ORGANIZATION_APPLICATIONS_LIST = 46;+ // The right to create an application under the organization.+ RIGHT_ORGANIZATION_APPLICATIONS_CREATE = 47;+ // The right to list the gateways the organization is a collaborator of.+ RIGHT_ORGANIZATION_GATEWAYS_LIST = 48;+ // The right to create a gateway under the organization.+ RIGHT_ORGANIZATION_GATEWAYS_CREATE = 49;+ // The right to list the OAuth clients the organization is a collaborator of.+ RIGHT_ORGANIZATION_CLIENTS_LIST = 50;+ // The right to create an OAuth client under the organization.+ RIGHT_ORGANIZATION_CLIENTS_CREATE = 51;+ // The right to add the organization as a collaborator on an existing entity.+ RIGHT_ORGANIZATION_ADD_AS_COLLABORATOR = 52;+ // The pseudo-right for all (current and future) organization rights.+ RIGHT_ORGANIZATION_ALL = 53;++ // The right to send invites to new users.+ // Note that this is not prefixed with "USER_"; it is not a right on the user entity.+ RIGHT_SEND_INVITES = 54;++ reserved 69;+ reserved 70;+ reserved 71;+ reserved 72;+ reserved 73;+ reserved 74;+ reserved 75;+ reserved 76;+ reserved 77;+ reserved 78;+ reserved 79;+ reserved 80;+ reserved 81;+ reserved 82;+ reserved 83;+ reserved 84;+ reserved 85;+ reserved 86;+ reserved 92;+ reserved 93;+ reserved 94;+ reserved 95;+ reserved 96;+ reserved 97;++ // The pseudo-right for all (current and future) possible rights.+ RIGHT_ALL = 55;++ // Next value: 89+}++message Rights {+ repeated Right rights = 1 [(validate.rules).repeated.items.enum.defined_only = true];+}++message APIKey {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // Immutable and unique public identifier for the API key.+ // Generated by the Access Server.+ string id = 1;+ // Immutable and unique secret value of the API key.+ // Generated by the Access Server.+ string key = 2;++ // User-defined (friendly) name for the API key.+ string name = 3 [(validate.rules).string.max_len = 50];++ // Rights that are granted to this API key.+ repeated Right rights = 4 [(validate.rules).repeated.items.enum.defined_only = true];++ google.protobuf.Timestamp created_at = 5;+ google.protobuf.Timestamp updated_at = 6;+ google.protobuf.Timestamp expires_at = 7 [(validate.rules).timestamp.gt_now = true];+}++message APIKeys {+ repeated APIKey api_keys = 1;+}++message Collaborator {+ OrganizationOrUserIdentifiers ids = 1 [(validate.rules).message.required = true];+ repeated Right rights = 2 [(validate.rules).repeated.items.enum.defined_only = true];+ reserved 3; // reserved for future EntityIdentifiers entity = 3;+ reserved 4; // reserved for future State state = 4;+ reserved 5; // reserved for future google.protobuf.Timestamp created_at = 5;+ reserved 6; // reserved for future google.protobuf.Timestamp updated_at = 6;+ // NOTE: Keep compatible with GetCollaboratorResponse.+}++message GetCollaboratorResponse {+ OrganizationOrUserIdentifiers ids = 1;+ repeated Right rights = 2;+ reserved 3; // reserved for future EntityIdentifiers entity = 3;+ reserved 4; // reserved for future State state = 4;+ reserved 5; // reserved for future google.protobuf.Timestamp created_at = 5;+ reserved 6; // reserved for future google.protobuf.Timestamp updated_at = 6;+ // NOTE: Keep compatible with Collaborator.+}++message Collaborators {+ repeated Collaborator collaborators = 1;+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/search_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/search_services.protonew file mode 100644index 000000000..e006aa508--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/search_services.proto@@ -0,0 +1,478 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/field_mask.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "ttn/lorawan/v3/application.proto";+import "ttn/lorawan/v3/client.proto";+import "ttn/lorawan/v3/end_device.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/gateway.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/organization.proto";+import "ttn/lorawan/v3/user.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// This message is used for finding applications in the EntityRegistrySearch service.+message SearchApplicationsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Find applications where the ID, name or description contains this substring.+ string query = 11 [(validate.rules).string.max_len = 50];+ // Find applications where the ID contains this substring.+ string id_contains = 1 [(validate.rules).string.max_len = 50];+ // Find applications where the name contains this substring.+ string name_contains = 2 [(validate.rules).string.max_len = 50];+ // Find applications where the description contains this substring.+ string description_contains = 3 [(validate.rules).string.max_len = 50];+ // Find applications where the given attributes contain these substrings.+ map<string, string> attributes_contain = 4 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ reserved 5; // Reserved for EUI or state filter.++ google.protobuf.FieldMask field_mask = 6;++ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 7 [(validate.rules).string = {+ in: [+ "",+ "application_id",+ "-application_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 8 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 9;+ // Only return recently deleted applications.+ bool deleted = 10;++ // next: 12+}++// This message is used for finding OAuth clients in the EntityRegistrySearch service.+message SearchClientsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Find OAuth clients where the ID, name or description contains this substring.+ string query = 11 [(validate.rules).string.max_len = 50];+ // Find OAuth clients where the ID contains this substring.+ string id_contains = 1 [(validate.rules).string.max_len = 50];+ // Find OAuth clients where the name contains this substring.+ string name_contains = 2 [(validate.rules).string.max_len = 50];+ // Find OAuth clients where the description contains this substring.+ string description_contains = 3 [(validate.rules).string.max_len = 50];+ // Find OAuth clients where the given attributes contain these substrings.+ map<string, string> attributes_contain = 4 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ // Find OAuth clients where the state is any of these states.+ repeated State state = 5 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];++ google.protobuf.FieldMask field_mask = 6;++ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 7 [(validate.rules).string = {+ in: [+ "",+ "client_id",+ "-client_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 8 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 9;+ // Only return recently deleted OAuth clients.+ bool deleted = 10;++ // next: 12+}++// This message is used for finding gateways in the EntityRegistrySearch service.+message SearchGatewaysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Find gateways where the ID, name, description or EUI contains this substring.+ string query = 11 [(validate.rules).string.max_len = 50];+ // Find gateways where the ID contains this substring.+ string id_contains = 1 [(validate.rules).string.max_len = 50];+ // Find gateways where the name contains this substring.+ string name_contains = 2 [(validate.rules).string.max_len = 50];+ // Find gateways where the description contains this substring.+ string description_contains = 3 [(validate.rules).string.max_len = 50];+ // Find gateways where the given attributes contain these substrings.+ map<string, string> attributes_contain = 4 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ // Find gateways where the (hexadecimal) EUI contains this substring.+ string eui_contains = 5 [(validate.rules).string.max_len = 16];++ google.protobuf.FieldMask field_mask = 6;++ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 7 [(validate.rules).string = {+ in: [+ "",+ "gateway_id",+ "-gateway_id",+ "gateway_eui",+ "-gateway_eui",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 8 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 9;+ // Only return recently deleted gateways.+ bool deleted = 10;++ // next: 12+}++// This message is used for finding organizations in the EntityRegistrySearch service.+message SearchOrganizationsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Find organizations where the ID, name or description contains this substring.+ string query = 11 [(validate.rules).string.max_len = 50];+ // Find organizations where the ID contains this substring.+ string id_contains = 1 [(validate.rules).string.max_len = 50];+ // Find organizations where the name contains this substring.+ string name_contains = 2 [(validate.rules).string.max_len = 50];+ // Find organizations where the description contains this substring.+ string description_contains = 3 [(validate.rules).string.max_len = 50];+ // Find organizations where the given attributes contain these substrings.+ map<string, string> attributes_contain = 4 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ reserved 5; // Reserved for state filter.++ google.protobuf.FieldMask field_mask = 6;++ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 7 [(validate.rules).string = {+ in: [+ "",+ "organization_id",+ "-organization_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 8 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 9;+ // Only return recently deleted organizations.+ bool deleted = 10;++ // next: 12+}++// This message is used for finding users in the EntityRegistrySearch service.+message SearchUsersRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ // Find users where the ID, name or description contains this substring.+ string query = 11 [(validate.rules).string.max_len = 50];+ // Find users where the ID contains this substring.+ string id_contains = 1 [(validate.rules).string.max_len = 50];+ // Find users where the name contains this substring.+ string name_contains = 2 [(validate.rules).string.max_len = 50];+ // Find users where the description contains this substring.+ string description_contains = 3 [(validate.rules).string.max_len = 50];+ // Find users where the given attributes contain these substrings.+ map<string, string> attributes_contain = 4 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ // Find users where the state is any of these states.+ repeated State state = 5 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];++ google.protobuf.FieldMask field_mask = 6;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 7 [(validate.rules).string = {+ in: [+ "",+ "user_id",+ "-user_id",+ "name",+ "-name",+ "primary_email_address",+ "-primary_email_address",+ "state",+ "-state",+ "admin",+ "-admin",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 8 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 9;+ // Only return recently deleted users.+ bool deleted = 10;+}++message SearchAccountsRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ string query = 1 [(validate.rules).string = {max_len: 50}];++ bool only_users = 2;++ oneof collaborator_of {+ ApplicationIdentifiers application_ids = 3;+ ClientIdentifiers client_ids = 4;+ GatewayIdentifiers gateway_ids = 5;+ OrganizationIdentifiers organization_ids = 6;+ }++ bool complement_collaborators = 7;++ // NOTE: This request intentionally does not support pagination.+}++message SearchAccountsResponse {+ repeated OrganizationOrUserIdentifiers account_ids = 1;+}++// The EntityRegistrySearch service indexes entities in the various registries+// and enables searching for them.+// This service is not implemented on all deployments.+service EntityRegistrySearch {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Search for entities in the Entity Registry."};+ // Search for applications that match the conditions specified in the request.+ // Non-admin users will only match applications that they have rights on.+ rpc SearchApplications(SearchApplicationsRequest) returns (Applications) {+ option (google.api.http) = {get: "/search/applications"};+ }++ // Search for OAuth clients that match the conditions specified in the request.+ // Non-admin users will only match OAuth clients that they have rights on.+ rpc SearchClients(SearchClientsRequest) returns (Clients) {+ option (google.api.http) = {get: "/search/clients"};+ }++ // Search for gateways that match the conditions specified in the request.+ // Non-admin users will only match gateways that they have rights on.+ rpc SearchGateways(SearchGatewaysRequest) returns (Gateways) {+ option (google.api.http) = {get: "/search/gateways"};+ }++ // Search for organizations that match the conditions specified in the request.+ // Non-admin users will only match organizations that they have rights on.+ rpc SearchOrganizations(SearchOrganizationsRequest) returns (Organizations) {+ option (google.api.http) = {get: "/search/organizations"};+ }++ // Search for users that match the conditions specified in the request.+ // This is only available to admin users.+ rpc SearchUsers(SearchUsersRequest) returns (Users) {+ option (google.api.http) = {get: "/search/users"};+ }++ // Search for accounts that match the conditions specified in the request.+ rpc SearchAccounts(SearchAccountsRequest) returns (SearchAccountsResponse) {+ option (google.api.http) = {+ get: "/search/accounts"+ additional_bindings {get: "/applications/{application_ids.application_id}/collaborators/search"}+ additional_bindings {get: "/clients/{client_ids.client_id}/collaborators/search"}+ additional_bindings {get: "/gateways/{gateway_ids.gateway_id}/collaborators/search"}+ additional_bindings {get: "/organizations/{organization_ids.organization_id}/collaborators/search"}+ };+ }+}++message SearchEndDevicesRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };+ ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];++ // Find end devices where the ID, name, description or EUI contains this substring.+ string query = 13 [(validate.rules).string.max_len = 50];++ // Find end devices where the ID contains this substring.+ string id_contains = 2 [(validate.rules).string.max_len = 50];+ // Find end devices where the name contains this substring.+ string name_contains = 3 [(validate.rules).string.max_len = 50];+ // Find end devices where the description contains this substring.+ string description_contains = 4 [(validate.rules).string.max_len = 50];+ // Find end devices where the given attributes contain these substrings.+ map<string, string> attributes_contain = 5 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 50}+ }+ }];++ // Find end devices where the (hexadecimal) DevEUI contains this substring.+ string dev_eui_contains = 6 [(validate.rules).string.max_len = 16];+ // Find end devices where the (hexadecimal) JoinEUI contains this substring.+ string join_eui_contains = 7 [(validate.rules).string.max_len = 16];+ // Find end devices where the (hexadecimal) DevAddr contains this substring.+ string dev_addr_contains = 8 [(validate.rules).string.max_len = 8];++ google.protobuf.FieldMask field_mask = 9;++ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 10 [(validate.rules).string = {+ in: [+ "",+ "device_id",+ "-device_id",+ "join_eui",+ "-join_eui",+ "dev_eui",+ "-dev_eui",+ "name",+ "-name",+ "description",+ "-description",+ "created_at",+ "-created_at",+ "last_seen_at",+ "-last_seen_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 11 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 12;++ // next: 14+}++// The EndDeviceRegistrySearch service indexes devices in the EndDeviceRegistry+// and enables searching for them.+// This service is not implemented on all deployments.+service EndDeviceRegistrySearch {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Search for end devices in the End Device Registry."};+ // Search for end devices in the given application that match the conditions specified in the request.+ rpc SearchEndDevices(SearchEndDevicesRequest) returns (EndDevices) {+ option (google.api.http) = {get: "/search/applications/{application_ids.application_id}/devices"};+ }+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/secrets.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/secrets.protonew file mode 100644index 000000000..ba5e74b20--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/secrets.proto@@ -0,0 +1,39 @@+// Copyright © 2020 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "thethings/flags/annotations.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// Secret contains a secret value. It also contains the ID of the Encryption key used to encrypt it.+message Secret {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // ID of the Key used to encrypt the secret.+ string key_id = 1;+ bytes value = 2 [+ (validate.rules).bytes.max_len = 2048,+ (thethings.flags.field) = {+ set_flag_new_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.NewHexBytesFlag",+ set_flag_getter_func: "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin.GetBytes"+ }+ ];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/simulate.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/simulate.protonew file mode 100644index 000000000..b637b26fb--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/simulate.proto@@ -0,0 +1,260 @@+// Copyright © 2022 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/timestamp.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/lorawan.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++message SimulateMetadataParams {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ float rssi = 1;+ float snr = 2;+ uint32 timestamp = 3;+ google.protobuf.Timestamp time = 4;+ ttn.lorawan.v3.MACVersion lorawan_version = 5;+ ttn.lorawan.v3.PHYVersion lorawan_phy_version = 6;+ string band_id = 7;+ uint64 frequency = 8;+ uint32 channel_index = 9;+ uint32 bandwidth = 10;+ uint32 spreading_factor = 11;+ uint32 data_rate_index = 12;+}++message SimulateJoinRequestParams {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ bytes join_eui = 1 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_eui = 2 [+ (validate.rules).bytes = {+ len: 8,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"70B3D57ED000ABCD\""+ }+ ];+ bytes dev_nonce = 3 [+ (validate.rules).bytes = {+ len: 2,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal2Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New2BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"ABCD\""+ }+ ];+ bytes app_key = 4 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ bytes nwk_key = 5 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+}++message SimulateDataUplinkParams {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ bytes dev_addr = 1 [+ (validate.rules).bytes = {+ len: 4,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"2600ABCD\""+ }+ ];+ bytes f_nwk_s_int_key = 2 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ bytes s_nwk_s_int_key = 3 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ bytes nwk_s_enc_key = 4 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ bytes app_s_key = 5 [+ (validate.rules).bytes = {+ len: 16,+ ignore_empty: true+ },+ (thethings.json.field) = {+ marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",+ unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal16Bytes"+ },+ (thethings.flags.field) = {+ set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New16BytesFlag",+ set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"+ },+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {+ type: STRING,+ format: "string",+ example: "\"0123456789ABCDEF0123456789ABCDEF\""+ }+ ];+ bool adr = 6;+ bool adr_ack_req = 7;+ bool confirmed = 8;+ bool ack = 9;+ uint32 f_cnt = 10;+ uint32 f_port = 11;+ bytes frm_payload = 12;+ uint32 conf_f_cnt = 13;+ uint32 tx_dr_idx = 14;+ uint32 tx_ch_idx = 15;+ bytes f_opts = 16 [(validate.rules).bytes.max_len = 15];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/user.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/user.protonew file mode 100644index 000000000..15b7bafff--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/user.proto@@ -0,0 +1,626 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "thethings/flags/annotations.proto";+import "thethings/json/annotations.proto";+import "ttn/lorawan/v3/contact_info.proto";+import "ttn/lorawan/v3/enums.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/notification_service.proto";+import "ttn/lorawan/v3/picture.proto";+import "ttn/lorawan/v3/rights.proto";+import "validate/validate.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// ConsoleTheme is the theme of the Console.+enum ConsoleTheme {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "CONSOLE_THEME"+ };+ // The user prefers the system mode.+ CONSOLE_THEME_SYSTEM = 0;+ // The user prefers the light mode.+ CONSOLE_THEME_LIGHT = 1;+ // The user prefers the dark mode.+ CONSOLE_THEME_DARK = 2;+}++// Tutorial is a set of possible tutorials in the Console.+enum Tutorial {+ option (thethings.json.enum) = {marshal_as_string: true};++ TUTORIAL_UNKNOWN = 0;+ TUTORIAL_LIVE_DATA_SPLIT_VIEW = 1;+}++// DashboardLayout is a set of possible layout values to be used in the Console.+enum DashboardLayout {+ option (thethings.json.enum) = {+ marshal_as_string: true,+ prefix: "DASHBOARD_LAYOUT"+ };+ DASHBOARD_LAYOUT_TABLE = 0;+ DASHBOARD_LAYOUT_LIST = 1;+ DASHBOARD_LAYOUT_GRID = 2;+}++// EmailNotificationPreferences is the message that defines the types of notifications for which the user wants to receive an email.+message EmailNotificationPreferences {+ repeated NotificationType types = 1 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+}++// UserConsolePreferences is the message that defines the user preferences for the Console.+message UserConsolePreferences {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ ConsoleTheme console_theme = 1;++ message DashboardLayouts {+ DashboardLayout api_key = 1;+ DashboardLayout application = 2;+ DashboardLayout collaborator = 3;+ DashboardLayout end_device = 4;+ DashboardLayout gateway = 5;+ DashboardLayout organization = 6;+ DashboardLayout overview = 7;+ DashboardLayout user = 8;+ }+ DashboardLayouts dashboard_layouts = 2;++ // SortBy defines the field to which the Console will sort the display of entities.+ message SortBy {+ string api_key = 1 [(validate.rules).string = {+ in: [+ "",+ "api_key_id",+ "-api_key_id",+ "name",+ "-name",+ "created_at",+ "-created_at",+ "expires_at",+ "-expires_at"+ ]+ }];+ string application = 2 [(validate.rules).string = {+ in: [+ "",+ "application_id",+ "-application_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ string collaborator = 3 [(validate.rules).string = {+ in: [+ "",+ "id",+ "-id",+ "rights",+ "-rights"+ ]+ }];+ string end_device = 4 [(validate.rules).string = {+ in: [+ "",+ "device_id",+ "-device_id",+ "join_eui",+ "-join_eui",+ "dev_eui",+ "-dev_eui",+ "name",+ "-name",+ "description",+ "-description",+ "created_at",+ "-created_at",+ "last_seen_at",+ "-last_seen_at"+ ]+ }];+ string gateway = 5 [(validate.rules).string = {+ in: [+ "",+ "gateway_id",+ "-gateway_id",+ "gateway_eui",+ "-gateway_eui",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ string organization = 6 [(validate.rules).string = {+ in: [+ "",+ "organization_id",+ "-organization_id",+ "name",+ "-name",+ "created_at",+ "-created_at"+ ]+ }];+ string user = 7 [(validate.rules).string = {+ in: [+ "",+ "user_id",+ "-user_id",+ "name",+ "-name",+ "primary_email_address",+ "-primary_email_address",+ "state",+ "-state",+ "admin",+ "-admin",+ "created_at",+ "-created_at"+ ]+ }];+ }+ SortBy sort_by = 3;++ message Tutorials {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ repeated Tutorial seen = 1 [(validate.rules).repeated = {+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+ }+ Tutorials tutorials = 4;+}++// User is the message that defines a user on the network.+message User {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The identifiers of the user. These are public and can be seen by any authenticated user in the network.+ UserIdentifiers ids = 1 [+ (validate.rules).message.required = true,+ (thethings.flags.field) = {+ select: false,+ hidden: true+ }+ ];+ // When the user was created. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp created_at = 2 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the user was last updated. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp updated_at = 3 [(thethings.flags.field) = {+ select: false,+ set: false+ }];+ // When the user was deleted. This information is public and can be seen by any authenticated user in the network.+ google.protobuf.Timestamp deleted_at = 19 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // The name of the user. This information is public and can be seen by any authenticated user in the network.+ string name = 4 [(validate.rules).string.max_len = 50];+ // A description for the user. This information is public and can be seen by any authenticated user in the network.+ string description = 5 [(validate.rules).string.max_len = 2000];++ // Key-value attributes for this users. Typically used for storing integration-specific data.+ map<string, string> attributes = 6 [(validate.rules).map = {+ max_pairs: 10,+ keys: {+ string: {+ pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$",+ max_len: 36+ }+ },+ values: {+ string: {max_len: 200}+ }+ }];++ // Contact information for this user. Typically used to indicate who to contact with security/billing questions about the user.+ // This field is deprecated.+ repeated ContactInfo contact_info = 7 [+ deprecated = true,+ (validate.rules).repeated.max_items = 10+ ];++ // Primary email address that can be used for logging in.+ // This address is not public, use contact_info for that.+ string primary_email_address = 8 [(validate.rules).string.email = true];++ // When the primary email address was validated. Note that email address validation is not required on all networks.+ google.protobuf.Timestamp primary_email_address_validated_at = 9;++ // The password field is only considered when creating a user.+ // It is not returned on API calls, and can not be updated by updating the User.+ // See the UpdatePassword method of the UserRegistry service for more information.+ string password = 10 [(validate.rules).string.max_len = 1000];+ google.protobuf.Timestamp password_updated_at = 11 [(thethings.flags.field) = {+ select: true,+ set: false+ }];+ bool require_password_update = 12;++ // The reviewing state of the user.+ // This information is public and can be seen by any authenticated user in the network.+ // This field can only be modified by admins.+ State state = 13 [(validate.rules).enum.defined_only = true];+ // A description for the state field.+ // This field can only be modified by admins, and should typically only be updated+ // when also updating `state`.+ string state_description = 20 [(validate.rules).string.max_len = 128];+ // This user is an admin.+ // This information is public and can be seen by any authenticated user in the network.+ // This field can only be modified by other admins.+ bool admin = 14;++ // The temporary password can only be used to update a user's password; never returned on API calls.+ // It is not returned on API calls, and can not be updated by updating the User.+ // See the CreateTemporaryPassword method of the UserRegistry service for more information.+ string temporary_password = 15 [(validate.rules).string.max_len = 1000];+ google.protobuf.Timestamp temporary_password_created_at = 16 [(thethings.flags.field) = {+ select: true,+ set: false+ }];+ google.protobuf.Timestamp temporary_password_expires_at = 17 [(thethings.flags.field) = {+ select: true,+ set: false+ }];++ // A profile picture for the user.+ // This information is public and can be seen by any authenticated user in the network.+ Picture profile_picture = 18;++ reserved 21;+ reserved "application_limit";+ reserved 22;+ reserved "client_limit";+ reserved 23;+ reserved "gateway_limit";+ reserved 24;+ reserved "organization_limit";++ // Console preferences contains the user's preferences regarding the behavior of the Console.+ UserConsolePreferences console_preferences = 25;++ EmailNotificationPreferences email_notification_preferences = 26;++ // Universal rights are capable of restricting the user's interactions with the API, be it an admin or not.+ repeated Right universal_rights = 27;++ // next: 28+}++message Users {+ repeated User users = 1;+}++message GetUserRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // The names of the user fields that should be returned.+ google.protobuf.FieldMask field_mask = 2;+}++message ListUsersRequest {+ option (thethings.flags.message) = {+ select: true,+ set: true+ };+ // The names of the user fields that should be returned.+ google.protobuf.FieldMask field_mask = 1;+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 2 [(validate.rules).string = {+ in: [+ "",+ "user_id",+ "-user_id",+ "name",+ "-name",+ "primary_email_address",+ "-primary_email_address",+ "state",+ "-state",+ "admin",+ "-admin",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 4;+ // Only return recently deleted users.+ bool deleted = 5;+}++message CreateUserRequest {+ User user = 1 [(validate.rules).message.required = true];+ // The invitation token that was sent to the user (some networks require an invitation in order to register new users).+ string invitation_token = 2;+}++message UpdateUserRequest {+ User user = 1 [(validate.rules).message.required = true];+ // The names of the user fields that should be updated.+ google.protobuf.FieldMask field_mask = 2;+}++message CreateTemporaryPasswordRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+}++message UpdateUserPasswordRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string new = 2 [(validate.rules).string.max_len = 1000];+ string old = 3 [(validate.rules).string.max_len = 1000];+ // Revoke active sessions and access tokens of user if true. To be used if credentials are suspected to be compromised.+ bool revoke_all_access = 4;+}++message ListUserAPIKeysRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path.+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "api_key_id",+ "-api_key_id",+ "name",+ "-name",+ "created_at",+ "-created_at",+ "expires_at",+ "-expires_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+}++message GetUserAPIKeyRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Unique public identifier for the API key.+ string key_id = 2;+}++message CreateUserAPIKeyRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string name = 2 [(validate.rules).string.max_len = 50];+ repeated Right rights = 3 [(validate.rules).repeated = {+ min_items: 1,+ unique: true,+ items: {+ enum: {defined_only: true}+ }+ }];+ google.protobuf.Timestamp expires_at = 4 [(validate.rules).timestamp.gt_now = true];+}++message UpdateUserAPIKeyRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ APIKey api_key = 2 [(validate.rules).message.required = true];+ // The names of the api key fields that should be updated.+ google.protobuf.FieldMask field_mask = 3;+}++message DeleteUserAPIKeyRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string key_id = 2;+}++message Invitation {+ string email = 1 [(validate.rules).string.email = true];+ string token = 2;++ google.protobuf.Timestamp expires_at = 3;+ google.protobuf.Timestamp created_at = 4;+ google.protobuf.Timestamp updated_at = 5;++ google.protobuf.Timestamp accepted_at = 6;+ UserIdentifiers accepted_by = 7;+}++message ListInvitationsRequest {+ // Limit the number of results per page.+ uint32 limit = 1 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 2;+}++message Invitations {+ repeated Invitation invitations = 1;+}++message SendInvitationRequest {+ string email = 1 [(validate.rules).string.email = true];+}++message DeleteInvitationRequest {+ string email = 1 [(validate.rules).string.email = true];+}++message UserSessionIdentifiers {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string session_id = 2 [(validate.rules).string.max_len = 64];+}++message UserSession {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ string session_id = 2 [(validate.rules).string.max_len = 64];+ google.protobuf.Timestamp created_at = 3;+ google.protobuf.Timestamp updated_at = 4;+ google.protobuf.Timestamp expires_at = 5;+ // The session secret is used to compose an authorization key and is never returned.+ string session_secret = 6;+}++message UserSessions {+ repeated UserSession sessions = 1;+}++message ListUserSessionsRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Order the results by this field path (must be present in the field mask).+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 2 [(validate.rules).string = {+ in: [+ "",+ "created_at",+ "-created_at"+ ]+ }];+ // Limit the number of results per page.+ uint32 limit = 3 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 4;+}++message LoginToken {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];++ google.protobuf.Timestamp created_at = 2;+ google.protobuf.Timestamp updated_at = 3;+ google.protobuf.Timestamp expires_at = 4;++ string token = 5;+ bool used = 6;+}++message CreateLoginTokenRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Skip sending the login token to the user by email.+ // This field is only effective when the login token is created by an admin user.+ bool skip_email = 2;+}++message CreateLoginTokenResponse {+ // The token that can be used for logging in as the user.+ // This field is only present if a token was created by an admin user for a non-admin user.+ string token = 1;+}++message UserBookmark {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ EntityIdentifiers entity_ids = 2 [(validate.rules).message.required = true];+ google.protobuf.Timestamp created_at = 3;+}++message UserBookmarks {+ repeated UserBookmark bookmarks = 1;+}++message CreateUserBookmarkRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ EntityIdentifiers entity_ids = 2 [(validate.rules).message.required = true];+}++message ListUserBookmarksRequest {+ option (thethings.flags.message) = {+ select: false,+ set: true+ };++ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ // Limit the number of results per page.+ uint32 limit = 2 [(validate.rules).uint32.lte = 1000];+ // Page number for pagination. 0 is interpreted as 1.+ uint32 page = 3;+ // Order the results by this field path.+ // Default ordering is by ID. Prepend with a minus (-) to reverse the order.+ string order = 4 [(validate.rules).string = {+ in: [+ "",+ "user_id",+ "-user_id",+ "entity_type",+ "-entity_type",+ "entity_id",+ "-entity_id",+ "created_at",+ "-created_at"+ ]+ }];++ // Only return recently deleted bookmarks.+ bool deleted = 5;++ // Specifies that only bookmarks that reference the given entity type should be returned. If empty the filter is not+ // applied.+ repeated string entity_types = 6 [(validate.rules).repeated = {+ unique: true,+ items: {+ string: {+ // These values are the same as what is specified in the pkg/ttnpb/identifiers_polymorphism+ in: [+ "application",+ "client",+ "end device",+ "gateway",+ "organization",+ "user"+ ]+ }+ }+ }];+}++message DeleteUserBookmarkRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ EntityIdentifiers entity_ids = 2 [(validate.rules).message.required = true];+}++message BatchDeleteUserBookmarksRequest {+ UserIdentifiers user_ids = 1 [(validate.rules).message.required = true];+ repeated EntityIdentifiers entity_ids = 2 [(validate.rules).repeated = {+ min_items: 1,+ max_items: 20,+ }];+}diff --git a/agent/src/main/proto/tts/ttn/lorawan/v3/user_services.proto b/agent/src/main/proto/tts/ttn/lorawan/v3/user_services.protonew file mode 100644index 000000000..64879774e--- /dev/null+++ b/agent/src/main/proto/tts/ttn/lorawan/v3/user_services.proto@@ -0,0 +1,213 @@+// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++syntax = "proto3";++package ttn.lorawan.v3;++import "google/api/annotations.proto";+import "google/protobuf/empty.proto";+import "protoc-gen-openapiv2/options/annotations.proto";+import "ttn/lorawan/v3/identifiers.proto";+import "ttn/lorawan/v3/rights.proto";+import "ttn/lorawan/v3/user.proto";++option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";++// The UserRegistry service, exposed by the Identity Server, is used to manage+// user registrations.+service UserRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage users."};+ // Register a new user. This method may be restricted by network settings.+ rpc Create(CreateUserRequest) returns (User) {+ option (google.api.http) = {+ post: "/users"+ body: "*"+ };+ }++ // Get the user with the given identifiers, selecting the fields given by the+ // field mask. The method may return more or less fields, depending on the rights+ // of the caller.+ rpc Get(GetUserRequest) returns (User) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}"};+ }++ // List users of the network. This method is typically restricted to admins only.+ rpc List(ListUsersRequest) returns (Users) {+ option (google.api.http) = {get: "/users"};+ }++ // Update the user, changing the fields specified by the field mask to the provided values.+ // This method can not be used to change the password, see the UpdatePassword method for that.+ rpc Update(UpdateUserRequest) returns (User) {+ option (google.api.http) = {+ put: "/users/{user.ids.user_id}"+ body: "*"+ };+ }++ // Create a temporary password that can be used for updating a forgotten password.+ // The generated password is sent to the user's email address.+ rpc CreateTemporaryPassword(CreateTemporaryPasswordRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/users/{user_ids.user_id}/temporary_password"};+ }++ // Update the password of the user.+ rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ put: "/users/{user_ids.user_id}/password"+ body: "*"+ };+ }++ // Delete the user. This may not release the user ID for reuse.+ rpc Delete(UserIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_id}"};+ }++ // Restore a recently deleted user.+ //+ // Deployment configuration may specify if, and for how long after deletion,+ // entities can be restored.+ rpc Restore(UserIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {post: "/users/{user_id}/restore"};+ }++ // Purge the user. This will release the user ID for reuse.+ // The user is responsible for clearing data from any (external) integrations+ // that may store and expose data by user or organization ID.+ rpc Purge(UserIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_id}/purge"};+ }+}++// The UserAccess service, exposed by the Identity Server, is used to manage+// API keys of users.+service UserAccess {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage user access."};+ // List the rights the caller has on this user.+ rpc ListRights(UserIdentifiers) returns (Rights) {+ option (google.api.http) = {get: "/users/{user_id}/rights"};+ }++ // Create an API key scoped to this user.+ // User API keys can give access to the user itself, as well as+ // any organization, application, gateway and OAuth client this user is a collaborator of.+ rpc CreateAPIKey(CreateUserAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ post: "/users/{user_ids.user_id}/api-keys"+ body: "*"+ };+ }++ // List the API keys for this user.+ rpc ListAPIKeys(ListUserAPIKeysRequest) returns (APIKeys) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/api-keys"};+ }++ // Get a single API key of this user.+ rpc GetAPIKey(GetUserAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/api-keys/{key_id}"};+ }++ // Update the rights of an API key of the user.+ // This method can also be used to delete the API key, by giving it no rights.+ // The caller is required to have all assigned or/and removed rights.+ rpc UpdateAPIKey(UpdateUserAPIKeyRequest) returns (APIKey) {+ option (google.api.http) = {+ put: "/users/{user_ids.user_id}/api-keys/{api_key.id}"+ body: "*"+ };+ }++ // Delete a single API key of this user.+ rpc DeleteAPIKey(DeleteUserAPIKeyRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_ids.user_id}/api-keys/{key_id}"};+ }++ // Create a login token that can be used for a one-time login as a user.+ rpc CreateLoginToken(CreateLoginTokenRequest) returns (CreateLoginTokenResponse) {+ option (google.api.http) = {post: "/users/{user_ids.user_id}/login-tokens"};+ }+}++// The UserOrganizationRegistry service, exposed by the Identity Server, is used to manage user invitations.+service UserInvitationRegistry {+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {description: "Manage user sessions."};+ // Invite a user to join the network.+ rpc Send(SendInvitationRequest) returns (Invitation) {+ option (google.api.http) = {+ post: "/invitations"+ body: "*"+ };+ }++ // List the invitations the caller has sent.+ rpc List(ListInvitationsRequest) returns (Invitations) {+ option (google.api.http) = {get: "/invitations"};+ }++ // Delete (revoke) a user invitation.+ rpc Delete(DeleteInvitationRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/invitations"};+ }+}++// The UserSessionRegistry service, exposed by the Identity Server, is used to manage+// (browser) sessions of the user.+service UserSessionRegistry {+ // List the active sessions for the given user.+ rpc List(ListUserSessionsRequest) returns (UserSessions) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/sessions"};+ }+ // Delete (revoke) the given user session.+ rpc Delete(UserSessionIdentifiers) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_ids.user_id}/sessions/{session_id}"};+ }+}++service UserBookmarkRegistry {+ // Create a bookmark for the given user.+ rpc Create(CreateUserBookmarkRequest) returns (UserBookmark) {+ option (google.api.http) = {+ post: "/users/{user_ids.user_id}/bookmarks"+ body: "*"+ };+ }++ // List the bookmarks for the given user.+ rpc List(ListUserBookmarksRequest) returns (UserBookmarks) {+ option (google.api.http) = {get: "/users/{user_ids.user_id}/bookmarks"};+ }++ // Delete the given user's bookmark.+ rpc Delete(DeleteUserBookmarkRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {+ delete: "/users/{user_ids.user_id}/bookmarks/applications/{entity_ids.application_ids.application_id}",+ additional_bindings {delete: "/users/{user_ids.user_id}/bookmarks/clients/{entity_ids.client_ids.client_id}"}+ additional_bindings {delete: "/users/{user_ids.user_id}/bookmarks/gateways/{entity_ids.gateway_ids.gateway_id}"}+ additional_bindings {delete: "/users/{user_ids.user_id}/bookmarks/organizations/{entity_ids.organization_ids.organization_id}"}+ additional_bindings {delete: "/users/{user_ids.user_id}/bookmarks/users/{entity_ids.user_ids.user_id}"}+ additional_bindings {delete: "/users/{user_ids.user_id}/bookmarks/applications/{entity_ids.device_ids.application_ids.application_id}/devices/{entity_ids.device_ids.device_id}"}+ };+ }++ // Delete a list of bookmarks of the given user.+ // This operation is atomic; either all bookmarks are deleted or none.+ // Bookmarks not found are skipped and no error is returned.+ rpc BatchDelete(BatchDeleteUserBookmarksRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/users/{user_ids.user_id}/bookmarks/batch"};+ }+}diff --git a/agent/src/main/proto/tts/validate/validate.proto b/agent/src/main/proto/tts/validate/validate.protonew file mode 100644index 000000000..ecd114b7f--- /dev/null+++ b/agent/src/main/proto/tts/validate/validate.proto@@ -0,0 +1,863 @@+syntax = "proto2";+package validate;++import "google/protobuf/descriptor.proto";+import "google/protobuf/duration.proto";+import "google/protobuf/timestamp.proto";++option go_package = "github.com/envoyproxy/protoc-gen-validate/validate";+option java_package = "io.envoyproxy.pgv.validate";++// Validation rules applied at the message level+extend google.protobuf.MessageOptions {+ // Disabled nullifies any validation rules for this message, including any+ // message fields associated with it that do support validation.+ optional bool disabled = 1071;+ // Ignore skips generation of validation methods for this message.+ optional bool ignored = 1072;+}++// Validation rules applied at the oneof level+extend google.protobuf.OneofOptions {+ // Required ensures that exactly one the field options in a oneof is set;+ // validation fails if no fields in the oneof are set.+ optional bool required = 1071;+}++// Validation rules applied at the field level+extend google.protobuf.FieldOptions {+ // Rules specify the validations to be performed on this field. By default,+ // no validation is performed against a field.+ optional FieldRules rules = 1071;+}++// FieldRules encapsulates the rules for each type of field. Depending on the+// field, the correct set should be used to ensure proper validations.+message FieldRules {+ optional MessageRules message = 17;+ oneof type {+ // Scalar Field Types+ FloatRules float = 1;+ DoubleRules double = 2;+ Int32Rules int32 = 3;+ Int64Rules int64 = 4;+ UInt32Rules uint32 = 5;+ UInt64Rules uint64 = 6;+ SInt32Rules sint32 = 7;+ SInt64Rules sint64 = 8;+ Fixed32Rules fixed32 = 9;+ Fixed64Rules fixed64 = 10;+ SFixed32Rules sfixed32 = 11;+ SFixed64Rules sfixed64 = 12;+ BoolRules bool = 13;+ StringRules string = 14;+ BytesRules bytes = 15;++ // Complex Field Types+ EnumRules enum = 16;+ RepeatedRules repeated = 18;+ MapRules map = 19;++ // Well-Known Field Types+ AnyRules any = 20;+ DurationRules duration = 21;+ TimestampRules timestamp = 22;+ }+}++// FloatRules describes the constraints applied to `float` values+message FloatRules {+ // Const specifies that this field must be exactly the specified value+ optional float const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional float lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional float lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional float gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional float gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated float in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated float not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// DoubleRules describes the constraints applied to `double` values+message DoubleRules {+ // Const specifies that this field must be exactly the specified value+ optional double const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional double lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional double lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional double gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional double gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated double in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated double not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// Int32Rules describes the constraints applied to `int32` values+message Int32Rules {+ // Const specifies that this field must be exactly the specified value+ optional int32 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional int32 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional int32 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional int32 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional int32 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated int32 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated int32 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// Int64Rules describes the constraints applied to `int64` values+message Int64Rules {+ // Const specifies that this field must be exactly the specified value+ optional int64 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional int64 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional int64 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional int64 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional int64 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated int64 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated int64 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// UInt32Rules describes the constraints applied to `uint32` values+message UInt32Rules {+ // Const specifies that this field must be exactly the specified value+ optional uint32 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional uint32 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional uint32 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional uint32 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional uint32 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated uint32 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated uint32 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// UInt64Rules describes the constraints applied to `uint64` values+message UInt64Rules {+ // Const specifies that this field must be exactly the specified value+ optional uint64 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional uint64 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional uint64 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional uint64 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional uint64 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated uint64 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated uint64 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// SInt32Rules describes the constraints applied to `sint32` values+message SInt32Rules {+ // Const specifies that this field must be exactly the specified value+ optional sint32 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional sint32 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional sint32 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional sint32 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional sint32 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated sint32 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated sint32 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// SInt64Rules describes the constraints applied to `sint64` values+message SInt64Rules {+ // Const specifies that this field must be exactly the specified value+ optional sint64 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional sint64 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional sint64 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional sint64 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional sint64 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated sint64 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated sint64 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// Fixed32Rules describes the constraints applied to `fixed32` values+message Fixed32Rules {+ // Const specifies that this field must be exactly the specified value+ optional fixed32 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional fixed32 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional fixed32 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional fixed32 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional fixed32 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated fixed32 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated fixed32 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// Fixed64Rules describes the constraints applied to `fixed64` values+message Fixed64Rules {+ // Const specifies that this field must be exactly the specified value+ optional fixed64 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional fixed64 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional fixed64 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional fixed64 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional fixed64 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated fixed64 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated fixed64 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// SFixed32Rules describes the constraints applied to `sfixed32` values+message SFixed32Rules {+ // Const specifies that this field must be exactly the specified value+ optional sfixed32 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional sfixed32 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional sfixed32 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional sfixed32 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional sfixed32 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated sfixed32 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated sfixed32 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// SFixed64Rules describes the constraints applied to `sfixed64` values+message SFixed64Rules {+ // Const specifies that this field must be exactly the specified value+ optional sfixed64 const = 1;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional sfixed64 lt = 2;++ // Lte specifies that this field must be less than or equal to the+ // specified value, inclusive+ optional sfixed64 lte = 3;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive. If the value of Gt is larger than a specified Lt or Lte, the+ // range is reversed.+ optional sfixed64 gt = 4;++ // Gte specifies that this field must be greater than or equal to the+ // specified value, inclusive. If the value of Gte is larger than a+ // specified Lt or Lte, the range is reversed.+ optional sfixed64 gte = 5;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated sfixed64 in = 6;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated sfixed64 not_in = 7;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 8;+}++// BoolRules describes the constraints applied to `bool` values+message BoolRules {+ // Const specifies that this field must be exactly the specified value+ optional bool const = 1;+}++// StringRules describe the constraints applied to `string` values+message StringRules {+ // Const specifies that this field must be exactly the specified value+ optional string const = 1;++ // Len specifies that this field must be the specified number of+ // characters (Unicode code points). Note that the number of+ // characters may differ from the number of bytes in the string.+ optional uint64 len = 19;++ // MinLen specifies that this field must be the specified number of+ // characters (Unicode code points) at a minimum. Note that the number of+ // characters may differ from the number of bytes in the string.+ optional uint64 min_len = 2;++ // MaxLen specifies that this field must be the specified number of+ // characters (Unicode code points) at a maximum. Note that the number of+ // characters may differ from the number of bytes in the string.+ optional uint64 max_len = 3;++ // LenBytes specifies that this field must be the specified number of bytes+ // at a minimum+ optional uint64 len_bytes = 20;++ // MinBytes specifies that this field must be the specified number of bytes+ // at a minimum+ optional uint64 min_bytes = 4;++ // MaxBytes specifies that this field must be the specified number of bytes+ // at a maximum+ optional uint64 max_bytes = 5;++ // Pattern specifes that this field must match against the specified+ // regular expression (RE2 syntax). The included expression should elide+ // any delimiters.+ optional string pattern = 6;++ // Prefix specifies that this field must have the specified substring at+ // the beginning of the string.+ optional string prefix = 7;++ // Suffix specifies that this field must have the specified substring at+ // the end of the string.+ optional string suffix = 8;++ // Contains specifies that this field must have the specified substring+ // anywhere in the string.+ optional string contains = 9;++ // NotContains specifies that this field cannot have the specified substring+ // anywhere in the string.+ optional string not_contains = 23;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated string in = 10;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated string not_in = 11;++ // WellKnown rules provide advanced constraints against common string+ // patterns+ oneof well_known {+ // Email specifies that the field must be a valid email address as+ // defined by RFC 5322+ bool email = 12;++ // Hostname specifies that the field must be a valid hostname as+ // defined by RFC 1034. This constraint does not support+ // internationalized domain names (IDNs).+ bool hostname = 13;++ // Ip specifies that the field must be a valid IP (v4 or v6) address.+ // Valid IPv6 addresses should not include surrounding square brackets.+ bool ip = 14;++ // Ipv4 specifies that the field must be a valid IPv4 address.+ bool ipv4 = 15;++ // Ipv6 specifies that the field must be a valid IPv6 address. Valid+ // IPv6 addresses should not include surrounding square brackets.+ bool ipv6 = 16;++ // Uri specifies that the field must be a valid, absolute URI as defined+ // by RFC 3986+ bool uri = 17;++ // UriRef specifies that the field must be a valid URI as defined by RFC+ // 3986 and may be relative or absolute.+ bool uri_ref = 18;++ // Address specifies that the field must be either a valid hostname as+ // defined by RFC 1034 (which does not support internationalized domain+ // names or IDNs), or it can be a valid IP (v4 or v6).+ bool address = 21;++ // Uuid specifies that the field must be a valid UUID as defined by+ // RFC 4122+ bool uuid = 22;++ // WellKnownRegex specifies a common well known pattern defined as a regex.+ KnownRegex well_known_regex = 24;+ }++ // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable+ // strict header validation.+ // By default, this is true, and HTTP header validations are RFC-compliant.+ // Setting to false will enable a looser validations that only disallows+ // \r\n\0 characters, which can be used to bypass header matching rules.+ optional bool strict = 25 [default = true];++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 26;+}++// WellKnownRegex contain some well-known patterns.+enum KnownRegex {+ UNKNOWN = 0;++ // HTTP header name as defined by RFC 7230.+ HTTP_HEADER_NAME = 1;++ // HTTP header value as defined by RFC 7230.+ HTTP_HEADER_VALUE = 2;+}++// BytesRules describe the constraints applied to `bytes` values+message BytesRules {+ // Const specifies that this field must be exactly the specified value+ optional bytes const = 1;++ // Len specifies that this field must be the specified number of bytes+ optional uint64 len = 13;++ // MinLen specifies that this field must be the specified number of bytes+ // at a minimum+ optional uint64 min_len = 2;++ // MaxLen specifies that this field must be the specified number of bytes+ // at a maximum+ optional uint64 max_len = 3;++ // Pattern specifes that this field must match against the specified+ // regular expression (RE2 syntax). The included expression should elide+ // any delimiters.+ optional string pattern = 4;++ // Prefix specifies that this field must have the specified bytes at the+ // beginning of the string.+ optional bytes prefix = 5;++ // Suffix specifies that this field must have the specified bytes at the+ // end of the string.+ optional bytes suffix = 6;++ // Contains specifies that this field must have the specified bytes+ // anywhere in the string.+ optional bytes contains = 7;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated bytes in = 8;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated bytes not_in = 9;++ // WellKnown rules provide advanced constraints against common byte+ // patterns+ oneof well_known {+ // Ip specifies that the field must be a valid IP (v4 or v6) address in+ // byte format+ bool ip = 10;++ // Ipv4 specifies that the field must be a valid IPv4 address in byte+ // format+ bool ipv4 = 11;++ // Ipv6 specifies that the field must be a valid IPv6 address in byte+ // format+ bool ipv6 = 12;+ }++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 14;+}++// EnumRules describe the constraints applied to enum values+message EnumRules {+ // Const specifies that this field must be exactly the specified value+ optional int32 const = 1;++ // DefinedOnly specifies that this field must be only one of the defined+ // values for this enum, failing on any undefined value.+ optional bool defined_only = 2;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated int32 in = 3;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated int32 not_in = 4;+}++// MessageRules describe the constraints applied to embedded message values.+// For message-type fields, validation is performed recursively.+message MessageRules {+ // Skip specifies that the validation rules of this field should not be+ // evaluated+ optional bool skip = 1;++ // Required specifies that this field must be set+ optional bool required = 2;+}++// RepeatedRules describe the constraints applied to `repeated` values+message RepeatedRules {+ // MinItems specifies that this field must have the specified number of+ // items at a minimum+ optional uint64 min_items = 1;++ // MaxItems specifies that this field must have the specified number of+ // items at a maximum+ optional uint64 max_items = 2;++ // Unique specifies that all elements in this field must be unique. This+ // contraint is only applicable to scalar and enum types (messages are not+ // supported).+ optional bool unique = 3;++ // Items specifies the contraints to be applied to each item in the field.+ // Repeated message fields will still execute validation against each item+ // unless skip is specified here.+ optional FieldRules items = 4;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 5;+}++// MapRules describe the constraints applied to `map` values+message MapRules {+ // MinPairs specifies that this field must have the specified number of+ // KVs at a minimum+ optional uint64 min_pairs = 1;++ // MaxPairs specifies that this field must have the specified number of+ // KVs at a maximum+ optional uint64 max_pairs = 2;++ // NoSparse specifies values in this field cannot be unset. This only+ // applies to map's with message value types.+ optional bool no_sparse = 3;++ // Keys specifies the constraints to be applied to each key in the field.+ optional FieldRules keys = 4;++ // Values specifies the constraints to be applied to the value of each key+ // in the field. Message values will still have their validations evaluated+ // unless skip is specified here.+ optional FieldRules values = 5;++ // IgnoreEmpty specifies that the validation rules of this field should be+ // evaluated only if the field is not empty+ optional bool ignore_empty = 6;+}++// AnyRules describe constraints applied exclusively to the+// `google.protobuf.Any` well-known type+message AnyRules {+ // Required specifies that this field must be set+ optional bool required = 1;++ // In specifies that this field's `type_url` must be equal to one of the+ // specified values.+ repeated string in = 2;++ // NotIn specifies that this field's `type_url` must not be equal to any of+ // the specified values.+ repeated string not_in = 3;+}++// DurationRules describe the constraints applied exclusively to the+// `google.protobuf.Duration` well-known type+message DurationRules {+ // Required specifies that this field must be set+ optional bool required = 1;++ // Const specifies that this field must be exactly the specified value+ optional google.protobuf.Duration const = 2;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional google.protobuf.Duration lt = 3;++ // Lt specifies that this field must be less than the specified value,+ // inclusive+ optional google.protobuf.Duration lte = 4;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive+ optional google.protobuf.Duration gt = 5;++ // Gte specifies that this field must be greater than the specified value,+ // inclusive+ optional google.protobuf.Duration gte = 6;++ // In specifies that this field must be equal to one of the specified+ // values+ repeated google.protobuf.Duration in = 7;++ // NotIn specifies that this field cannot be equal to one of the specified+ // values+ repeated google.protobuf.Duration not_in = 8;+}++// TimestampRules describe the constraints applied exclusively to the+// `google.protobuf.Timestamp` well-known type+message TimestampRules {+ // Required specifies that this field must be set+ optional bool required = 1;++ // Const specifies that this field must be exactly the specified value+ optional google.protobuf.Timestamp const = 2;++ // Lt specifies that this field must be less than the specified value,+ // exclusive+ optional google.protobuf.Timestamp lt = 3;++ // Lte specifies that this field must be less than the specified value,+ // inclusive+ optional google.protobuf.Timestamp lte = 4;++ // Gt specifies that this field must be greater than the specified value,+ // exclusive+ optional google.protobuf.Timestamp gt = 5;++ // Gte specifies that this field must be greater than the specified value,+ // inclusive+ optional google.protobuf.Timestamp gte = 6;++ // LtNow specifies that this must be less than the current time. LtNow+ // can only be used with the Within rule.+ optional bool lt_now = 7;++ // GtNow specifies that this must be greater than the current time. GtNow+ // can only be used with the Within rule.+ optional bool gt_now = 8;++ // Within specifies that this field must be within this duration of the+ // current time. This constraint can be used alone or with the LtNow and+ // GtNow rules.+ optional google.protobuf.Duration within = 9;+}diff --git a/gradle.properties b/gradle.propertiesindex 140e88203..aec82ae3f 100644--- a/gradle.properties+++ b/gradle.properties@@ -75,3 +75,6 @@ corsFilterVersion = 3.1junitVersion = 6.0.3mockitoVersion = 5.22.0grpcVersion = 1.69.0+grpcAnnotationsVersion = 1.3.2+protobufVersion = 3.25.5+protobufPluginVersion = 0.9.4diff --git a/test/build.gradle b/test/build.gradleindex 226c5f9c1..3f43cb0ac 100644--- a/test/build.gradle+++ b/test/build.gradle@@ -40,13 +40,6 @@ dependencies {testImplementation "com.github.moquette-io:moquette:$moquetteVersion"testImplementation "com.hivemq:hivemq-mqtt-client:$hiveMQClientVersion"-- testImplementation "io.grpc:grpc-netty-shaded:$grpcVersion"- testImplementation "io.grpc:grpc-protobuf:$grpcVersion"- testImplementation "io.grpc:grpc-stub:$grpcVersion"-- testImplementation files("../agent/libs/chirpstack-api-4.14.1.jar")- testImplementation files("../agent/libs/tts-api-3.34.3.jar")}tasks.withType(Test) {