Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c25c7f80
Commit
c25c7f80
authored
Jan 02, 2013
by
André Hentschel
Committed by
Alexandre Julliard
Jan 03, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netstat: Parse command line arguments.
parent
7357b65d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
10 deletions
+62
-10
netstat.c
programs/netstat/netstat.c
+50
-10
netstat.h
programs/netstat/netstat.h
+12
-0
No files found.
programs/netstat/netstat.c
View file @
c25c7f80
...
@@ -24,7 +24,15 @@
...
@@ -24,7 +24,15 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
netstat
);
WINE_DEFAULT_DEBUG_CHANNEL
(
netstat
);
static
const
WCHAR
ipW
[]
=
{
'I'
,
'P'
,
0
};
static
const
WCHAR
ipv6W
[]
=
{
'I'
,
'P'
,
'v'
,
'6'
,
0
};
static
const
WCHAR
icmpW
[]
=
{
'I'
,
'C'
,
'M'
,
'P'
,
0
};
static
const
WCHAR
icmpv6W
[]
=
{
'I'
,
'C'
,
'M'
,
'P'
,
'v'
,
'6'
,
0
};
static
const
WCHAR
tcpW
[]
=
{
'T'
,
'C'
,
'P'
,
0
};
static
const
WCHAR
tcpW
[]
=
{
'T'
,
'C'
,
'P'
,
0
};
static
const
WCHAR
tcpv6W
[]
=
{
'T'
,
'C'
,
'P'
,
'v'
,
'6'
,
0
};
static
const
WCHAR
udpW
[]
=
{
'U'
,
'D'
,
'P'
,
0
};
static
const
WCHAR
udpv6W
[]
=
{
'U'
,
'D'
,
'P'
,
'v'
,
'6'
,
0
};
static
const
WCHAR
fmtport
[]
=
{
'%'
,
'd'
,
0
};
static
const
WCHAR
fmtport
[]
=
{
'%'
,
'd'
,
0
};
static
const
WCHAR
fmtip
[]
=
{
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
fmtip
[]
=
{
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
'.'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
fmtn
[]
=
{
'\n'
,
0
};
static
const
WCHAR
fmtn
[]
=
{
'\n'
,
0
};
...
@@ -181,26 +189,58 @@ static void NETSTAT_tcp_table(void)
...
@@ -181,26 +189,58 @@ static void NETSTAT_tcp_table(void)
HeapFree
(
GetProcessHeap
(),
0
,
table
);
HeapFree
(
GetProcessHeap
(),
0
,
table
);
}
}
static
NETSTATPROTOCOLS
NETSTAT_get_protocol
(
WCHAR
name
[])
{
if
(
!
strcmpiW
(
name
,
ipW
))
return
PROT_IP
;
if
(
!
strcmpiW
(
name
,
ipv6W
))
return
PROT_IPV6
;
if
(
!
strcmpiW
(
name
,
icmpW
))
return
PROT_ICMP
;
if
(
!
strcmpiW
(
name
,
icmpv6W
))
return
PROT_ICMPV6
;
if
(
!
strcmpiW
(
name
,
tcpW
))
return
PROT_TCP
;
if
(
!
strcmpiW
(
name
,
tcpv6W
))
return
PROT_TCPV6
;
if
(
!
strcmpiW
(
name
,
udpW
))
return
PROT_UDP
;
if
(
!
strcmpiW
(
name
,
udpv6W
))
return
PROT_UDPV6
;
return
PROT_UNKNOWN
;
}
int
wmain
(
int
argc
,
WCHAR
*
argv
[])
int
wmain
(
int
argc
,
WCHAR
*
argv
[])
{
{
WSADATA
wsa_data
;
WSADATA
wsa_data
;
if
(
argc
>
1
)
{
int
i
;
WINE_FIXME
(
"stub:"
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
WINE_FIXME
(
" %s"
,
wine_dbgstr_w
(
argv
[
i
]));
WINE_FIXME
(
"
\n
"
);
}
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsa_data
))
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsa_data
))
{
{
WINE_ERR
(
"WSAStartup failed: %d
\n
"
,
WSAGetLastError
());
WINE_ERR
(
"WSAStartup failed: %d
\n
"
,
WSAGetLastError
());
return
1
;
return
1
;
}
}
NETSTAT_tcp_table
();
if
(
argc
==
1
)
{
/* No options */
NETSTAT_tcp_table
();
return
0
;
}
while
(
argv
[
1
]
&&
argv
[
1
][
0
]
==
'-'
)
{
switch
(
argv
[
1
][
1
])
{
case
'p'
:
argv
++
;
argc
--
;
if
(
argc
==
1
)
return
1
;
switch
(
NETSTAT_get_protocol
(
argv
[
1
]))
{
case
PROT_TCP
:
NETSTAT_tcp_table
();
break
;
default:
WINE_FIXME
(
"Protocol not yet implemented: %s
\n
"
,
debugstr_w
(
argv
[
1
]));
}
break
;
default:
WINE_FIXME
(
"Unknown option: %s
\n
"
,
debugstr_w
(
argv
[
1
]));
return
1
;
}
argv
++
;
argc
--
;
}
return
0
;
return
0
;
}
}
programs/netstat/netstat.h
View file @
c25c7f80
...
@@ -18,6 +18,18 @@
...
@@ -18,6 +18,18 @@
#include <windows.h>
#include <windows.h>
typedef
enum
_NETSTATPROTOCOLS
{
PROT_UNKNOWN
,
PROT_IP
,
PROT_IPV6
,
PROT_ICMP
,
PROT_ICMPV6
,
PROT_TCP
,
PROT_TCPV6
,
PROT_UDP
,
PROT_UDPV6
,
}
NETSTATPROTOCOLS
;
#define IDS_TCP_CLOSED 1
#define IDS_TCP_CLOSED 1
#define IDS_TCP_LISTENING 2
#define IDS_TCP_LISTENING 2
#define IDS_TCP_SYN_SENT 3
#define IDS_TCP_SYN_SENT 3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment