~ubuntu-branches/ubuntu/oneiric/openvpn/oneiric

« back to all changes in this revision

Viewing changes to dhcp.h

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2008-10-07 16:30:44 UTC
  • mfrom: (1.1.11 upstream) (10.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20081007163044-ixx04wg588z1972e
Tags: 2.1~rc11-1ubuntu1
* Merge with Debian (LP: #279655), remaining diffs:
  - debian/openvpn.init.d: Added 'status' action to init script, show
    per-VPN result messages and add "--script-security 2" by default for
    backwards compatibility
  - debian/control: Added lsb-base>=3.2-14 depend to allow status_of_proc()
* Fixes regression when calling commands with arguments (LP: #277447)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  OpenVPN -- An application to securely tunnel IP networks
 
3
 *             over a single TCP/UDP port, with support for SSL/TLS-based
 
4
 *             session authentication and key exchange,
 
5
 *             packet encryption, packet authentication, and
 
6
 *             packet compression.
 
7
 *
 
8
 *  Copyright (C) 2002-2008 Telethra, Inc. <sales@openvpn.net>
 
9
 *
 
10
 *  This program is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License version 2
 
12
 *  as published by the Free Software Foundation.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with this program (see the file COPYING included with this
 
21
 *  distribution); if not, write to the Free Software Foundation, Inc.,
 
22
 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
#ifndef DHCP_H
 
26
#define DHCP_H
 
27
 
 
28
#include "common.h"
 
29
#include "buffer.h"
 
30
#include "proto.h"
 
31
 
 
32
#pragma pack(1)
 
33
 
 
34
/* DHCP Option types */
 
35
#define DHCP_PAD          0
 
36
#define DHCP_ROUTER       3
 
37
#define DHCP_MSG_TYPE    53  /* message type (u8) */
 
38
#define DHCP_END        255
 
39
 
 
40
/* DHCP Messages types */
 
41
#define DHCPDISCOVER 1
 
42
#define DHCPOFFER    2
 
43
#define DHCPREQUEST  3
 
44
#define DHCPDECLINE  4
 
45
#define DHCPACK      5
 
46
#define DHCPNAK      6
 
47
#define DHCPRELEASE  7
 
48
#define DHCPINFORM   8
 
49
 
 
50
/* DHCP UDP port numbers */
 
51
#define BOOTPS_PORT 67
 
52
#define BOOTPC_PORT 68
 
53
 
 
54
struct dhcp {
 
55
# define BOOTREQUEST 1
 
56
# define BOOTREPLY   2
 
57
  uint8_t op;          /* message op */
 
58
 
 
59
  uint8_t  htype;      /* hardware address type (e.g. '1' = 10Mb Ethernet) */
 
60
  uint8_t  hlen;       /* hardware address length (e.g. '6' for 10Mb Ethernet) */
 
61
  uint8_t  hops;       /* client sets to 0, may be used by relay agents */
 
62
  uint32_t xid;        /* transaction ID, chosen by client */
 
63
  uint16_t secs;       /* seconds since request process began, set by client */
 
64
  uint16_t flags;
 
65
  uint32_t ciaddr;     /* client IP address, client sets if known */
 
66
  uint32_t yiaddr;     /* 'your' IP address -- server's response to client */
 
67
  uint32_t siaddr;     /* server IP address */
 
68
  uint32_t giaddr;     /* relay agent IP address */
 
69
  uint8_t  chaddr[16]; /* client hardware address */
 
70
  uint8_t  sname[64];  /* optional server host name */
 
71
  uint8_t  file[128];  /* boot file name */
 
72
  uint32_t magic;      /* must be 0x63825363 (network order) */
 
73
};
 
74
 
 
75
struct dhcp_full {
 
76
  struct openvpn_iphdr ip;
 
77
  struct openvpn_udphdr udp;
 
78
  struct dhcp dhcp;
 
79
# define DHCP_OPTIONS_BUFFER_SIZE 256
 
80
  uint8_t options[DHCP_OPTIONS_BUFFER_SIZE];
 
81
};
 
82
 
 
83
#pragma pack()
 
84
 
 
85
in_addr_t dhcp_extract_router_msg (struct buffer *ipbuf);
 
86
 
 
87
#endif