31 #define WIN32_NO_STATUS 109 _stprintf(cMacAddr,
_T(
"%02x-%02x-%02x-%02x-%02x-%02x"),
119 switch (pIpAddRow->
dwType)
150 struct in_addr inaddr, inaddr2;
152 TCHAR szIntIpAddr[20];
161 if (pIpNetTable ==
NULL)
164 ZeroMemory(pIpNetTable,
sizeof(*pIpNetTable));
168 _tprintf(
_T(
"failed to allocate memory for GetIpNetTable\n"));
190 if (pIpAddrTable ==
NULL)
193 ZeroMemory(pIpAddrTable,
sizeof(*pIpAddrTable));
197 _tprintf(
_T(
"GetIpAddrTable failed: %d\n"), iRet);
210 strcpy(szIntIpAddr, pszIpAddr);
217 _tprintf(
_T(
" Internet Address Physical Address Type\n"));
231 if (
strcmp(pszIpAddr, pszInetAddr) == 0)
242 if (pIpNetTable !=
NULL)
244 if (pIpAddrTable !=
NULL)
268 if (pszInetAddr !=
NULL)
272 _tprintf(
_T(
"ARP: bad IP address: %s\n"), pszInetAddr);
283 if (
strlen(pszEthAddr) != 17)
285 _tprintf(
_T(
"ARP: bad argument: %s\n"), pszEthAddr);
295 _tprintf(
_T(
"ARP: bad argument: %s\n"), pszEthAddr);
306 if (pIpNetTable ==
NULL)
309 ZeroMemory(pIpNetTable,
sizeof(*pIpNetTable));
313 _tprintf(
_T(
"failed to allocate memory for GetIpNetTable\n"));
321 if (pAddHost ==
NULL)
363 pAddHost->
dwAddr = dwIpAddr;
382 if (pIpNetTable !=
NULL)
384 if (pAddHost !=
NULL)
408 if (pszInetAddr !=
NULL)
411 if (
strncmp(pszInetAddr,
"*", 1) == 0)
415 _tprintf(
_T(
"ARP: bad IP address: %s\n"), pszInetAddr);
431 if (pIpNetTable ==
NULL)
434 ZeroMemory(pIpNetTable,
sizeof(*pIpNetTable));
438 _tprintf(
_T(
"failed to allocate memory for GetIpNetTable\n"));
445 if (pDelHost ==
NULL)
467 if (bFlushTable !=
FALSE)
483 pDelHost->
dwAddr = dwIpAddr;
497 if (pIpNetTable !=
NULL)
499 if (pDelHost !=
NULL)
511 _tprintf(
_T(
"\nDisplays and modifies the IP-to-Physical address translation tables used by\n" 512 "address resolution protocol (ARP).\n" 514 "ARP -s inet_addr eth_addr [if_addr]\n" 515 "ARP -d inet_addr [if_addr]\n" 516 "ARP -a [inet_addr] [-N if_addr]\n" 518 " -a Displays current ARP entries by interrogating the current\n" 519 " protocol data. If inet_addr is specified, the IP and Physical\n" 520 " addresses for only the specified computer are displayed. If\n" 521 " more than one network interface uses ARP, entries for each ARP\n" 522 " table are displayed.\n" 524 " inet_addr Specifies an internet address.\n" 525 " -N if_addr Displays the ARP entries for the network interface specified\n" 527 " -d Deletes the host specified by inet_addr. inet_addr may be\n" 528 " wildcarded with * to delete all hosts.\n" 529 " -s Adds the host and associates the Internet address inet_addr\n" 530 " with the Physical address eth_addr. The Physical address is\n" 531 " given as 6 hexadecimal bytes separated by hyphens. The entry\n" 533 " eth_addr Specifies a physical address.\n" 534 " if_addr If present, this specifies the Internet address of the\n" 535 " interface whose address translation table should be modified.\n" 536 " If not present, the first applicable interface will be used.\n" 538 " > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.\n" 539 " > arp -a .... Displays the arp table.\n\n"));
556 if (
argv[1][0] ==
'-')
576 case 'd':
if (
argc == 3)
586 case 's':
if (
argc == 4)
_In_ NDIS_ERROR_CODE ErrorCode
union in_addr::@1005 S_un
DWORD WINAPI FlushIpNetTable(DWORD dwIfIndex)
ACPI_SIZE strlen(const char *String)
INT PrintEntries(PMIB_IPNETROW pIpAddRow)
INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOrder)
DWORD WINAPI GetLastError(VOID)
struct _MIB_IPNETTABLE * PMIB_IPNETTABLE
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BYTE bPhysAddr[MAXLEN_PHYSADDR]
DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder)
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
INT main(int argc, char *argv[])
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define FORMAT_MESSAGE_FROM_SYSTEM
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
DWORD DoFormatMessage(VOID)
DWORD WINAPI SetIpNetEntry(PMIB_IPNETROW pArpEntry)
IN PVOID IN PVOID IN USHORT IN USHORT Size
struct _MIB_IPNETROW MIB_IPNETROW
#define FORMAT_MESSAGE_IGNORE_INSERTS
INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
char * strcpy(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
DWORD WINAPI DeleteIpNetEntry(PMIB_IPNETROW pArpEntry)
char * cleanup(char *str)
#define HeapFree(x, y, z)