/**
 * Generic client and server messages.
 * This file should contain all messages that can be sent between the client and
 * the server.
 * @author Krzysztof Trzepla
 * @copyright (C) 2015 ACK CYFRONET AGH
 * @copyright This software is released under the MIT license cited in
 * 'LICENSE.txt'
 */

syntax = "proto2";
package one.clproto;

import "fuse_messages.proto";
import "event_messages.proto";
import "common_messages.proto";
import "stream_messages.proto";
import "handshake_messages.proto";
import "diagnostic_messages.proto";
import "proxyio_messages.proto";
import "dbsync_messages.proto";
import "provider_messages.proto";
// This file is required by Oneprovider for RTransfer
import "gwproto.proto";

// Messages that can be sent by the client to the server.
message ClientMessage {
    optional bytes         message_id     = 1; // should be set when response is
                                               // expected
    optional MessageStream message_stream = 2; // identifies message as part of
                                               // a stream
    oneof message_body { // list of messages that can be sent from
                         // the client to the server
        // handshake_messages.proto
        HandshakeRequest         handshake_request         = 3;
        Token                    token                     = 4;

        // common_messages.proto
        Status                   status                    = 5;

        // stream_messages.proto
        MessageStreamReset       message_stream_reset      = 6;
        MessageRequest           message_request           = 7;
        MessageAcknowledgement   message_acknowledgement   = 8;
        EndOfMessageStream       end_of_stream             = 9;

        // event_messages.proto
        Events                   events                    = 10;
        Subscription             subscription              = 11;
        SubscriptionCancellation subscription_cancellation = 12;
        FlushEvents              flush_events              = 13;

        // diagnostic_messages.proto
        Ping                     ping                      = 14;
        GetProtocolVersion       get_protocol_version      = 15;
        GetConfiguration         get_configuration         = 16;

        // fuse_messages.proto
        FuseRequest              fuse_request              = 17;

        // proxyio_messages.proto
        ProxyIORequest           proxyio_request           = 18;

        // dbsync_messages.proto
        DBSyncRequest            dbsync_request            = 19;
        DBSyncMessage            dbsync_message            = 20;

        // provider_messages.proto
        ProviderRequest          provider_request          = 21;
    }
    
    optional bytes proxy_session_id = 22;
    optional Token proxy_session_token = 23;
}

// Messages that can be sent by the server to the client.
message ServerMessage {
    optional bytes         message_id     = 1; // should be set when response is
                                               // expected
    optional MessageStream message_stream = 2; // identifies message as part of
                                               // a stream
    oneof message_body { // list of messages that can be sent from
                         // the server to the client
        // handshake_messages.proto
        HandshakeResponse        handshake_response        = 3;

        // common_messages.proto
        Status                   status                    = 4;

        // stream_messages.proto
        MessageStreamReset       message_stream_reset      = 5;
        MessageRequest           message_request           = 6;
        MessageAcknowledgement   message_acknowledgement   = 7;
        EndOfMessageStream       end_of_stream             = 8;

        // event_messages.proto
        Events                   events                    = 9;
        Subscription             subscription              = 10;
        SubscriptionCancellation subscription_cancellation = 11;

        // diagnostic_messages.proto
        Pong                     pong                      = 12;
        ProtocolVersion          protocol_version          = 13;
        Configuration            configuration             = 14;

        // fuse_messages.proto
        FuseResponse             fuse_response             = 15;

        // proxyio_messages.proto
        ProxyIOResponse          proxyio_response          = 16;

        // provider_messages.proto
        ProviderResponse         provider_response         = 17;
    }

    optional bytes proxy_session_id = 18;
}
