diff --git a/src/common/protocol.h b/src/common/protocol.h --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -61,12 +61,28 @@ enum distren_request_type */ DISTREN_REQUEST_VERSION = 1, /** + * Test if the end has a live server. + * + * Only authenticated clients may use this request. Thus, if a + * client wants to confirm that a DISTREN_REQUEST_PASS request was + * successful, that client may send a DISTREN_REQUEST_PING + * immediately after the DISTREN_REQUEST_PASS and then wait for + * the PONG. + * * DATA: up to 32 bytes of a PING cookie * * REQUIRED: ALL */ DISTREN_REQUEST_PING = 2, /** + * Response to DISTREN_REQUEST_PING. + * + * Unauthenticated clients may be penalized for responding to PING + * requests. This is because a newly connecting client should + * queue a DISTREN_REQUEST_VERSION and DISTREN_REQUEST_PASS + * back-to-back before checking for and processing data from the + * remote server. + * * DATA: up to 32 bytes copied from a received PING cookie * * REQUIRED: ALL @@ -84,12 +100,31 @@ enum distren_request_type */ DISTREN_REQUEST_DISCONNECT = 4, + + /** + * Allow a client to identify itself using simple password + * authentication. + * + * As there is no distren request which affirms a + * DISTREN_REQUEST_PASS went through, clients may send a + * DISTREN_REQUEST_PING and wait for the DISTREN_REQUETS_PONG they + * want to block until they're authenticated. + * + * DATA: struct distren_request_pass + * + * REQUIRED: DISTREN_SERVERTYPE_SUBMIT (for now, since + * server2server links are only protected using password + * authentication, all server types have to support this except + * for the client.) + */ + DISTREN_REQUEST_PASS = 5, + /** * DATA: struct distren_request_submit * * REQUIRED: DISTREN_SERVERTYPE_SUBMIT */ - DISTREN_REQUEST_SUBMIT = 5, + DISTREN_REQUEST_SUBMIT = 6, /** * Inform the other party about a job. @@ -98,7 +133,7 @@ enum distren_request_type * * REQUIRED: ALL */ - DISTREN_REQUEST_JOBINFO = 6, + DISTREN_REQUEST_JOBINFO = 7, /** * Request a DISTREN_REQUEST_JOBINFO @@ -107,7 +142,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_SUBMIT, DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_JOBINFO_GET = 7, + DISTREN_REQUEST_JOBINFO_GET = 8, /** * Command the other party to render a frame @@ -116,7 +151,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_RENDER */ - DISTREN_REQUEST_FRAME_RENDER = 8, + DISTREN_REQUEST_FRAME_RENDER = 9, /** * Inform the receiver of the sender's state, such as frames being * rendered or jobs that need to be completed. @@ -125,7 +160,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_RENDER, DISTREN_SERVERTYPE_DISTRIBUTE, DISTREN_SERVERTYPE_CLIENT */ - DISTREN_REQUEST_STATUS = 9, + DISTREN_REQUEST_STATUS = 10, /** * Request that the receiver send a DISTREN_REQUEST_FRAME_STATUS @@ -136,7 +171,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_RENDER */ - DISTREN_REQUEST_STATUS_GET = 10, + DISTREN_REQUEST_STATUS_GET = 11, /** * Declare that a client is preparing to post a file using a @@ -157,7 +192,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_SUBMIT, DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_FILE_POST_START = 11, + DISTREN_REQUEST_FILE_POST_START = 12, /** * Allow a client to upload a job tarball over a remoteio line. A @@ -182,7 +217,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_SUBMIT, DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_FILE_POST = 12, + DISTREN_REQUEST_FILE_POST = 13, /** * Marks a post-id's file as having completely uploaded. Provides @@ -193,7 +228,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_SUBMIT, DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_FILE_POST_FINISH = 13, + DISTREN_REQUEST_FILE_POST_FINISH = 14, /** * Request information about obtaining a file (such as a @@ -203,7 +238,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_FILE_FIND = 14, + DISTREN_REQUEST_FILE_FIND = 15, /** * Provide information about obtaining a file (such as a URL). @@ -212,7 +247,7 @@ enum distren_request_type * * REQUIRED: DISTREN_SERVERTYPE_DISTRIBUTE */ - DISTREN_REQUEST_FILE = 15, + DISTREN_REQUEST_FILE = 16, }; struct distren_request @@ -236,6 +271,14 @@ struct distren_request_version char package_string[DISTREN_REQUEST_VERSION_PACKAGE_STRING_LEN + 1]; }; +#define DISTREN_REQUEST_PASS_USERNAME_LEN (16) +#define DISTREN_REQUEST_PASS_PASS_LEN (32) +struct distren_request_pass +{ + char username[DISTREN_REQUEST_PASS_USERNAME_LEN]; + char pass[DISTREN_REQUEST_PASS_PASS_LEN]; +}; + #define DISTREN_REQUEST_FILE_POST_NAME_LEN (64) struct distren_request_file_post_start {