// Copyright (c) 2022 Boston Dynamics, Inc.  All rights reserved.
//
// Downloading, reproducing, distributing or otherwise using the SDK Software
// is subject to the terms and conditions of the Boston Dynamics Software
// Development Kit License (20191101-BDSDK-SL).

syntax = "proto3";

package bosdyn.api.spot_cam;

option java_outer_classname = "NetworkProto";

import "bosdyn/api/header.proto";
import "google/protobuf/wrappers.proto";

// Network configuration data.
message NetworkTuple {
    //a big-endian representation of an IPv4 address
    google.protobuf.UInt32Value address = 2;
    //The mask used for defining the system's subnet
    google.protobuf.UInt32Value netmask = 3;
    //A global routing is set up for the address defined below (if present)
    google.protobuf.UInt32Value gateway = 4;
    //If MTU is present, and <16 bits wide, then it is set for the ethernet interface's MTU
    //if not, the MTU is set to 1500
    google.protobuf.UInt32Value mtu = 5;
}

// Retrieve current network configuration.
message GetNetworkSettingsRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
}

// Provides the current network configuration.
message GetNetworkSettingsResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;

    // Current network configuration.
    NetworkTuple settings = 2;
}

// Request the SSL certificate currently in use.
message GetSSLCertRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
}

// Provides the SSL certificate currently in use.
message GetSSLCertResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;

    // An ASCII-armored representation of the SSL certificate
    string certificate = 2;
}

// Servers used in the ICE resolution process.
message ICEServer {
    // Possible types of servers
    enum servertype {
        UNKNOWN = 0;
        STUN = 1;
        TURN = 2;
    }
    // STUN or TURN server.
    servertype type = 1;
    // Network address of the server.
    string address = 2;
    // Only the least significant 16 bits are used.
    uint32 port = 3;
}

// Request the servers used for ICE resolution.
message GetICEConfigurationRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
}

// Provides the ICE resolution servers.
message GetICEConfigurationResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;

    // List of servers used for ICE resolution.
    repeated ICEServer servers = 2;
}

// Modify the ICE configuration.
// Note: this configuration replaces any configuration currently present.
// It is *not* appended.
message SetICEConfigurationRequest {
    // Common request header.
    bosdyn.api.RequestHeader header = 1;
    // List of servers used for ICE resolution.
    repeated ICEServer servers = 2;
}

// Result of modifying the ICE configuration.
message SetICEConfigurationResponse {
    // Common response header.
    bosdyn.api.ResponseHeader header = 1;
}
