2 * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 #define EAD_DEBUGLEVEL 2
26 #define EAD_PORT 56026UL
27 #define EAD_MAGIC 3671771902UL
28 #define EAD_CMD_TIMEOUT 10
30 #define EAD_MAX_IV_INCR 128
32 /* request/response types */
33 /* response id == request id + 1 */
38 EAD_TYPE_SET_USERNAME
,
39 EAD_TYPE_ACK_USERNAME
,
70 } __attribute__((packed
));
72 struct ead_msg_number
{
75 } __attribute__((packed
));
80 unsigned char salt
[MAXSALTLEN
];
81 unsigned char ext_salt
[MAXSALTLEN
];
82 } __attribute__((packed
));
86 } __attribute__((packed
));
89 unsigned char data
[20];
90 } __attribute__((packed
));
96 } __attribute__((packed
));
98 struct ead_msg_cmd_data
{
100 unsigned char data
[];
101 } __attribute__((packed
));
103 struct ead_msg_encrypted
{
108 struct ead_msg_cmd cmd
;
109 struct ead_msg_cmd_data cmd_data
;
111 } __attribute__((packed
));
114 #define EAD_DATA(_msg, _type) (&((_msg)->data[0]._type))
115 #define EAD_ENC_DATA(_msg, _type) (&((_msg)->data[0].enc.data[0]._type))
121 uint16_t nid
; /* node id */
122 uint16_t tid
; /* transaction id */
124 struct ead_msg_pong pong
;
125 struct ead_msg_user user
;
126 struct ead_msg_number number
;
127 struct ead_msg_auth auth
;
128 struct ead_msg_salt salt
;
129 struct ead_msg_encrypted enc
;
131 } __attribute__((packed
));