6 added files
reactos/apps/utils/net/arp
diff -N .cvsignore
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ .cvsignore 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,17 @@
+*.sys
+*.exe
+*.dll
+*.cpl
+*.a
+*.o
+*.d
+*.coff
+*.dsp
+*.dsw
+*.aps
+*.ncb
+*.opt
+*.sym
+*.plg
+*.bak
+*.map
reactos/apps/utils/net/arp
diff -N arp.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ arp.c 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,99 @@
+/*
+ * arp - display ARP cache from the IP stack parameters.
+ *
+ * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
+ *
+ * Robert Dickenson <robd@reactos.org>, August 15, 2002.
+ */
+#include <stdio.h>
+#include <windows.h>
+#include <tchar.h>
+#include <time.h>
+
+#include <iptypes.h>
+#include <ipexport.h>
+#include <iphlpapi.h>
+#include <snmp.h>
+
+#include "trace.h"
+
+
+VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
+DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
+
+////////////////////////////////////////////////////////////////////////////////
+
+const char szUsage[] = { "\n" \
+ "Displays and modifies the IP Protocol to physical address translation tables\n" \
+ "used by address resolution protocol (ARP).\n" \
+ "\n" \
+ "ARP -s inet_addr eth_addr [if_addr]\n" \
+ "ARP -d inet_addr [if_addr]\n" \
+ "ARP -a [inet_addr] [-N if_addr]\n" \
+ "\n" \
+ " -a Displays the active ARP table by querying the current protocol\n" \
+ " data. If inet_addr is specified, the IP and physical addresses\n" \
+ " for the specified address are displayed. If more than one\n" \
+ " network interface is using ARP, each interfaces ARP table is\n" \
+ " displayed.\n" \
+ " -g Indentical to -a.\n" \
+ " inet_addr Specifies the IP address.\n" \
+ " -N if_addr Displays the ARP table for the specified interface only\n" \
+ " -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \
+ " wildcarded with * to delete all host entries in the ARP table.\n" \
+ " -s Adds the host and associates the IP address inet_addr with the\n" \
+ " physical address eth_addr. The physical address must be specified\n" \
+ " as 6 hexadecimal characters delimited by hyphens. The new entry\n" \
+ " will become permanent in the ARP table.\n" \
+ " eth_addr Specifies the interface physical address.\n" \
+ " if_addr If present, this specifies the IP address of the interface whose\n" \
+ " address translation table should be modified. If not present, the\n" \
+ " first applicable interface will be used.\n" \
+ "Example:\n" \
+ " > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \
+ " > arp -a .... ARP table display.\n" \
+ " > arp -d * .... Delete all ARP table entries.\n"
+};
+
+void usage(void)
+{
+// fprintf(stderr,"USAGE:\n");
+ fputs(szUsage, stderr);
+}
+
+int main(int argc, char *argv[])
+{
+ TCHAR szComputerName[50];
+ DWORD dwSize = 50;
+
+ int nBytes = 500;
+ BYTE* pCache;
+
+ if (argc > 1) {
+ usage();
+ return 1;
+ }
+
+ SnmpSvcInitUptime();
+
+ GetComputerName(szComputerName, &dwSize);
+ _tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName);
+
+ pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
+
+ Sleep(2500);
+
+ if (pCache != NULL) {
+
+ DWORD dwUptime = SnmpSvcGetUptime();
+
+ _tprintf(_T("SNMP uptime: %d\n"), dwUptime);
+
+ SnmpUtilMemFree(pCache);
+ } else {
+ _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
+ return 1;
+ }
+ return 0;
+}
+
reactos/apps/utils/net/arp
diff -N arp.rc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ arp.rc 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,6 @@
+/* $Id: arp.rc,v 1.1 2004/11/21 22:25:36 chorns Exp $ */
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0"
+#define REACTOS_STR_INTERNAL_NAME "arp\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0"
+#include <reactos/version.rc>
reactos/apps/utils/net/arp
diff -N makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ makefile 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,17 @@
+PATH_TO_TOP = ../../../..
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = arp
+
+TARGET_CFLAGS = -D__USE_W32API
+
+TARGET_SDKLIBS = user32.a snmpapi.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
reactos/apps/utils/net/arp
diff -N trace.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ trace.c 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,53 @@
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#include <stdio.h>
+#include <stdarg.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+#include "trace.h"
+
+
+#ifdef _DEBUG
+
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+
+void _DebugBreak(void)
+{
+ DebugBreak();
+}
+
+void Trace(TCHAR* lpszFormat, ...)
+{
+ va_list args;
+ int nBuf;
+ TCHAR szBuffer[512];
+
+ va_start(args, lpszFormat);
+ nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
+ OutputDebugString(szBuffer);
+ // was there an error? was the expanded string too long?
+ //ASSERT(nBuf >= 0);
+ va_end(args);
+}
+
+void Assert(void* assert, TCHAR* file, int line, void* msg)
+{
+ if (msg == NULL) {
+ printf("ASSERT -- %s occured on line %u of file %s.\n",
+ assert, line, file);
+ } else {
+ printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
+ assert, line, file, msg);
+ }
+}
+
+#else
+
+void Trace(TCHAR* lpszFormat, ...) { };
+void Assert(void* assert, TCHAR* file, int line, void* msg) { };
+
+#endif //_DEBUG
+/////////////////////////////////////////////////////////////////////////////
reactos/apps/utils/net/arp
diff -N trace.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ trace.h 21 Nov 2004 22:25:36 -0000 1.1
@@ -0,0 +1,61 @@
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#ifdef _DEBUG
+
+#ifdef _X86_
+#define BreakPoint() _asm { int 3h }
+#else
+#define BreakPoint() _DebugBreak()
+#endif
+
+#ifndef ASSERT
+#define ASSERT(exp) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, NULL); \
+ BreakPoint(); \
+ } \
+} \
+
+#define ASSERTMSG(exp, msg) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, msg); \
+ BreakPoint(); \
+ } \
+}
+#endif
+
+//=============================================================================
+// MACRO: TRACE()
+//=============================================================================
+
+#define TRACE Trace
+
+
+#else // _DEBUG
+
+//=============================================================================
+// Define away MACRO's ASSERT() and TRACE() in non debug builds
+//=============================================================================
+
+#ifndef ASSERT
+#define ASSERT(exp)
+#define ASSERTMSG(exp, msg)
+#endif
+
+#define TRACE 0 ? (void)0 : Trace
+
+#endif // !_DEBUG
+
+
+void Assert(void* assert, TCHAR* file, int line, void* msg);
+void Trace(TCHAR* lpszFormat, ...);
+
+
+#endif // __TRACE_H__
+/////////////////////////////////////////////////////////////////////////////
CVSspam 0.2.8