diff --git a/src/common/request.h b/src/common/request.h new file mode 100644 --- /dev/null +++ b/src/common/request.h @@ -0,0 +1,45 @@ +/* + * 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_REQUEST_H +#define _DISTREN_REQUEST_H + +/** + * @file functions to initialize various requests that the server and + * client may both use. + */ + + +/** + * Free any request made with one of the functions below + */ +int distren_request_free_with_data(struct distren_request *req, void *data); + +/** + * Initialize a PING or PONG request. + * + * @param data a place to allocate storage for the data associated with this request + * @param is_ping 1 if this is a DISTREN_REQUEST_PING or 0 if this is a DISTREN_REQUEST_PONG + * @param poing_cookie chocolate chip, chocolate chunk, or oatmeal chocolate chip + * @param poing_data_len bytes in the poing_cookie + * @return the length of the data allocated for this request + */ +uint32_t distren_request_poing(struct distren_request **req, void **data, short is_ping, const void *poing_cookie, size_t poing_data_len); + +#endif /* _DISTREN_REQUEST_H */