/* * Active Router Transport Protocol (ARTP) implementation * Copyright (c) 2004, Tomas Rebok * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the "BSD License" which is * distributed with the software in the file LICENSE. * * This program 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 BSD * License for more details. */ /** @file * @c ARTP packet structure definition. * @author Tomas Rebok * @date 2004 */ #ifndef ARTP_PACKET_H #define ARTP_PACKET_H 1 #include "types.h" /** @c ARTP packet possible types. */ enum packet_type { /** data packet */ DATA, /** control packet */ CTRL, /** acknowledgement packet */ ACK }; /** @c ARTP control packet possible types. */ enum ctrl_type { /** request packet */ REQUEST, /** reply packet */ REPLY }; /** @c ARTP control packet structure (its items) */ struct control_type { /** the option type */ enum ctrl_type type; /** the option identification */ CTRL_OPTID_TYPE optid; /** the option value */ char *value; /** the option value size */ CTRL_VALUE_SZ_TYPE valuesize; }; /** Structure describing @c ARTP control payload. */ struct payload_CTRL { /** total count of control elements */ int count; /** control elements */ struct control_type *control; }; /** Structure describing @c ARTP data payload. */ struct payload_DATA { /** data sequence number */ DSEQ_TYPE dseq; /** data signature */ char *sigdata; /** data signature size */ SIGSZ_TYPE sigsz; /** encrypted data */ char *encdata; /** encrypted data size */ ENCDATA_SIZE_TYPE encsz; }; /** @c ARTP packet payload */ union payload_type { /** data payload */ struct payload_DATA data; /** control payload */ struct payload_CTRL ctrl; }; /** @c ARTP packet structure */ struct artp_dgram { /** packet type */ enum packet_type type; /** packet payload */ union payload_type payload; }; #endif /* vim: set ts=4 : */