-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoptions.h
126 lines (107 loc) · 2.84 KB
/
options.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* PXE daemon - enable the remote booting of PXE enabled machines.
* Copyright (C) 2000 Tim Hurman (kano@kano.org.uk)
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/******************************************************************************
* options.h - read the config options from the file *
******************************************************************************/
#ifndef _OPTIONS_H
#define _OPTIONS_H
#include <sys/types.h>
#include <iostream>
#include <fstream>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "autoconf.h"
#include "sysexception.h"
#include "logfile.h"
struct _services
{
int csa;
uint8_t min_level;
uint8_t max_level;
uint16_t menu_id;
char *filebase;
char *menu_text;
struct _services *next;
};
typedef struct _services services_t;
struct _CSA
{
uint16_t arch_id;
const char *arch_name;
};
typedef struct _CSA CSA_t;
#define CSA_MAX_TYPES 7
extern CSA_t CSA_types[CSA_MAX_TYPES];
struct _option
{
uint8_t major_no;
uint8_t minor_no;
uint8_t len;
uint8_t *data;
struct _option *next;
};
typedef struct _option option;
class Options
{
private:
char *interface;
char *prompt;
uint8_t prompt_timeout;
uint32_t multicast_address;
char *domain;
char *tftpdbase;
uint16_t port;
unsigned char use_multicast;
unsigned char use_broadcast;
services_t *serv_head;
uint16_t mtftp_cport;
uint16_t mtftp_sport;
uint32_t mtftp_address;
uint32_t default_address;
LogFile *log;
public:
Options(LogFile *);
Options(LogFile *, const char *);
~Options();
char *GetInterface();
uint16_t GetPort();
int UseMulticast();
int UseBroadcast();
uint32_t GetMulticast();
uint32_t GetMTFTPAddr();
uint16_t GetMTFTPsport();
uint16_t GetMTFTPcport();
uint32_t GetDefAddr();
uint8_t GetMenuTimeout();
char *GetMenuPrompt();
uint16_t CheckMenu(uint16_t);
option *MakeBootMenu(int, int *, int *);
uint8_t GetMinLayer(int, int);
uint8_t GetMaxLayer(int, int);
char *MakeFilename(int, int, uint8_t);
int CheckLayer(int, int, uint8_t);
private:
void ReadFile(const char *);
void AddService(char *, int *);
};
#endif