msg.h
author viric@llimona
Sun, 25 Mar 2007 04:55:18 +0200
changeset 23 96fcebb68510
parent 22 afdc8410633f
child 31 1a6c732b0b71
permissions -rw-r--r--
More TODO for the next versions.

extern int server_socket;

enum
{
    CMD_LEN=500,
    LINE_LEN=500
};

enum msg_types
{
    KILL,
    NEWJOB,
    NEWJOB_OK,
    RUNJOB,
    RUNJOB_OK,
    ENDJOB,
    LIST,
    LIST_LINE,
    CLEAR_FINISHED
};

struct msg
{
    enum msg_types type;

    union
    {
        struct {
            int command_size;
            int store_output;
        } newjob;
        struct {
            int ofilename_size;
            int store_output;
        } runjob_ok;
        int jobid;
        int errorlevel;
        int line_size;
    } u;
};


enum Jobstate
{
    QUEUED,
    RUNNING,
    FINISHED,
};

void send_bytes(const int fd, const char *data, const int bytes);
int recv_bytes(const int fd, char *data, const int bytes);
void send_msg(const int fd, const struct msg *m);
int recv_msg(const int fd, struct msg *m);