1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * ident "%Z%%M% %I% %E% SMI"
24 *
25 * Copyright (c) 1998-1999 Sun Microsystems, Inc.
26 * All rights reserved.
27 */
28
29 package com.sun.dhcpmgr.data;
30
31 import java.io.Serializable;
32
33 /**
34 * This class represents an IP network interface on the server. It consists
35 * of the interface's device name (short form) and the network it's attached to.
36 */
37 public class IPInterface implements Serializable {
38 private String name;
39 private Network net;
40
41 /**
42 * Construct a new interface with the given name, address, and subnet mask.
43 * @param name Interface name
44 * @param addr The address
45 * @param mask The subnet mask
46 */
47 public IPInterface(String name, IPAddress addr, IPAddress mask) {
48 this.name = name;
49 net = new Network(addr, mask);
50 }
51
52 /**
53 * Construct a new interface with the given name, address, and subnet mask.
54 * @param name The interface name
55 * @param addr The IP address as a dotted-decimal <code>String</code>
56 * @param mask The subnet mask as a dotted-decimal <code>String</code>
57 */
58 public IPInterface(String name, String addr, String mask)
59 throws ValidationException {
60 this.name = name;
61 net = new Network(addr, mask);
62 }
63
64 /**
65 * @return Interface's device name
66 */
67 public String getName() {
68 return name;
69 }
70
71 /**
72 * Set the interface's device name
73 * @param name Name of interface
74 */
75 public void setName(String name) {
76 this.name = name;
77 }
78
79 /**
80 * @return Network the device is attached to.
81 */
82 public Network getNetwork() {
83 return net;
84 }
85 }