syntax = "proto3";

option go_package = "storage";
option java_package = "io.stackrox.proto.storage";

import "google/protobuf/timestamp.proto";

package storage;

message NetworkFlow {
    NetworkFlowProperties props                     = 1;

    google.protobuf.Timestamp last_seen_timestamp   = 2;
}

message NetworkFlowProperties {
    // The source deployment ID of the network flow
    NetworkEntityInfo src_entity = 1;
    // The destination deployment ID of the network flow
    NetworkEntityInfo dst_entity = 2;
    // may be 0 if not applicable (e.g., icmp).
    uint32 dst_port              = 3;
    L4Protocol l4protocol     = 4;
}

message NetworkEntityInfo {
    enum Type {
        UNKNOWN_TYPE = 0;
        DEPLOYMENT = 1;
        INTERNET = 2;
    }

    message Deployment {
        string name = 1;
        string namespace = 2;
        string cluster = 3;
    }

    Type type = 1;
    string id = 2;

    oneof desc {
        Deployment deployment = 3;
    }
}

enum L4Protocol {
	L4_PROTOCOL_UNKNOWN = 0;
	L4_PROTOCOL_TCP     = 1;
	L4_PROTOCOL_UDP     = 2;
	L4_PROTOCOL_ICMP    = 3;
	L4_PROTOCOL_RAW     = 4;
}
