[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net/Sockets IPv6MulticastOptio
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Net/Sockets IPv6MulticastOption.cs, NONE, 1.1 NetworkStream.cs, 1.8, 1.9 ProtocolType.cs, 1.2, 1.3 Socket.cs, 1.18, 1.19 SocketException.cs, 1.8, 1.9 SocketOptionLevel.cs, 1.2, 1.3 TcpClient.cs, 1.6, 1.7 TcpListener.cs, 1.3, 1.4 UdpClient.cs, 1.1, 1.2 |
Date: |
Thu, 04 Sep 2003 20:59:19 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets
In directory subversions:/tmp/cvs-serv25120/System/Net/Sockets
Modified Files:
NetworkStream.cs ProtocolType.cs Socket.cs SocketException.cs
SocketOptionLevel.cs TcpClient.cs TcpListener.cs UdpClient.cs
Added Files:
IPv6MulticastOption.cs
Log Message:
Signature-compatibility fixes for "System.Net.Sockets".
--- NEW FILE ---
/*
* IPv6MulticastOption.cs - Implementation of the
* "System.Net.Sockets.IPv6MulticastOption" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Net.Sockets
{
// Not ECMA-compatible, strictly-speaking, but necessary for IPv6 support.
public class IPv6MulticastOption
{
// Internal state.
private IPAddress group;
private long ifindex;
// Constructors.
public IPv6MulticastOption(IPAddress group, long ifindex)
{
if(group == null)
{
throw new
ArgumentNullException("group");
}
this.group = group;
InterfaceIndex = ifindex;
}
public IPv6MulticastOption(IPAddress group)
{
if(group == null)
{
throw new
ArgumentNullException("group");
}
this.group = group;
this.ifindex = 0;
}
// Get or set the multicast properties.
public IPAddress Group
{
get
{
return group;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
group = value;
}
}
public long InterfaceIndex
{
get
{
return ifindex;
}
set
{
if(value < 0 || value >
(long)(UInt32.MaxValue))
{
throw new
ArgumentOutOfRangeException
("value",
S._("ArgRange_InterfaceIndex"));
}
ifindex = value;
}
}
}; // class IPv6MulticastOption
}; // namespace System.Net.Sockets
Index: NetworkStream.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/NetworkStream.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** NetworkStream.cs 23 Apr 2003 06:28:49 -0000 1.8
--- NetworkStream.cs 5 Sep 2003 00:59:15 -0000 1.9
***************
*** 220,223 ****
--- 220,276 ----
}
+ #if !ECMA_COMPAT
+
+ // Get or set the readable state for this stream.
+ protected bool Readable
+ {
+ get
+ {
+ return ((access & FileAccess.Read) !=
0);
+ }
+ set
+ {
+ if(value)
+ {
+ access |= FileAccess.Read;
+ }
+ else
+ {
+ access &= ~(FileAccess.Read);
+ }
+ }
+ }
+
+ // Get or set the writable state for this stream.
+ protected bool Writeable
+ {
+ get
+ {
+ return ((access & FileAccess.Write) !=
0);
+ }
+ set
+ {
+ if(value)
+ {
+ access |= FileAccess.Write;
+ }
+ else
+ {
+ access &= ~(FileAccess.Write);
+ }
+ }
+ }
+
+ // Get the underlying socket.
+ protected Socket Socket
+ {
+ get
+ {
+ return socket;
+ }
+ }
+
+ #endif // !ECMA_COMPAT
+
// Determine if the underlying socket has data available.
public virtual bool DataAvailable
Index: ProtocolType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/ProtocolType.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ProtocolType.cs 2 Apr 2003 07:16:00 -0000 1.2
--- ProtocolType.cs 5 Sep 2003 00:59:15 -0000 1.3
***************
*** 35,38 ****
--- 35,39 ----
Udp = 17,
Idp = 22,
+ IPv6 = 41,
ND = 77,
Raw = 255,
Index: Socket.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/Socket.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** Socket.cs 3 Jul 2003 05:48:32 -0000 1.18
--- Socket.cs 5 Sep 2003 00:59:15 -0000 1.19
***************
*** 1635,1648 ****
}
! #if !ECMA_COMPAT
public static bool SupportsIPv6
{
get
{
! return
SocketMethods.AddressFamilySupported(
!
(int)AddressFamily.InterNetworkV6);
}
}
- #endif
// Get the address family for this socket.
--- 1635,1655 ----
}
! // Determine if IPv4 or IPv6 is supported.
! public static bool SupportsIPv4
! {
! get
! {
! return
SocketMethods.AddressFamilySupported
!
((int)AddressFamily.InterNetwork);
! }
! }
public static bool SupportsIPv6
{
get
{
! return
SocketMethods.AddressFamilySupported
!
((int)AddressFamily.InterNetworkV6);
}
}
// Get the address family for this socket.
Index: SocketException.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/SocketException.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** SocketException.cs 26 May 2003 04:41:20 -0000 1.8
--- SocketException.cs 5 Sep 2003 00:59:15 -0000 1.9
***************
*** 63,66 ****
--- 63,73 ----
errno = Errno.EREMOTEIO;
}
+ #if !ECMA_COMPAT
+ public SocketException(int errorCode)
+ : base(errorCode)
+ {
+ errno = Errno.EREMOTEIO;
+ }
+ #endif
// Internal constructors that are used to set correct error codes.
***************
*** 124,127 ****
--- 131,147 ----
}
}
+
+ #if !ECMA_COMPAT
+
+ // Get the error code.
+ public override int ErrorCode
+ {
+ get
+ {
+ return NativeErrorCode;
+ }
+ }
+
+ #endif
}; // class SocketException
Index: SocketOptionLevel.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/SocketOptionLevel.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SocketOptionLevel.cs 2 Apr 2003 07:16:00 -0000 1.2
--- SocketOptionLevel.cs 5 Sep 2003 00:59:15 -0000 1.3
***************
*** 28,31 ****
--- 28,32 ----
Tcp = 6,
Udp = 17,
+ IPv6 = 41,
Socket = 65535
Index: TcpClient.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/TcpClient.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** TcpClient.cs 3 Apr 2003 10:13:36 -0000 1.6
--- TcpClient.cs 5 Sep 2003 00:59:15 -0000 1.7
***************
*** 38,42 ****
public TcpClient()
{
! Initialize(null, null);
}
public TcpClient(IPEndPoint localEP)
--- 38,46 ----
public TcpClient()
{
! Initialize(null, null,
AddressFamily.InterNetwork);
! }
! public TcpClient(AddressFamily family)
! {
! Initialize(null, null, family);
}
public TcpClient(IPEndPoint localEP)
***************
*** 46,54 ****
throw new
ArgumentNullException("localEP");
}
! Initialize(localEP, null);
}
public TcpClient(String hostname, int port)
{
! Initialize(null, Lookup(hostname, port));
}
internal TcpClient(Socket client)
--- 50,59 ----
throw new
ArgumentNullException("localEP");
}
! Initialize(localEP, null,
localEP.AddressFamily);
}
public TcpClient(String hostname, int port)
{
! IPEndPoint remoteEP = Lookup(hostname, port);
! Initialize(null, remoteEP,
remoteEP.AddressFamily);
}
internal TcpClient(Socket client)
***************
*** 69,76 ****
// end-point. If anything fails, the object will be left in a
// clean state, with the socket handle closed.
! private void Initialize(IPEndPoint localEP, IPEndPoint remoteEP)
{
! client = new Socket(AddressFamily.InterNetwork,
!
SocketType.Stream, ProtocolType.Tcp);
stream = null;
active = false;
--- 74,82 ----
// end-point. If anything fails, the object will be left in a
// clean state, with the socket handle closed.
! private void Initialize(IPEndPoint localEP, IPEndPoint remoteEP,
! AddressFamily family)
{
! client = new Socket
! (family, SocketType.Stream,
ProtocolType.Tcp);
stream = null;
active = false;
Index: TcpListener.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/TcpListener.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** TcpListener.cs 26 Jul 2003 06:30:35 -0000 1.3
--- TcpListener.cs 5 Sep 2003 00:59:15 -0000 1.4
***************
*** 48,51 ****
--- 48,52 ----
// Nothing to do here.
}
+ [Obsolete("Use TcpListener(IPAddress localaddr, int port).")]
public TcpListener(int port)
: this(new IPEndPoint(IPAddress.Any, port))
Index: UdpClient.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Net/Sockets/UdpClient.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** UdpClient.cs 3 Apr 2003 10:13:36 -0000 1.1
--- UdpClient.cs 5 Sep 2003 00:59:15 -0000 1.2
***************
*** 36,40 ****
public UdpClient()
{
! Initialize(null, null);
}
public UdpClient(IPEndPoint localEP)
--- 36,44 ----
public UdpClient()
{
! Initialize(null, null,
AddressFamily.InterNetwork);
! }
! public UdpClient(AddressFamily family)
! {
! Initialize(null, null, family);
}
public UdpClient(IPEndPoint localEP)
***************
*** 44,48 ****
throw new
ArgumentNullException("localEP");
}
! Initialize(localEP, null);
}
public UdpClient(int port)
--- 48,52 ----
throw new
ArgumentNullException("localEP");
}
! Initialize(localEP, null,
localEP.AddressFamily);
}
public UdpClient(int port)
***************
*** 53,67 ****
("port", S._("ArgRange_Port"));
}
! Initialize(new IPEndPoint(IPAddress.Any, port),
null);
}
! public UdpClient(String hostname, int port)
{
! Initialize(null, TcpClient.Lookup(hostname,
port));
}
!
! // Destructor.
! ~UdpClient()
{
! Dispose(false);
}
--- 57,85 ----
("port", S._("ArgRange_Port"));
}
! Initialize(new IPEndPoint(IPAddress.Any, port),
! null,
AddressFamily.InterNetwork);
}
! public UdpClient(int port, AddressFamily family)
{
! if(port < IPEndPoint.MinPort || port >
IPEndPoint.MaxPort)
! {
! throw new ArgumentOutOfRangeException
! ("port", S._("ArgRange_Port"));
! }
! if(family == AddressFamily.InterNetworkV6)
! {
! Initialize(new
IPEndPoint(IPAddress.IPv6Any, port),
! null,
AddressFamily.InterNetworkV6);
! }
! else
! {
! Initialize(new
IPEndPoint(IPAddress.Any, port),
! null,
AddressFamily.InterNetwork);
! }
}
! public UdpClient(String hostname, int port)
{
! IPEndPoint remoteEP =
TcpClient.Lookup(hostname, port);
! Initialize(null, remoteEP,
remoteEP.AddressFamily);
}
***************
*** 70,77 ****
// end-point. If anything fails, the object will be left in a
// clean state, with the socket handle closed.
! private void Initialize(IPEndPoint localEP, IPEndPoint remoteEP)
{
! client = new Socket(AddressFamily.InterNetwork,
!
SocketType.Dgram, ProtocolType.Udp);
active = false;
try
--- 88,95 ----
// end-point. If anything fails, the object will be left in a
// clean state, with the socket handle closed.
! private void Initialize(IPEndPoint localEP, IPEndPoint remoteEP,
! AddressFamily family)
{
! client = new Socket(family, SocketType.Dgram,
ProtocolType.Udp);
active = false;
try
***************
*** 136,140 ****
// Dispose of this object.
! protected virtual void Dispose(bool disposing)
{
if(client != null)
--- 154,158 ----
// Dispose of this object.
! private void Dispose(bool disposing)
{
if(client != null)
***************
*** 163,166 ****
--- 181,196 ----
JoinMulticastGroup(multicastAddr);
}
+ public void JoinMulticastGroup(int ifindex, IPAddress multicastAddr)
+ {
+ if(client == null)
+ {
+ throw new ObjectDisposedException
+ (S._("Exception_Disposed"));
+ }
+ client.SetSocketOption(SocketOptionLevel.IPv6,
+
SocketOptionName.AddMembership,
+ new
IPv6MulticastOption
+
(multicastAddr, ifindex));
+ }
// Drop a multicast group.
***************
*** 175,178 ****
--- 205,220 ----
SocketOptionName.DropMembership,
new
MulticastOption(multicastAddr));
+ }
+ public void DropMulticastGroup(IPAddress multicastAddr, int ifindex)
+ {
+ if(client == null)
+ {
+ throw new ObjectDisposedException
+ (S._("Exception_Disposed"));
+ }
+ client.SetSocketOption(SocketOptionLevel.IPv6,
+
SocketOptionName.DropMembership,
+ new
IPv6MulticastOption
+
(multicastAddr, ifindex));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Net/Sockets IPv6MulticastOption.cs, NONE, 1.1 NetworkStream.cs, 1.8, 1.9 ProtocolType.cs, 1.2, 1.3 Socket.cs, 1.18, 1.19 SocketException.cs, 1.8, 1.9 SocketOptionLevel.cs, 1.2, 1.3 TcpClient.cs, 1.6, 1.7 TcpListener.cs, 1.3, 1.4 UdpClient.cs, 1.1, 1.2,
Rhys Weatherley <address@hidden> <=