Files
@ ef03a563218c
Branch filter:
Location: DistRen/src/common/protocol.h - annotation
ef03a563218c
4.4 KiB
text/plain
Created, added, and partially integrated into distrend a poll() wrapper, multiio.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | 2a6cba487424 abcf8952747b 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 2a6cba487424 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e 7d1fd1fe48fc 4ca5ce00932e 4ca5ce00932e 2a6cba487424 bbfee659a30a bbfee659a30a bbfee659a30a bbfee659a30a bbfee659a30a bbfee659a30a bbfee659a30a 2a6cba487424 2a6cba487424 2a6cba487424 4757644414d3 144cab775ebd 4757644414d3 4757644414d3 4757644414d3 c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da 144cab775ebd 4757644414d3 22ee38bf8490 22ee38bf8490 22ee38bf8490 22ee38bf8490 22ee38bf8490 4757644414d3 144cab775ebd 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 4757644414d3 44885c088956 44885c088956 144cab775ebd 99a5a69d493c c6a12058c9da c6a12058c9da 44885c088956 44885c088956 c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da 144cab775ebd 4757644414d3 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e 7d1fd1fe48fc 7d1fd1fe48fc 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e ef03a563218c 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da c6a12058c9da 4ca5ce00932e ef03a563218c ef03a563218c 7d1fd1fe48fc 7d1fd1fe48fc 7d1fd1fe48fc 7d1fd1fe48fc ef03a563218c 4ca5ce00932e 4ca5ce00932e 4ca5ce00932e ef03a563218c ef03a563218c ef03a563218c ef03a563218c ef03a563218c ef03a563218c ef03a563218c ef03a563218c 4ca5ce00932e | /*
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 <http://www.gnu.org/licenses/>.
*/
#ifndef DISTREN_PROTOCOL_H
#define DISTREN_PROTOCOL_H
#include <stddef.h>
#include <stdint.h>
/**
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
{
/**
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,
/**
The data is the a reason describing why the one end is
disconnecting. The other end should respectfully close()
the socket or the sender will timeout shortly.
*/
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 */
/**
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,
};
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);
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.
*/
int distren_request_new_fromdata(struct distren_request **req, void *data, size_t len);
/**
* frees request
*/
int distren_request_free(struct distren_request *req);
/**
* An implementation of remoteio_read_handle_func_t for use with remoteio.
*
* To use this handler, first initialize a struct distren_request_remoteio_data.
* (to be continued... or not...? ;-) )
*/
/* size_t distren_request_remoteio_handle(struct remoteio *rem, void *generic_data, void *buf, size_t len, void *data); */
#endif
|