The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
vmps.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
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.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 /**
19  * $Id: 144fbf87e5247bf3519e7fff0ba57b8b53d4370c $
20  *
21  * @file src/protocols/vmps/vmps.h
22  * @brief Structures and prototypes for Cisco's VLAN Query Protocol
23  *
24  * @copyright 2007 The FreeRADIUS server project
25  * @copyright 2007 Alan DeKok (aland@deployingradius.com)
26  */
27 
28 RCSIDH(vmps_h, "$Id: 144fbf87e5247bf3519e7fff0ba57b8b53d4370c $")
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define FR_VQP_HDR_LEN (8)
35 #define FR_VQP_VERSION (1)
36 
37 bool fr_vmps_ok(uint8_t const *packet, size_t *packet_len);
38 
39 int fr_vmps_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, unsigned int *code);
40 
41 ssize_t fr_vmps_packet_size(uint8_t const *data, size_t data_len);
42 
43 void fr_vmps_print_hex(FILE *fp, uint8_t const *packet, size_t packet_len);
44 
45 ssize_t fr_vmps_encode(fr_dbuff_t *dbuff, uint8_t const *original,
46  int code, uint32_t id, fr_dcursor_t *cursor) CC_HINT(nonnull(1));
47 
48 typedef enum {
57 
58 #define FR_VMPS_PACKET_CODE_VALID(_code) (((_code) > 0) && ((_code) < FR_VMPS_CODE_MAX))
59 
60 extern char const *fr_vmps_packet_names[FR_VMPS_CODE_MAX];
61 
62 int fr_vmps_global_init(void);
63 
64 void fr_vmps_global_free(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
#define RCSIDH(h, id)
Definition: build.h:445
unsigned int uint32_t
Definition: merged_model.c:33
long int ssize_t
Definition: merged_model.c:24
unsigned char uint8_t
Definition: merged_model.c:30
static fr_slen_t data
Definition: value.h:1259
int nonnull(2, 5))
static size_t char ** out
Definition: value.h:984
fr_vmps_packet_code_t
Definition: vmps.h:48
@ FR_VMPS_RECONFIRM_RESPONSE
Definition: vmps.h:53
@ FR_VMPS_INVALID
Definition: vmps.h:49
@ FR_VMPS_DO_NOT_RESPOND
Definition: vmps.h:55
@ FR_VMPS_JOIN_RESPONSE
Definition: vmps.h:51
@ FR_VMPS_CODE_MAX
Definition: vmps.h:54
@ FR_VMPS_RECONFIRM_REQUEST
Definition: vmps.h:52
@ FR_VMPS_JOIN_REQUEST
Definition: vmps.h:50
int fr_vmps_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, unsigned int *code)
Definition: vmps.c:154
int fr_vmps_global_init(void)
Definition: base.c:55
void fr_vmps_global_free(void)
Definition: base.c:79
char const * fr_vmps_packet_names[FR_VMPS_CODE_MAX]
Definition: vmps.c:75
ssize_t fr_vmps_encode(fr_dbuff_t *dbuff, uint8_t const *original, int code, uint32_t id, fr_dcursor_t *cursor))
Definition: vmps.c:271
bool fr_vmps_ok(uint8_t const *packet, size_t *packet_len)
Definition: vmps.c:83
ssize_t fr_vmps_packet_size(uint8_t const *data, size_t data_len)
See how big of a packet is in the buffer.
Definition: vmps.c:376
void fr_vmps_print_hex(FILE *fp, uint8_t const *packet, size_t packet_len)
Print a raw VMPS packet as hex.
Definition: vmps.c:468