Commit 66f78848 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Rename norns_rpc_type_t to norns_msgtype_t

parent aeffac30
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static int recv_message(int conn, norns_msgbuffer_t* buffer);
static ssize_t recv_data(int conn, void* data, size_t size);
static ssize_t send_data(int conn, const void* data, size_t size);
static void print_hex(void* buffer, size_t bytes) __attribute__((unused));
static norns_error_t send_request(norns_rpc_type_t type, norns_response_t* resp, ...);
static norns_error_t send_request(norns_msgtype_t type, norns_response_t* resp, ...);

norns_error_t
send_submit_request(norns_iotask_t* task) {
@@ -147,7 +147,7 @@ send_ping_request() {
}

norns_error_t
send_job_request(norns_rpc_type_t type, uint32_t jobid, nornsctl_job_t* job) {
send_job_request(norns_msgtype_t type, uint32_t jobid, nornsctl_job_t* job) {

    int res;
    norns_response_t resp;
@@ -166,7 +166,7 @@ send_job_request(norns_rpc_type_t type, uint32_t jobid, nornsctl_job_t* job) {


norns_error_t
send_process_request(norns_rpc_type_t type, uint32_t jobid, 
send_process_request(norns_msgtype_t type, uint32_t jobid, 
                     uid_t uid, gid_t gid, pid_t pid) {

    int res;
@@ -185,7 +185,7 @@ send_process_request(norns_rpc_type_t type, uint32_t jobid,
}

norns_error_t
send_namespace_request(norns_rpc_type_t type, const char* nsid, 
send_namespace_request(norns_msgtype_t type, const char* nsid, 
                       nornsctl_backend_t* ns) {

    int res;
@@ -204,7 +204,7 @@ send_namespace_request(norns_rpc_type_t type, const char* nsid,
}

static int
send_request(norns_rpc_type_t type, norns_response_t* resp, ...) {
send_request(norns_msgtype_t type, norns_response_t* resp, ...) {

    int res;
    int conn = -1;
+3 −3
Original line number Diff line number Diff line
@@ -34,11 +34,11 @@

norns_error_t send_submit_request(norns_iotask_t* task);
norns_error_t send_status_request(norns_iotask_t* task, norns_stat_t* stats);
norns_error_t send_job_request(norns_rpc_type_t type, uint32_t jobid, 
norns_error_t send_job_request(norns_msgtype_t type, uint32_t jobid, 
                               nornsctl_job_t* job);
norns_error_t send_process_request(norns_rpc_type_t type, uint32_t jobid, 
norns_error_t send_process_request(norns_msgtype_t type, uint32_t jobid, 
                                   uid_t uid, gid_t gid, pid_t pid);
norns_error_t send_namespace_request(norns_rpc_type_t type, const char* nsid, 
norns_error_t send_namespace_request(norns_msgtype_t type, const char* nsid, 
                                     nornsctl_backend_t* backend);
norns_error_t send_control_status_request(nornsctl_stat_t* stats);
norns_error_t send_ping_request() __attribute__((deprecated));
+6 −6
Original line number Diff line number Diff line
@@ -78,12 +78,12 @@ static void
free_path_msg(Norns__Rpc__Request__Task__PosixPath* msg);

static int 
encode_request_type(norns_rpc_type_t type);
static norns_rpc_type_t 
encode_request_type(norns_msgtype_t type);
static norns_msgtype_t 
decode_response_type(int type);

static int 
encode_request_type(norns_rpc_type_t type) {
encode_request_type(norns_msgtype_t type) {
    switch(type) {
        case NORNS_IOTASK_SUBMIT:
            return NORNS__RPC__REQUEST__TYPE__IOTASK_SUBMIT;
@@ -114,7 +114,7 @@ encode_request_type(norns_rpc_type_t type) {
    }
}

static norns_rpc_type_t 
static norns_msgtype_t 
decode_response_type(int norns_rpc_type) {
    switch(norns_rpc_type) {
        case NORNS__RPC__RESPONSE__TYPE__IOTASK_SUBMIT:
@@ -149,7 +149,7 @@ decode_response_type(int norns_rpc_type) {
}

Norns__Rpc__Request*
build_request_msg(norns_rpc_type_t type, va_list ap) {
build_request_msg(norns_msgtype_t type, va_list ap) {

    Norns__Rpc__Request* req_msg = NULL;

@@ -705,7 +705,7 @@ free_task_msg(Norns__Rpc__Request__Task* msg) {
}

int
pack_to_buffer(norns_rpc_type_t type, norns_msgbuffer_t* buf, ...) {
pack_to_buffer(norns_msgtype_t type, norns_msgbuffer_t* buf, ...) {

    Norns__Rpc__Request* req_msg = NULL;
    void* req_buf = NULL;
+3 −3
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ typedef enum {
    NORNS_NAMESPACE_UNREGISTER,
    /* other */
    NORNS_BAD_RPC
} norns_rpc_type_t;
} norns_msgtype_t;

typedef struct {
    void* b_data;
@@ -68,7 +68,7 @@ typedef struct {
}

typedef struct {
    norns_rpc_type_t r_type;
    norns_msgtype_t r_type;
    int r_error_code;
    union {
        size_t r_taskid;
@@ -85,7 +85,7 @@ typedef struct {
    };
} norns_response_t;

int pack_to_buffer(norns_rpc_type_t type, norns_msgbuffer_t* buf, ...);
int pack_to_buffer(norns_msgtype_t type, norns_msgbuffer_t* buf, ...);
int unpack_from_buffer(norns_msgbuffer_t* buf, norns_response_t* response);

#pragma GCC visibility pop