00001 /* 00002 * Active Router Transport Protocol (ARTP) implementation 00003 * Copyright (c) 2004, Tomas Rebok 00004 * All rights reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the "BSD License" which is 00008 * distributed with the software in the file LICENSE. 00009 * 00010 * This program is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD 00013 * License for more details. 00014 */ 00015 00023 #ifndef ARTP_PACKET_H 00024 #define ARTP_PACKET_H 1 00025 00026 00027 #include "types.h" 00028 00029 00031 enum packet_type { DATA, CTRL, ACK 00035 }; 00036 00037 00039 enum ctrl_type { REQUEST, REPLY 00042 }; 00043 00044 00046 struct control_type 00047 { 00049 enum ctrl_type type; 00050 00052 CTRL_OPTID_TYPE optid; 00053 00055 char *value; 00056 00058 CTRL_VALUE_SZ_TYPE valuesize; 00059 }; 00060 00061 00063 struct payload_CTRL 00064 { 00066 int count; 00067 00069 struct control_type *control; 00070 }; 00071 00072 00074 struct payload_DATA 00075 { 00077 DSEQ_TYPE dseq; 00078 00080 char *sigdata; 00081 00083 SIGSZ_TYPE sigsz; 00084 00086 char *encdata; 00087 00089 ENCDATA_SIZE_TYPE encsz; 00090 }; 00091 00092 00094 union payload_type 00095 { 00097 struct payload_DATA data; 00098 00100 struct payload_CTRL ctrl; 00101 }; 00102 00103 00105 struct artp_dgram 00106 { 00108 enum packet_type type; 00109 00111 union payload_type payload; 00112 }; 00113 00114 00115 #endif 00116 00117 /* vim: set ts=4 : */