00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef NUFW_PROTOCOL_H
00023 #define NUFW_PROTOCOL_H
00024
00025 #ifdef HAVE_CONFIG_H
00026 # include "config.h"
00027 #endif
00028
00029 #ifdef LINUX
00030 # include <endian.h>
00031 #else
00032 # include <machine/endian.h>
00033 #endif
00034
00035 #define AUTHREQ_PORT 4128
00036 #define USERPCKT_PORT 4129
00037 #define USERPCKT_SERVICE "4129"
00038
00039
00040
00041 #define PROTO_STRING "PROTO"
00042 #define PROTO_UNKNOWN 0
00043
00044 enum proto_type_t {
00045 NUFW_PROTO = 0,
00046 CLIENT_PROTO
00047 };
00048
00049 enum proto_client_version_t {
00050 PROTO_VERSION_V20 = 3,
00051 PROTO_VERSION_V22,
00052 PROTO_VERSION_V22_1
00053 };
00054
00055 #define PROTO_VERSION PROTO_VERSION_V22
00056
00057 enum proto_nufw_version_t {
00058 PROTO_VERSION_NUFW_V20 = 3,
00059 PROTO_VERSION_NUFW_V22,
00060 PROTO_VERSION_NUFW_V22_2
00061 };
00062
00063 #define PROTO_NUFW_VERSION PROTO_VERSION_NUFW_V22_2
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 struct nu_header {
00077 #ifdef WORDS_BIGENDIAN
00078 uint8_t msg_type:4;
00079 uint8_t proto:4;
00080 #else
00081 uint8_t proto:4;
00082 uint8_t msg_type:4;
00083 #endif
00084 uint8_t option;
00085 uint16_t length;
00086 };
00087
00088
00089
00096 typedef struct {
00098 uint8_t protocol_version;
00099
00101 uint8_t msg_type;
00102
00104 uint16_t msg_length;
00105 } nufw_to_nuauth_message_header_t;
00106
00110 #define OS_SRV 0x1
00111
00112 #define APP_TYPE_NAME 0x1
00119 #define APP_TYPE_SHA1 0x2
00120
00121 typedef enum {
00122 DECISION_DROP = 0,
00123 DECISION_ACCEPT,
00124 DECISION_NODECIDE,
00125 DECISION_REJECT
00126 } decision_t;
00127
00128
00134 typedef enum {
00135 AUTH_REQUEST = 0x1,
00136 AUTH_ANSWER,
00137 USER_REQUEST,
00138 AUTH_CONTROL,
00139 USER_HELLO,
00140 AUTH_CONN_DESTROY,
00141 AUTH_CONN_UPDATE,
00142 AUTH_CONN_FIXED_TIMEOUT
00143 } nufw_message_t;
00144
00145
00146 typedef enum {
00147 IPV4_FIELD = 1,
00148 IPV6_FIELD,
00149 APP_FIELD,
00150 OS_FIELD,
00151 USERNAME_FIELD,
00152 HELLO_FIELD
00153 } nu_field_identifier_t;
00154
00155 struct nu_authreq {
00156 uint16_t packet_seq;
00157 uint16_t packet_length;
00158 };
00159
00164 struct nu_authfield {
00165 uint8_t type;
00166 uint8_t option;
00167 uint16_t length;
00168 };
00169
00170 struct nu_authfield_ipv6 {
00171 uint8_t type;
00172 uint8_t option;
00173 uint16_t length;
00174 struct in6_addr src;
00175 struct in6_addr dst;
00176 uint8_t proto;
00177 uint8_t flags;
00178 uint16_t FUSE;
00179 uint16_t sport;
00180 uint16_t dport;
00181 };
00182
00183 struct nu_authfield_ipv4 {
00184 uint8_t type;
00185 uint8_t option;
00186 uint16_t length;
00187 uint32_t src;
00188 uint32_t dst;
00189 uint8_t proto;
00190 uint8_t flags;
00191 uint16_t FUSE;
00192 uint16_t sport;
00193 uint16_t dport;
00194 };
00195
00196
00197
00201 struct nu_authfield_app {
00202 uint8_t type;
00203 uint8_t option;
00204 uint16_t length;
00206
00207 };
00208
00209 struct nu_authfield_hello {
00210 uint8_t type;
00211 uint8_t option;
00212 uint16_t length;
00213 uint32_t helloid;
00214 };
00215
00216
00217
00218
00219
00220 typedef enum {
00221 SRV_TYPE = 1,
00222 SRV_REQUIRED_PACKET,
00223 SRV_REQUIRED_DISCONNECT,
00224 SRV_REQUIRED_HELLO
00225 } nu_type_t;
00226
00228 typedef enum {
00229 SRV_TYPE_POLL = 0,
00230 SRV_TYPE_PUSH
00231 } nu_server_mode_t;
00232
00233 struct nu_srv_message {
00234 uint8_t type;
00235 uint8_t option;
00236 uint16_t length;
00237 };
00238
00239 struct nu_srv_helloreq {
00240 uint8_t type, option;
00241 uint16_t length;
00242 uint32_t helloid;
00243 };
00244
00245
00246 #include <proto_v3.h>
00247
00248
00249 #include <proto_v4.h>
00250
00251 #endif