/**
 * Common messages used in other protocol files.
 * @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;

message Status {
    enum Code {
        ok              = 1;
        eafnosupport    = 2;
        eaddrinuse      = 3;
        eaddrnotavail   = 4;
        eisconn         = 5;
        e2big           = 6;
        edom            = 7;
        efault          = 8;
        ebadf           = 9;
        ebadmsg         = 10;
        epipe           = 11;
        econnaborted    = 12;
        ealready        = 13;
        econnrefused    = 14;
        econnreset      = 15;
        exdev           = 16;
        edestaddrreq    = 17;
        ebusy           = 18;
        enotempty       = 19;
        enoexec         = 20;
        eexist          = 21;
        efbig           = 22;
        enametoolong    = 23;
        enosys          = 24;
        ehostunreach    = 25;
        eidrm           = 26;
        eilseq          = 27;
        enotty          = 28;
        eintr           = 29;
        einval          = 30;
        espipe          = 31;
        eio             = 32;
        eisdir          = 33;
        emsgsize        = 34;
        enetdown        = 35;
        enetreset       = 36;
        enetunreach     = 37;
        enobufs         = 38;
        echild          = 39;
        enolink         = 40;
        enolck          = 41;
        enodata         = 42;
        enomsg          = 43;
        enoprotoopt     = 44;
        enospc          = 45;
        enosr           = 46;
        enxio           = 47;
        enodev          = 48;
        enoent          = 49;
        esrch           = 50;
        enotdir         = 51;
        enotsock        = 52;
        enostr          = 53;
        enotconn        = 54;
        enomem          = 55;
        enotsup         = 56;
        ecanceled       = 57;
        einprogress     = 58;
        eperm           = 59;
        eopnotsupp      = 60;
        ewouldblock     = 61;
        eownerdead      = 62;
        eacces          = 63;
        eproto          = 64;
        eprotonosupport = 65;
        erofs           = 66;
        edeadlk         = 67;
        eagain          = 68;
        erange          = 69;
        enotrecoverable = 70;
        etime           = 71;
        etxtbsy         = 72;
        etimedout       = 73;
        enfile          = 74;
        emfile          = 75;
        emlink          = 76;
        eloop           = 77;
        eoverflow       = 78;
        eprototype      = 79;
        enoattr         = 80;
    }

    required Code  code        = 1; // exit code
    optional bytes description = 2; // optional error description
}

message FileBlock {
    required uint64 offset = 1;
    required uint64 size   = 2;
    optional bytes file_id = 3;
    optional bytes storage_id = 4;
}

message ChildLink {
    required bytes uuid = 1;
    required bytes name = 2;
}

message FileRenamedEntry {
    required bytes old_uuid = 1;
    required bytes new_uuid = 2;
    required bytes new_parent_uuid = 3;
    required bytes new_name = 4;
}

message Dir {
    required bytes uuid = 1;
}

enum OpenFlag {
    READ = 1;
    WRITE = 2;
    READ_WRITE = 3;
}
