diff --git a/src/common/protocol.h b/src/common/protocol.h --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -39,8 +39,12 @@ */ 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 */ + /** + identifies the version of software being + used by the sender and tells if it is a client or server. + Just send PACKAGE_STRING. + */ + DISTREN_REQUEST_VERSION = 1, DISTREN_REQUEST_PING = 2, DISTREN_REQUEST_PONG = 3, DISTREN_REQUEST_DISCONNECT = 4, @@ -68,16 +72,17 @@ enum distren_request_type 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_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)*/ + /** + 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) + */ + DISTREN_REQUEST_RESETFRAME = 15, }; @@ -94,6 +99,19 @@ struct distren_request */ int distren_request_new(struct distren_request **req, uint32_t len, enum distren_request_type type); +struct remoteio; +/** + Takes a struct distren_request and its associated data, allocates + a new block of data to hold the whole packet, and packets the req + header and data together. + + @param rem A remoteio handle to ship this packet off to + @param req Something you initialized with distren_request_new(). You are responsible for distren_request_free()ing this yourself. + @param data A chunk of data the size of req->len. You are responsible for free()ing this yourself. + @return 0 on success and 1 on failure. + */ +int distren_request_send(struct remoteio *rem, struct distren_request *req, void *data); + /** initializes and allocates request based on raw input data which includes the headers of the request.