/*
Copyright 2010 Nathan Phillip Brink
This file is a part of DistRen.
DistRen is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DistRen is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with DistRen. If not, see .
*/
#ifndef DISTREN_PROTOCOL_H
#define DISTREN_PROTOCOL_H
#include
#include
/**
Server types:
*/
#define DISTREN_SERVERTYPE_SUBMIT (0x1)
#define DISTREN_SERVERTYPE_DISTRIBUTE (0x2)
#define DISTREN_SERVERTYPE_RENDER (0x4)
/**
This file defines the constants and structs that the client uses to talk to the server and that the servers use to talk to eachother.
*/
/**
generic, shared requests
*/
enum distren_request_type
{
DISTREN_REQUEST_VERSION = 1, /*< identifies the version of software being
used by the sender and tells if it is a client or server */
DISTREN_REQUEST_PING = 2,
DISTREN_REQUEST_PONG = 3,
DISTREN_REQUEST_DISCONNECT = 4,
/**
client->server only requests
*/
DISTREN_REQUEST_SUBMIT = 5,
/**
anything->server requests
*/
DISTREN_REQUEST_JOBINFO = 6, /*< retrieves information about a job based on its number */
/**
server->anything
*/
DISTREN_REQUEST_JOBINFO_RESPONSE = 7, /*< returns information about a job */
/**
server->server
*/
DISTREN_REQUEST_RENDERFRAME = 8,
DISTREN_REQUEST_DONEFRAME = 9, /* server should check to make sure the
slave is repoting on a frame it's actually assigned to */
DISTREN_REQUEST_PROGRESS = 10, /*< tells another server of the progress of the first server's work at rendering */
DISTREN_REQUEST_GETWORK = 11,
DISTREN_REQUEST_GETVERSION = 12, /* returns version of software that slave
should be running */
DISTREN_REQUEST_GETRENDERPOWER = 13, /* returns the render power of a
slave */
DISTREN_REQUEST_SETRENDERPOWER = 14, /* sets renderpower in server
database */
DISTREN_REQUEST_RESETFRAME = 15, /* sets a frame back to unassigned,
happens if the slave quits for some reason. server code should only allow
resetting of a frame assigned to the slave calling the request (see php
code)*/
};
struct distren_request
{
uint32_t magic;
uint32_t len;
/** treat type as an enum distren_request_type using casting */
uint32_t /* enum distren_request_type */ type;
};
/**
initializes and allocates request
*/
int distren_request_new(struct distren_request **req, uint32_t len, enum distren_request_type type);
/**
initializes and allocates request based on raw input data
which includes the headers of the request.
*/
int distren_request_new_fromdata(struct distren_request **req, void *data, size_t len);
/**
frees request
*/
int distren_request_free(struct distren_request *req);
#endif