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-2001 by Sun Microsystems, Inc.
  26  * All rights reserved.
  27  */
  28 
  29 package com.sun.dhcpmgr.bridge;
  30 
  31 import java.util.Hashtable;
  32 import com.sun.dhcpmgr.data.*;
  33 
  34 /**
  35  * Bridge supplies access to the native functions in libdhcp and the
  36  * dhcpmgr shared object which actually interact with the data stores
  37  * used by DHCP.
  38  */
  39 
  40 public class Bridge {
  41     public native DhcpDatastore getDataStore(String resource)
  42         throws BridgeException;
  43     public native DhcpDatastore [] getDataStores() throws BridgeException;
  44     public native Option [] getInittabOptions(byte context)
  45         throws BridgeException;
  46     public native Macro getMacro(String key, DhcpDatastore datastore)
  47         throws BridgeException;
  48     public native Option getOption(String key, DhcpDatastore datastore)
  49         throws BridgeException;
  50     public native void createDhcptabRecord(DhcptabRecord rec,
  51         DhcpDatastore datastore) throws BridgeException;
  52     public native void modifyDhcptabRecord(DhcptabRecord oldRecord,
  53         DhcptabRecord newRecord, DhcpDatastore datastore)
  54         throws BridgeException;
  55     public native void deleteDhcptabRecord(DhcptabRecord rec,
  56         DhcpDatastore datastore) throws BridgeException;
  57     public native void cvtDhcptab(DhcpDatastore datastore)
  58         throws BridgeException;
  59     public native Option createOption(String name, String value)
  60         throws BridgeException;
  61     public native Option [] getOptions(DhcpDatastore datastore)
  62         throws BridgeException;
  63     public native Macro [] getMacros(DhcpDatastore datastore)
  64         throws BridgeException;
  65     public native Network [] getNetworks(DhcpDatastore datastore)
  66         throws BridgeException;
  67     public native Network getNetwork(String network)
  68         throws BridgeException;
  69     public native void cvtNetwork(String table,
  70         DhcpDatastore datastore) throws BridgeException;
  71     public native DhcpClientRecord [] loadNetwork(String table,
  72         DhcpDatastore datastore) throws BridgeException;
  73     public native void createDhcpClientRecord(DhcpClientRecord rec,
  74         String table, DhcpDatastore datastore) throws BridgeException;
  75     public native void modifyDhcpClientRecord(DhcpClientRecord oldRecord,
  76         DhcpClientRecord newRecord, String table, DhcpDatastore datastore)
  77         throws BridgeException;
  78     public native void deleteDhcpClientRecord(DhcpClientRecord rec,
  79         String table, DhcpDatastore datastore) throws BridgeException;
  80     public native DhcpClientRecord getDhcpClientRecord(DhcpClientRecord rec,
  81         String table, DhcpDatastore datastore) throws BridgeException;
  82     public native DhcpdOptions readDefaults() throws BridgeException;
  83     public native void writeDefaults(DhcpdOptions defs)
  84         throws BridgeException;
  85     public native void removeDefaults() throws BridgeException;
  86     public native void startup() throws BridgeException;
  87     public native void shutdown() throws BridgeException;
  88     public native void reload() throws BridgeException;
  89     public native IPInterface [] getInterfaces() throws BridgeException;
  90     public native String [] getArguments(String line) throws BridgeException;
  91     public native String getStringOption(short code, String arg)
  92         throws BridgeException;
  93     public native IPAddress [] getIPOption(short code, String arg)
  94         throws BridgeException;
  95     public native long [] getNumberOption(short code, String arg)
  96         throws BridgeException;
  97     public native void createDhcptab(DhcpDatastore datastore)
  98         throws BridgeException;
  99     public native void deleteDhcptab(DhcpDatastore datastore)
 100         throws BridgeException;
 101     public native void createDhcpNetwork(String net, DhcpDatastore datastore)
 102         throws BridgeException;
 103     public native void deleteDhcpNetwork(String net, DhcpDatastore datastore)
 104         throws BridgeException;
 105     public native void makeLocation(DhcpDatastore datastore)
 106         throws BridgeException;
 107     public native boolean isServerRunning() throws BridgeException;
 108     public native boolean isVersionCurrent() throws BridgeException;
 109     static {
 110         
 111         System.load("/usr/sadm/admin/dhcpmgr/dhcpmgr.so.1");
 112     }
 113 }