dos2unix
This commit is contained in:
parent
93afe26132
commit
2e3c302f4f
208
EXCEPTIONS
208
EXCEPTIONS
|
@ -1,104 +1,104 @@
|
||||||
Hyperic FLOSS License Exception
|
Hyperic FLOSS License Exception
|
||||||
|
|
||||||
The Hyperic Exception for Free/Libre and Open Source
|
The Hyperic Exception for Free/Libre and Open Source
|
||||||
Software-only Applications Using Hyperic SIGAR Libraries (the
|
Software-only Applications Using Hyperic SIGAR Libraries (the
|
||||||
"FLOSS Exception").
|
"FLOSS Exception").
|
||||||
|
|
||||||
Version 0.1, September 6, 2008
|
Version 0.1, September 6, 2008
|
||||||
|
|
||||||
Exception Intent
|
Exception Intent
|
||||||
|
|
||||||
We want specified Free/Libre and Open Source Software (``FLOSS'')
|
We want specified Free/Libre and Open Source Software (``FLOSS'')
|
||||||
applications to be able to use specified GPL-licensed Hyperic SIGAR
|
applications to be able to use specified GPL-licensed Hyperic SIGAR
|
||||||
libraries (the ``Program'') despite the fact that not all FLOSS
|
libraries (the ``Program'') despite the fact that not all FLOSS
|
||||||
licenses are compatible with version 2 of the GNU General Public
|
licenses are compatible with version 2 of the GNU General Public
|
||||||
License (the ``GPL'').
|
License (the ``GPL'').
|
||||||
|
|
||||||
Legal Terms and Conditions
|
Legal Terms and Conditions
|
||||||
|
|
||||||
As a special exception to the terms and conditions of version 2.0
|
As a special exception to the terms and conditions of version 2.0
|
||||||
of the GPL:
|
of the GPL:
|
||||||
|
|
||||||
1. You are free to distribute a Derivative Work that is formed
|
1. You are free to distribute a Derivative Work that is formed
|
||||||
entirely from the Program and one or more works (each, a
|
entirely from the Program and one or more works (each, a
|
||||||
"FLOSS Work") licensed under one or more of the licenses
|
"FLOSS Work") licensed under one or more of the licenses
|
||||||
listed below in section 1, as long as:
|
listed below in section 1, as long as:
|
||||||
a. You obey the GPL in all respects for the Program and the
|
a. You obey the GPL in all respects for the Program and the
|
||||||
Derivative Work, except for identifiable sections of the
|
Derivative Work, except for identifiable sections of the
|
||||||
Derivative Work which are not derived from the Program,
|
Derivative Work which are not derived from the Program,
|
||||||
and which can reasonably be considered independent and
|
and which can reasonably be considered independent and
|
||||||
separate works in themselves,
|
separate works in themselves,
|
||||||
b. all identifiable sections of the Derivative Work which
|
b. all identifiable sections of the Derivative Work which
|
||||||
are not derived from the Program, and which can
|
are not derived from the Program, and which can
|
||||||
reasonably be considered independent and separate works
|
reasonably be considered independent and separate works
|
||||||
in themselves,
|
in themselves,
|
||||||
i. are distributed subject to one of the FLOSS licenses
|
i. are distributed subject to one of the FLOSS licenses
|
||||||
listed below, and
|
listed below, and
|
||||||
ii. the object code or executable form of those sections
|
ii. the object code or executable form of those sections
|
||||||
are accompanied by the complete corresponding
|
are accompanied by the complete corresponding
|
||||||
machine-readable source code for those sections on
|
machine-readable source code for those sections on
|
||||||
the same medium and under the same FLOSS license as
|
the same medium and under the same FLOSS license as
|
||||||
the corresponding object code or executable forms of
|
the corresponding object code or executable forms of
|
||||||
those sections, and
|
those sections, and
|
||||||
c. any works which are aggregated with the Program or with a
|
c. any works which are aggregated with the Program or with a
|
||||||
Derivative Work on a volume of a storage or distribution
|
Derivative Work on a volume of a storage or distribution
|
||||||
medium in accordance with the GPL, can reasonably be
|
medium in accordance with the GPL, can reasonably be
|
||||||
considered independent and separate works in themselves
|
considered independent and separate works in themselves
|
||||||
which are not derivatives of either the Program, a
|
which are not derivatives of either the Program, a
|
||||||
Derivative Work or a FLOSS Work.
|
Derivative Work or a FLOSS Work.
|
||||||
If the above conditions are not met, then the Program may only
|
If the above conditions are not met, then the Program may only
|
||||||
be copied, modified, distributed or used under the terms and
|
be copied, modified, distributed or used under the terms and
|
||||||
conditions of the GPL or another valid licensing option from
|
conditions of the GPL or another valid licensing option from
|
||||||
Hyperic, Inc.
|
Hyperic, Inc.
|
||||||
|
|
||||||
2. FLOSS License List
|
2. FLOSS License List
|
||||||
|
|
||||||
License name Version(s)/Copyright Date
|
License name Version(s)/Copyright Date
|
||||||
Apache Software License 1.0/1.1/2.0
|
Apache Software License 1.0/1.1/2.0
|
||||||
Artistic license From Perl 5.8.0
|
Artistic license From Perl 5.8.0
|
||||||
BSD license "July 22 1999"
|
BSD license "July 22 1999"
|
||||||
Eclipse Public License 1.0
|
Eclipse Public License 1.0
|
||||||
Mozilla Public License (MPL) 1.0/1.1
|
Mozilla Public License (MPL) 1.0/1.1
|
||||||
Open Software License 2.0
|
Open Software License 2.0
|
||||||
PHP License 3.0
|
PHP License 3.0
|
||||||
Python Software Foundation License 2.1.1
|
Python Software Foundation License 2.1.1
|
||||||
|
|
||||||
Due to the many variants of some of the above licenses, we
|
Due to the many variants of some of the above licenses, we
|
||||||
require that any version follow the 2003 version of the Free
|
require that any version follow the 2003 version of the Free
|
||||||
Software Foundation's Free Software Definition
|
Software Foundation's Free Software Definition
|
||||||
(http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of
|
(http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of
|
||||||
the Open Source Definition by the Open Source Initiative
|
the Open Source Definition by the Open Source Initiative
|
||||||
(http://www.opensource.org/docs/definition.php).
|
(http://www.opensource.org/docs/definition.php).
|
||||||
|
|
||||||
3. Definitions
|
3. Definitions
|
||||||
|
|
||||||
a. Terms used, but not defined, herein shall have the
|
a. Terms used, but not defined, herein shall have the
|
||||||
meaning provided in the GPL.
|
meaning provided in the GPL.
|
||||||
b. Derivative Work means a derivative work under copyright
|
b. Derivative Work means a derivative work under copyright
|
||||||
law.
|
law.
|
||||||
|
|
||||||
4. Applicability: This FLOSS Exception applies to all Programs
|
4. Applicability: This FLOSS Exception applies to all Programs
|
||||||
that contain a notice placed by Hyperic, Inc. saying that the
|
that contain a notice placed by Hyperic, Inc. saying that the
|
||||||
Program may be distributed under the terms of this FLOSS
|
Program may be distributed under the terms of this FLOSS
|
||||||
Exception. If you create or distribute a work which is a
|
Exception. If you create or distribute a work which is a
|
||||||
Derivative Work of both the Program and any other work
|
Derivative Work of both the Program and any other work
|
||||||
licensed under the GPL, then this FLOSS Exception is not
|
licensed under the GPL, then this FLOSS Exception is not
|
||||||
available for that work; thus, you must remove the FLOSS
|
available for that work; thus, you must remove the FLOSS
|
||||||
Exception notice from that work and comply with the GPL in all
|
Exception notice from that work and comply with the GPL in all
|
||||||
respects, including by retaining all GPL notices. You may
|
respects, including by retaining all GPL notices. You may
|
||||||
choose to redistribute a copy of the Program exclusively under
|
choose to redistribute a copy of the Program exclusively under
|
||||||
the terms of the GPL by removing the FLOSS Exception notice
|
the terms of the GPL by removing the FLOSS Exception notice
|
||||||
from that copy of the Program, provided that the copy has
|
from that copy of the Program, provided that the copy has
|
||||||
never been modified by you or any third party.
|
never been modified by you or any third party.
|
||||||
|
|
||||||
Appendix A. Qualified Libraries and Packages
|
Appendix A. Qualified Libraries and Packages
|
||||||
|
|
||||||
The following is a non-exhaustive list of libraries and packages
|
The following is a non-exhaustive list of libraries and packages
|
||||||
which are covered by the FLOSS License Exception. Please note that
|
which are covered by the FLOSS License Exception. Please note that
|
||||||
this appendix is provided merely as an additional service to
|
this appendix is provided merely as an additional service to
|
||||||
specific FLOSS projects wishing to simplify licensing information
|
specific FLOSS projects wishing to simplify licensing information
|
||||||
for their users. Compliance with one of the licenses noted under
|
for their users. Compliance with one of the licenses noted under
|
||||||
the "FLOSS license list" section remains a prerequisite.
|
the "FLOSS license list" section remains a prerequisite.
|
||||||
|
|
||||||
Package Name Qualifying License and Version
|
Package Name Qualifying License and Version
|
||||||
Apache Portable Runtime (APR) Apache Software License 2.0
|
Apache Portable Runtime (APR) Apache Software License 2.0
|
||||||
|
|
|
@ -16,54 +16,54 @@
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.jni;
|
package org.hyperic.jni;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.taskdefs.Copy;
|
import org.apache.tools.ant.taskdefs.Copy;
|
||||||
|
|
||||||
public class CopyDependsTask extends Copy {
|
public class CopyDependsTask extends Copy {
|
||||||
|
|
||||||
private File depends;
|
private File depends;
|
||||||
|
|
||||||
protected void validateAttributes()
|
protected void validateAttributes()
|
||||||
throws BuildException {
|
throws BuildException {
|
||||||
|
|
||||||
super.validateAttributes();
|
super.validateAttributes();
|
||||||
if (this.depends == null) {
|
if (this.depends == null) {
|
||||||
throw new BuildException("missing depends attribute");
|
throw new BuildException("missing depends attribute");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws BuildException {
|
throws BuildException {
|
||||||
|
|
||||||
if (this.destFile.exists()) {
|
if (this.destFile.exists()) {
|
||||||
String state;
|
String state;
|
||||||
if (this.depends.lastModified() >
|
if (this.depends.lastModified() >
|
||||||
this.destFile.lastModified())
|
this.destFile.lastModified())
|
||||||
{
|
{
|
||||||
this.setOverwrite(true);
|
this.setOverwrite(true);
|
||||||
state = "out of date";
|
state = "out of date";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state = "up to date";
|
state = "up to date";
|
||||||
}
|
}
|
||||||
|
|
||||||
log(this.destFile +
|
log(this.destFile +
|
||||||
" " + state + " with " +
|
" " + state + " with " +
|
||||||
this.depends);
|
this.depends);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.execute();
|
super.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getDepends() {
|
public File getDepends() {
|
||||||
return this.depends;
|
return this.depends;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDepends(String depends) {
|
public void setDepends(String depends) {
|
||||||
this.depends = new File(depends);
|
this.depends = new File(depends);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* This file is part of SIGAR.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* SIGAR is free software; you can redistribute it and/or modify
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* it under the terms version 2 of the GNU General Public License as
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* published by the Free Software Foundation. This program is distributed
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|
||||||
import org.hyperic.sigar.win32.EventLog;
|
import org.hyperic.sigar.win32.EventLog;
|
||||||
import org.hyperic.sigar.win32.EventLogNotification;
|
import org.hyperic.sigar.win32.EventLogNotification;
|
||||||
import org.hyperic.sigar.win32.EventLogRecord;
|
import org.hyperic.sigar.win32.EventLogRecord;
|
||||||
import org.hyperic.sigar.win32.EventLogThread;
|
import org.hyperic.sigar.win32.EventLogThread;
|
||||||
import org.hyperic.sigar.win32.Win32Exception;
|
import org.hyperic.sigar.win32.Win32Exception;
|
||||||
|
|
||||||
public class EventLogTail {
|
public class EventLogTail {
|
||||||
|
|
||||||
private static void tail(String name, Tail tail) throws Win32Exception {
|
private static void tail(String name, Tail tail) throws Win32Exception {
|
||||||
EventLog log = new EventLog();
|
EventLog log = new EventLog();
|
||||||
log.open(name);
|
log.open(name);
|
||||||
int max = log.getNumberOfRecords();
|
int max = log.getNumberOfRecords();
|
||||||
if (tail.number < max) {
|
if (tail.number < max) {
|
||||||
max = tail.number;
|
max = tail.number;
|
||||||
}
|
}
|
||||||
int last = log.getNewestRecord()+1;
|
int last = log.getNewestRecord()+1;
|
||||||
int first = last - max;
|
int first = last - max;
|
||||||
|
|
||||||
for (int i=first; i<last; i++) {
|
for (int i=first; i<last; i++) {
|
||||||
EventLogRecord record = log.read(i);
|
EventLogRecord record = log.read(i);
|
||||||
System.out.println(record);
|
System.out.println(record);
|
||||||
}
|
}
|
||||||
log.close();
|
log.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TailNotification implements EventLogNotification {
|
private static class TailNotification implements EventLogNotification {
|
||||||
public void handleNotification(EventLogRecord event) {
|
public void handleNotification(EventLogRecord event) {
|
||||||
System.out.println(event);
|
System.out.println(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(EventLogRecord event) {
|
public boolean matches(EventLogRecord event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Tail tail = new Tail();
|
Tail tail = new Tail();
|
||||||
tail.parseArgs(args);
|
tail.parseArgs(args);
|
||||||
|
|
||||||
if (tail.files.size() == 0) {
|
if (tail.files.size() == 0) {
|
||||||
tail.files.add(EventLog.SYSTEM);
|
tail.files.add(EventLog.SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<tail.files.size(); i++) {
|
for (int i=0; i<tail.files.size(); i++) {
|
||||||
String name = (String)tail.files.get(i);
|
String name = (String)tail.files.get(i);
|
||||||
tail(name, tail);
|
tail(name, tail);
|
||||||
|
|
||||||
if (tail.follow) {
|
if (tail.follow) {
|
||||||
TailNotification notifier = new TailNotification();
|
TailNotification notifier = new TailNotification();
|
||||||
EventLogThread thread =
|
EventLogThread thread =
|
||||||
EventLogThread.getInstance(name);
|
EventLogThread.getInstance(name);
|
||||||
thread.add(notifier);
|
thread.add(notifier);
|
||||||
thread.doStart();
|
thread.doStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tail.follow) {
|
if (tail.follow) {
|
||||||
System.in.read();
|
System.in.read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,100 +1,100 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* This file is part of SIGAR.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* SIGAR is free software; you can redistribute it and/or modify
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* it under the terms version 2 of the GNU General Public License as
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* published by the Free Software Foundation. This program is distributed
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.hyperic.sigar.SigarException;
|
import org.hyperic.sigar.SigarException;
|
||||||
import org.hyperic.sigar.ProcExe;
|
import org.hyperic.sigar.ProcExe;
|
||||||
import org.hyperic.sigar.win32.Win32;
|
import org.hyperic.sigar.win32.Win32;
|
||||||
import org.hyperic.sigar.win32.FileVersion;
|
import org.hyperic.sigar.win32.FileVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display process file information.
|
* Display process file information.
|
||||||
*/
|
*/
|
||||||
public class FileVersionInfo extends SigarCommandBase {
|
public class FileVersionInfo extends SigarCommandBase {
|
||||||
|
|
||||||
public FileVersionInfo(Shell shell) {
|
public FileVersionInfo(Shell shell) {
|
||||||
super(shell);
|
super(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileVersionInfo() {
|
public FileVersionInfo() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean validateArgs(String[] args) {
|
protected boolean validateArgs(String[] args) {
|
||||||
return args.length >= 1;
|
return args.length >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsageShort() {
|
public String getUsageShort() {
|
||||||
return "Display file version info";
|
return "Display file version info";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void output(String[] args) throws SigarException {
|
public void output(String[] args) throws SigarException {
|
||||||
for (int i=0; i<args.length; i++) {
|
for (int i=0; i<args.length; i++) {
|
||||||
String exe = args[i];
|
String exe = args[i];
|
||||||
if (new File(exe).exists()) {
|
if (new File(exe).exists()) {
|
||||||
output(exe);
|
output(exe);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
long[] pids = this.shell.findPids(exe);
|
long[] pids = this.shell.findPids(exe);
|
||||||
for (int j=0; j<pids.length; j++) {
|
for (int j=0; j<pids.length; j++) {
|
||||||
try {
|
try {
|
||||||
output(sigar.getProcExe(pids[j]).getName());
|
output(sigar.getProcExe(pids[j]).getName());
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
println(exe + ": " + e.getMessage());
|
println(exe + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void output(String key, String val) {
|
private void output(String key, String val) {
|
||||||
final int max = 20;
|
final int max = 20;
|
||||||
int len = max - key.length();
|
int len = max - key.length();
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(" ").append(key);
|
sb.append(" ").append(key);
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
sb.append('.');
|
sb.append('.');
|
||||||
}
|
}
|
||||||
sb.append(val);
|
sb.append(val);
|
||||||
println(sb.toString());
|
println(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void output(String exe) throws SigarException {
|
public void output(String exe) throws SigarException {
|
||||||
FileVersion info = Win32.getFileVersion(exe);
|
FileVersion info = Win32.getFileVersion(exe);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
println("Version info for file '" + exe + "':");
|
println("Version info for file '" + exe + "':");
|
||||||
output("FileVersion", info.getFileVersion());
|
output("FileVersion", info.getFileVersion());
|
||||||
output("ProductVersion", info.getProductVersion());
|
output("ProductVersion", info.getProductVersion());
|
||||||
for (Iterator it = info.getInfo().entrySet().iterator();
|
for (Iterator it = info.getInfo().entrySet().iterator();
|
||||||
it.hasNext();)
|
it.hasNext();)
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Map.Entry)it.next();
|
Map.Entry entry = (Map.Entry)it.next();
|
||||||
output((String)entry.getKey(), (String)entry.getValue());
|
output((String)entry.getKey(), (String)entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
new FileVersionInfo().processCommand(args);
|
new FileVersionInfo().processCommand(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* This file is part of SIGAR.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* SIGAR is free software; you can redistribute it and/or modify
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* it under the terms version 2 of the GNU General Public License as
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* published by the Free Software Foundation. This program is distributed
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.test;
|
package org.hyperic.sigar.test;
|
||||||
|
|
||||||
import org.hyperic.sigar.Sigar;
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.hyperic.sigar.SigarNotImplementedException;
|
import org.hyperic.sigar.SigarNotImplementedException;
|
||||||
|
|
||||||
public class TestSignal extends SigarTestCase {
|
public class TestSignal extends SigarTestCase {
|
||||||
|
|
||||||
public TestSignal(String name) {
|
public TestSignal(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
String[] signals = {
|
String[] signals = {
|
||||||
"HUP", "INT", "KILL", "QUIT",
|
"HUP", "INT", "KILL", "QUIT",
|
||||||
"TERM", "USR1", "USR2"
|
"TERM", "USR1", "USR2"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i=0; i<signals.length; i++) {
|
for (int i=0; i<signals.length; i++) {
|
||||||
String sig = signals[i];
|
String sig = signals[i];
|
||||||
traceln(sig + "=" + Sigar.getSigNum(sig));
|
traceln(sig + "=" + Sigar.getSigNum(sig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* This file is part of SIGAR.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* SIGAR is free software; you can redistribute it and/or modify
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* it under the terms version 2 of the GNU General Public License as
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* published by the Free Software Foundation. This program is distributed
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.win32.test;
|
package org.hyperic.sigar.win32.test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.hyperic.sigar.test.SigarTestCase;
|
import org.hyperic.sigar.test.SigarTestCase;
|
||||||
|
|
||||||
import org.hyperic.sigar.Sigar;
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.hyperic.sigar.SigarException;
|
import org.hyperic.sigar.SigarException;
|
||||||
import org.hyperic.sigar.ProcExe;
|
import org.hyperic.sigar.ProcExe;
|
||||||
import org.hyperic.sigar.win32.Win32;
|
import org.hyperic.sigar.win32.Win32;
|
||||||
import org.hyperic.sigar.win32.FileVersion;
|
import org.hyperic.sigar.win32.FileVersion;
|
||||||
|
|
||||||
public class TestFileVersion extends SigarTestCase {
|
public class TestFileVersion extends SigarTestCase {
|
||||||
|
|
||||||
public TestFileVersion(String name) {
|
public TestFileVersion(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printExe(long pid) {
|
private void printExe(long pid) {
|
||||||
traceln("\npid=" + pid);
|
traceln("\npid=" + pid);
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
try {
|
try {
|
||||||
name = getSigar().getProcExe(pid).getName();
|
name = getSigar().getProcExe(pid).getName();
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileVersion info = Win32.getFileVersion(name);
|
FileVersion info = Win32.getFileVersion(name);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
traceln("exe='" + name + "'");
|
traceln("exe='" + name + "'");
|
||||||
traceln("version=" + info.getProductVersion());
|
traceln("version=" + info.getProductVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
assertTrue(Win32.getFileVersion("DoEsNoTeXist.exe") == null);
|
assertTrue(Win32.getFileVersion("DoEsNoTeXist.exe") == null);
|
||||||
|
|
||||||
long[] pids = getSigar().getProcList();
|
long[] pids = getSigar().getProcList();
|
||||||
|
|
||||||
//go through all just to make sure no crashes
|
//go through all just to make sure no crashes
|
||||||
for (int i=0; i<pids.length; i++) {
|
for (int i=0; i<pids.length; i++) {
|
||||||
printExe(pids[i]);
|
printExe(pids[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,327 +1,327 @@
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
iptypes.h
|
iptypes.h
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#ifndef IP_TYPES_INCLUDED
|
#ifndef IP_TYPES_INCLUDED
|
||||||
#define IP_TYPES_INCLUDED
|
#define IP_TYPES_INCLUDED
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4201)
|
#pragma warning(disable:4201)
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
// Definitions and structures used by getnetworkparams and getadaptersinfo apis
|
// Definitions and structures used by getnetworkparams and getadaptersinfo apis
|
||||||
|
|
||||||
#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
|
#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
|
||||||
#define MAX_ADAPTER_NAME_LENGTH 256 // arb.
|
#define MAX_ADAPTER_NAME_LENGTH 256 // arb.
|
||||||
#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
|
#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
|
||||||
#define DEFAULT_MINIMUM_ENTITIES 32 // arb.
|
#define DEFAULT_MINIMUM_ENTITIES 32 // arb.
|
||||||
#define MAX_HOSTNAME_LEN 128 // arb.
|
#define MAX_HOSTNAME_LEN 128 // arb.
|
||||||
#define MAX_DOMAIN_NAME_LEN 128 // arb.
|
#define MAX_DOMAIN_NAME_LEN 128 // arb.
|
||||||
#define MAX_SCOPE_ID_LEN 256 // arb.
|
#define MAX_SCOPE_ID_LEN 256 // arb.
|
||||||
|
|
||||||
//
|
//
|
||||||
// types
|
// types
|
||||||
//
|
//
|
||||||
|
|
||||||
// Node Type
|
// Node Type
|
||||||
|
|
||||||
#define BROADCAST_NODETYPE 1
|
#define BROADCAST_NODETYPE 1
|
||||||
#define PEER_TO_PEER_NODETYPE 2
|
#define PEER_TO_PEER_NODETYPE 2
|
||||||
#define MIXED_NODETYPE 4
|
#define MIXED_NODETYPE 4
|
||||||
#define HYBRID_NODETYPE 8
|
#define HYBRID_NODETYPE 8
|
||||||
|
|
||||||
//
|
//
|
||||||
// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
|
// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char String[4 * 4];
|
char String[4 * 4];
|
||||||
} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
|
} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
|
||||||
|
|
||||||
//
|
//
|
||||||
// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
|
// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
|
||||||
// both as dotted decimal strings
|
// both as dotted decimal strings
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct _IP_ADDR_STRING {
|
typedef struct _IP_ADDR_STRING {
|
||||||
struct _IP_ADDR_STRING* Next;
|
struct _IP_ADDR_STRING* Next;
|
||||||
IP_ADDRESS_STRING IpAddress;
|
IP_ADDRESS_STRING IpAddress;
|
||||||
IP_MASK_STRING IpMask;
|
IP_MASK_STRING IpMask;
|
||||||
DWORD Context;
|
DWORD Context;
|
||||||
} IP_ADDR_STRING, *PIP_ADDR_STRING;
|
} IP_ADDR_STRING, *PIP_ADDR_STRING;
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
|
// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
|
||||||
// strings
|
// strings
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_INFO {
|
typedef struct _IP_ADAPTER_INFO {
|
||||||
struct _IP_ADAPTER_INFO* Next;
|
struct _IP_ADAPTER_INFO* Next;
|
||||||
DWORD ComboIndex;
|
DWORD ComboIndex;
|
||||||
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
|
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
|
||||||
char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
|
char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
|
||||||
UINT AddressLength;
|
UINT AddressLength;
|
||||||
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
|
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
|
||||||
DWORD Index;
|
DWORD Index;
|
||||||
UINT Type;
|
UINT Type;
|
||||||
UINT DhcpEnabled;
|
UINT DhcpEnabled;
|
||||||
PIP_ADDR_STRING CurrentIpAddress;
|
PIP_ADDR_STRING CurrentIpAddress;
|
||||||
IP_ADDR_STRING IpAddressList;
|
IP_ADDR_STRING IpAddressList;
|
||||||
IP_ADDR_STRING GatewayList;
|
IP_ADDR_STRING GatewayList;
|
||||||
IP_ADDR_STRING DhcpServer;
|
IP_ADDR_STRING DhcpServer;
|
||||||
BOOL HaveWins;
|
BOOL HaveWins;
|
||||||
IP_ADDR_STRING PrimaryWinsServer;
|
IP_ADDR_STRING PrimaryWinsServer;
|
||||||
IP_ADDR_STRING SecondaryWinsServer;
|
IP_ADDR_STRING SecondaryWinsServer;
|
||||||
time_t LeaseObtained;
|
time_t LeaseObtained;
|
||||||
time_t LeaseExpires;
|
time_t LeaseExpires;
|
||||||
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
|
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
|
||||||
|
|
||||||
#ifdef _WINSOCK2API_
|
#ifdef _WINSOCK2API_
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following types require Winsock2.
|
// The following types require Winsock2.
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IpPrefixOriginOther = 0,
|
IpPrefixOriginOther = 0,
|
||||||
IpPrefixOriginManual,
|
IpPrefixOriginManual,
|
||||||
IpPrefixOriginWellKnown,
|
IpPrefixOriginWellKnown,
|
||||||
IpPrefixOriginDhcp,
|
IpPrefixOriginDhcp,
|
||||||
IpPrefixOriginRouterAdvertisement,
|
IpPrefixOriginRouterAdvertisement,
|
||||||
} IP_PREFIX_ORIGIN;
|
} IP_PREFIX_ORIGIN;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IpSuffixOriginOther = 0,
|
IpSuffixOriginOther = 0,
|
||||||
IpSuffixOriginManual,
|
IpSuffixOriginManual,
|
||||||
IpSuffixOriginWellKnown,
|
IpSuffixOriginWellKnown,
|
||||||
IpSuffixOriginDhcp,
|
IpSuffixOriginDhcp,
|
||||||
IpSuffixOriginLinkLayerAddress,
|
IpSuffixOriginLinkLayerAddress,
|
||||||
IpSuffixOriginRandom,
|
IpSuffixOriginRandom,
|
||||||
} IP_SUFFIX_ORIGIN;
|
} IP_SUFFIX_ORIGIN;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IpDadStateInvalid = 0,
|
IpDadStateInvalid = 0,
|
||||||
IpDadStateTentative,
|
IpDadStateTentative,
|
||||||
IpDadStateDuplicate,
|
IpDadStateDuplicate,
|
||||||
IpDadStateDeprecated,
|
IpDadStateDeprecated,
|
||||||
IpDadStatePreferred,
|
IpDadStatePreferred,
|
||||||
} IP_DAD_STATE;
|
} IP_DAD_STATE;
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
|
typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD Flags;
|
DWORD Flags;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
|
struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
|
||||||
SOCKET_ADDRESS Address;
|
SOCKET_ADDRESS Address;
|
||||||
|
|
||||||
IP_PREFIX_ORIGIN PrefixOrigin;
|
IP_PREFIX_ORIGIN PrefixOrigin;
|
||||||
IP_SUFFIX_ORIGIN SuffixOrigin;
|
IP_SUFFIX_ORIGIN SuffixOrigin;
|
||||||
IP_DAD_STATE DadState;
|
IP_DAD_STATE DadState;
|
||||||
|
|
||||||
ULONG ValidLifetime;
|
ULONG ValidLifetime;
|
||||||
ULONG PreferredLifetime;
|
ULONG PreferredLifetime;
|
||||||
ULONG LeaseLifetime;
|
ULONG LeaseLifetime;
|
||||||
} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
|
} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
|
typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD Flags;
|
DWORD Flags;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
|
struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
|
||||||
SOCKET_ADDRESS Address;
|
SOCKET_ADDRESS Address;
|
||||||
} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
|
} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
|
typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD Flags;
|
DWORD Flags;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
|
struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
|
||||||
SOCKET_ADDRESS Address;
|
SOCKET_ADDRESS Address;
|
||||||
} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
|
} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Per-address Flags
|
// Per-address Flags
|
||||||
//
|
//
|
||||||
#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01
|
#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01
|
||||||
#define IP_ADAPTER_ADDRESS_TRANSIENT 0x02
|
#define IP_ADAPTER_ADDRESS_TRANSIENT 0x02
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
|
typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD Reserved;
|
DWORD Reserved;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
|
struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
|
||||||
SOCKET_ADDRESS Address;
|
SOCKET_ADDRESS Address;
|
||||||
} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
|
} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_PREFIX {
|
typedef struct _IP_ADAPTER_PREFIX {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD Flags;
|
DWORD Flags;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_PREFIX *Next;
|
struct _IP_ADAPTER_PREFIX *Next;
|
||||||
SOCKET_ADDRESS Address;
|
SOCKET_ADDRESS Address;
|
||||||
ULONG PrefixLength;
|
ULONG PrefixLength;
|
||||||
} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
|
} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Per-adapter Flags
|
// Per-adapter Flags
|
||||||
//
|
//
|
||||||
#define IP_ADAPTER_DDNS_ENABLED 0x01
|
#define IP_ADAPTER_DDNS_ENABLED 0x01
|
||||||
#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x02
|
#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x02
|
||||||
#define IP_ADAPTER_DHCP_ENABLED 0x04
|
#define IP_ADAPTER_DHCP_ENABLED 0x04
|
||||||
#define IP_ADAPTER_RECEIVE_ONLY 0x08
|
#define IP_ADAPTER_RECEIVE_ONLY 0x08
|
||||||
#define IP_ADAPTER_NO_MULTICAST 0x10
|
#define IP_ADAPTER_NO_MULTICAST 0x10
|
||||||
#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
|
#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
|
||||||
|
|
||||||
//
|
//
|
||||||
// OperStatus values from RFC 2863
|
// OperStatus values from RFC 2863
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IfOperStatusUp = 1,
|
IfOperStatusUp = 1,
|
||||||
IfOperStatusDown,
|
IfOperStatusDown,
|
||||||
IfOperStatusTesting,
|
IfOperStatusTesting,
|
||||||
IfOperStatusUnknown,
|
IfOperStatusUnknown,
|
||||||
IfOperStatusDormant,
|
IfOperStatusDormant,
|
||||||
IfOperStatusNotPresent,
|
IfOperStatusNotPresent,
|
||||||
IfOperStatusLowerLayerDown
|
IfOperStatusLowerLayerDown
|
||||||
} IF_OPER_STATUS;
|
} IF_OPER_STATUS;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Scope levels from RFC 2373 used with ZoneIndices array.
|
// Scope levels from RFC 2373 used with ZoneIndices array.
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ScopeLevelInterface = 1,
|
ScopeLevelInterface = 1,
|
||||||
ScopeLevelLink = 2,
|
ScopeLevelLink = 2,
|
||||||
ScopeLevelSubnet = 3,
|
ScopeLevelSubnet = 3,
|
||||||
ScopeLevelAdmin = 4,
|
ScopeLevelAdmin = 4,
|
||||||
ScopeLevelSite = 5,
|
ScopeLevelSite = 5,
|
||||||
ScopeLevelOrganization = 8,
|
ScopeLevelOrganization = 8,
|
||||||
ScopeLevelGlobal = 14
|
ScopeLevelGlobal = 14
|
||||||
} SCOPE_LEVEL;
|
} SCOPE_LEVEL;
|
||||||
|
|
||||||
typedef struct _IP_ADAPTER_ADDRESSES {
|
typedef struct _IP_ADAPTER_ADDRESSES {
|
||||||
union {
|
union {
|
||||||
ULONGLONG Alignment;
|
ULONGLONG Alignment;
|
||||||
struct {
|
struct {
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
DWORD IfIndex;
|
DWORD IfIndex;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct _IP_ADAPTER_ADDRESSES *Next;
|
struct _IP_ADAPTER_ADDRESSES *Next;
|
||||||
PCHAR AdapterName;
|
PCHAR AdapterName;
|
||||||
PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
|
PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
|
||||||
PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
|
PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
|
||||||
PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
|
PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
|
||||||
PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
|
PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
|
||||||
PWCHAR DnsSuffix;
|
PWCHAR DnsSuffix;
|
||||||
PWCHAR Description;
|
PWCHAR Description;
|
||||||
PWCHAR FriendlyName;
|
PWCHAR FriendlyName;
|
||||||
BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
|
BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
|
||||||
DWORD PhysicalAddressLength;
|
DWORD PhysicalAddressLength;
|
||||||
DWORD Flags;
|
DWORD Flags;
|
||||||
DWORD Mtu;
|
DWORD Mtu;
|
||||||
DWORD IfType;
|
DWORD IfType;
|
||||||
IF_OPER_STATUS OperStatus;
|
IF_OPER_STATUS OperStatus;
|
||||||
DWORD Ipv6IfIndex;
|
DWORD Ipv6IfIndex;
|
||||||
DWORD ZoneIndices[16];
|
DWORD ZoneIndices[16];
|
||||||
PIP_ADAPTER_PREFIX FirstPrefix;
|
PIP_ADAPTER_PREFIX FirstPrefix;
|
||||||
} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
|
} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flags used as argument to GetAdaptersAddresses().
|
// Flags used as argument to GetAdaptersAddresses().
|
||||||
// "SKIP" flags are added when the default is to include the information.
|
// "SKIP" flags are added when the default is to include the information.
|
||||||
// "INCLUDE" flags are added when the default is to skip the information.
|
// "INCLUDE" flags are added when the default is to skip the information.
|
||||||
//
|
//
|
||||||
#define GAA_FLAG_SKIP_UNICAST 0x0001
|
#define GAA_FLAG_SKIP_UNICAST 0x0001
|
||||||
#define GAA_FLAG_SKIP_ANYCAST 0x0002
|
#define GAA_FLAG_SKIP_ANYCAST 0x0002
|
||||||
#define GAA_FLAG_SKIP_MULTICAST 0x0004
|
#define GAA_FLAG_SKIP_MULTICAST 0x0004
|
||||||
#define GAA_FLAG_SKIP_DNS_SERVER 0x0008
|
#define GAA_FLAG_SKIP_DNS_SERVER 0x0008
|
||||||
#define GAA_FLAG_INCLUDE_PREFIX 0x0010
|
#define GAA_FLAG_INCLUDE_PREFIX 0x0010
|
||||||
#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
|
#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
|
||||||
|
|
||||||
#endif /* _WINSOCK2API_ */
|
#endif /* _WINSOCK2API_ */
|
||||||
|
|
||||||
//
|
//
|
||||||
// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
|
// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct _IP_PER_ADAPTER_INFO {
|
typedef struct _IP_PER_ADAPTER_INFO {
|
||||||
UINT AutoconfigEnabled;
|
UINT AutoconfigEnabled;
|
||||||
UINT AutoconfigActive;
|
UINT AutoconfigActive;
|
||||||
PIP_ADDR_STRING CurrentDnsServer;
|
PIP_ADDR_STRING CurrentDnsServer;
|
||||||
IP_ADDR_STRING DnsServerList;
|
IP_ADDR_STRING DnsServerList;
|
||||||
} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
|
} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIXED_INFO - the set of IP-related information which does not depend on DHCP
|
// FIXED_INFO - the set of IP-related information which does not depend on DHCP
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char HostName[MAX_HOSTNAME_LEN + 4] ;
|
char HostName[MAX_HOSTNAME_LEN + 4] ;
|
||||||
char DomainName[MAX_DOMAIN_NAME_LEN + 4];
|
char DomainName[MAX_DOMAIN_NAME_LEN + 4];
|
||||||
PIP_ADDR_STRING CurrentDnsServer;
|
PIP_ADDR_STRING CurrentDnsServer;
|
||||||
IP_ADDR_STRING DnsServerList;
|
IP_ADDR_STRING DnsServerList;
|
||||||
UINT NodeType;
|
UINT NodeType;
|
||||||
char ScopeId[MAX_SCOPE_ID_LEN + 4];
|
char ScopeId[MAX_SCOPE_ID_LEN + 4];
|
||||||
UINT EnableRouting;
|
UINT EnableRouting;
|
||||||
UINT EnableProxy;
|
UINT EnableProxy;
|
||||||
UINT EnableDns;
|
UINT EnableDns;
|
||||||
} FIXED_INFO, *PFIXED_INFO;
|
} FIXED_INFO, *PFIXED_INFO;
|
||||||
|
|
||||||
#ifndef IP_INTERFACE_NAME_INFO_DEFINED
|
#ifndef IP_INTERFACE_NAME_INFO_DEFINED
|
||||||
#define IP_INTERFACE_NAME_INFO_DEFINED
|
#define IP_INTERFACE_NAME_INFO_DEFINED
|
||||||
|
|
||||||
typedef struct ip_interface_name_info {
|
typedef struct ip_interface_name_info {
|
||||||
ULONG Index; // Interface Index
|
ULONG Index; // Interface Index
|
||||||
ULONG MediaType; // Interface Types - see ipifcons.h
|
ULONG MediaType; // Interface Types - see ipifcons.h
|
||||||
UCHAR ConnectionType;
|
UCHAR ConnectionType;
|
||||||
UCHAR AccessType;
|
UCHAR AccessType;
|
||||||
GUID DeviceGuid; // Device GUID is the guid of the device
|
GUID DeviceGuid; // Device GUID is the guid of the device
|
||||||
// that IP exposes
|
// that IP exposes
|
||||||
GUID InterfaceGuid; // Interface GUID, if not GUID_NULL is the
|
GUID InterfaceGuid; // Interface GUID, if not GUID_NULL is the
|
||||||
// GUID for the interface mapped to the device.
|
// GUID for the interface mapped to the device.
|
||||||
} IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
|
} IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue