-
Notifications
You must be signed in to change notification settings - Fork 1
/
eaputility.h
48 lines (36 loc) · 1.46 KB
/
eaputility.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
eaputility.h: utilities
Copyright (C) 2014 C.C.<exiledkingcc@gmail.com>
This file is part of ccnt.
ccnt is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ccnt 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ccnt. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>
#include <string>
using std::uint8_t;
using std::string;
#include <pcap.h>
#include "md5.h"
#include "eaperror.h"
const string net2str(const uint32_t net);
const string net2str(const uint8_t net[4]);
const string mac2str(const uint8_t mac[6]);
uint32_t str2net(const string &str);
const uint8_t* str2net(const string &str,uint8_t net[4]);
const uint8_t* str2mac(const string &str,uint8_t mac[6]);
const string encode_passwd(const string &text);
const string decode_passwd(const string &code);
void do_md5(const void* data, size_t num, uint8_t md5bytes[]);
void get_pcap_device(const string& devname, pcap_t **pdev) throw(eap_runtime_error);
#define SEM_CCNT_NAME "ccnt_already_running"
bool enter_running();
void leave_running();