dislserver.proto 2.6 KB
Newer Older
1 2 3 4 5 6
syntax = "proto3";

option java_package = "ch.usi.dag.dislserver";
option java_outer_classname = "Protocol";
option optimize_for = LITE_RUNTIME;

7 8 9 10 11 12 13 14 15
// Common type to send errors
message Error {
    int32 code = 1;
    string message = 2;
}

// Request server to initialize session
// This is sent as the clients first message
// May contain some additional data to describe the client (JVM version etc.)
16
message SessionInitRequest {}
17 18 19 20 21 22 23 24 25 26 27 28 29

// This is the response to SessionInitRequest message
// The request could either be ACCEPTed or DENYed
// In the case of positive answer, there is also a session_id present
message SessionInitResponse {
    bool accepted = 1;
    int32 session_id = 2;
    repeated Error errors = 3;
}

// When the client obtains the session_id, next step should be sending
// the instrumentation jar (or more of them) to the instrumentation server.
message InstrumentationDelivery {
30 31
    repeated int32 sizes = 1;
    bytes instrumentation = 2;
32 33 34
}

// This is server response to InstrumentationDelivery message
35
message InstrumentationAcceptConfirmation {
36 37 38 39
    bool instrumentation_accepted = 1;
    repeated Error errors = 2;
}

Lubomir Bulej's avatar
Lubomir Bulej committed
40 41
message ClassInfo {
    string className = 1;
42 43 44
    int64 classLoaderTag = 2;
}

45
// This is the request to the instrumentaion server to instrument attached class.
46
message InstrumentClassRequest {
47
    int32 flags = 2;
Lubomir Bulej's avatar
Lubomir Bulej committed
48
    ClassInfo classInfo = 5;
49
    bytes classBytes = 4;
Lubomir Bulej's avatar
Lubomir Bulej committed
50
    repeated ClassInfo superTypes = 6;
51 52
}

53 54 55 56 57 58 59 60 61 62 63 64
// Server response containing either the instrumented classbytes or error message
message InstrumentClassResponse {

    enum InstrumentClassResult {
        CLASS_UNMODIFIED = 0;
        CLASS_MODIFIED = 1;
        ERROR = 3;
    }

    InstrumentClassResult result = 1;
    string errorMessage = 2;
    bytes classBytes = 3;
65 66
}

Vít Kabele's avatar
Vít Kabele committed
67 68 69 70 71 72
// Notify server about closing connection
message CloseConnection {
    enum CloseReason {
        FINISHED = 0;
    }

73
    CloseReason reason = 2;
Vít Kabele's avatar
Vít Kabele committed
74 75 76

}

77 78
// Pack together messages from client to simply distinguish them at the server side.
message ClientMessage {
79
    int32 session_id = 1;
80
    oneof request {
81 82 83 84
        SessionInitRequest session_init_request = 2;
        InstrumentationDelivery instrumentation_delivery = 3;
        InstrumentClassRequest instrument_class_request = 4;
        CloseConnection close_connection = 5;
85 86 87 88 89 90 91 92 93 94
    }
}

// Pack together messages from server to simply distinguish them at the client side.
message ServerMessage {
    oneof response {
        SessionInitResponse session_init_response = 1;
        InstrumentationAcceptConfirmation instrumentation_accept_confirmation =2;
        InstrumentClassResponse instrument_class_response = 3;
    }
95
}