Newer
Older
Scratch / ubixos-home / src / sys / include / ubixos / message.h
@Christopher W. Olsen Christopher W. Olsen on 25 Oct 2019 843 bytes Scratch
#ifndef __MESSAGE_H
#define __MESSAGE_H

#include <ubixos/schedule.h>
#include <ubixos/types.h>

int connectionCreate(char * cname, uInt32 * cid, uInt8 flags);
int connectionOpen(char * cname, uInt32 * cid);
int messageRecv(uInt32 cid, uInt32 * sender, uInt32 * cmd, uInt32 * size, uInt8 * data);
int messageSend(uInt32 cid, uInt32 * cmd, uInt32 * size, uInt8 * data);
int messageReply(uInt32 cid, uInt32 mid, uInt32 cmd, uInt32 size, uInt8 * data);

enum {
    MSG_SEND = 0x1,
    MSG_REPLY = 0x2
};

typedef struct connectionStruct {
    uInt32 used;
    uInt32 owning_pid;
    uInt8  unique_string[256];
    waitQueue_t message_queue;
    waitQueue_t old_queue;
} connection_t;

typedef struct messageStruct {
    uInt32 send_taskId;
    uInt32 id;
    uInt32 cmd;
    uInt8 flags;
    uInt8 size;
    uInt8 data[256];
} message_t;

#endif