[fpc-devel]ipv6 patch

Johannes Berg johannes at sipsolutions.com
Sun Nov 9 19:55:04 CET 2003


On Sun, 2003-11-09 at 19:46, Johannes Berg wrote:
> Here's a patch to add some IPv6 definitions, I stole them from RFC 2553
> :-)

Whoops, I messed with the wrong structure here trying to adapt for BSD,
this looks better:

Index: inc/socketsh.inc
===================================================================
RCS file: /FPC/CVS/fpc/rtl/inc/socketsh.inc,v
retrieving revision 1.9
diff -u -r1.9 socketsh.inc
--- inc/socketsh.inc	23 Mar 2003 17:47:15 -0000	1.9
+++ inc/socketsh.inc	9 Nov 2003 18:53:25 -0000
@@ -123,7 +123,33 @@
     port  :Word;
     addr  :Cardinal;
     pad   :array [1..8] of byte; { to get to the size of sockaddr... }
-    end;
+  end;
+
+  Tin6_addr = packed record
+  case byte of
+    0: (u6_addr8  : array[0..15] of byte);
+    1: (u6_addr16 : array[0..7] of Word);
+    2: (u6_addr32 : array[0..3] of Cardinal);
+    3: (s6_addr8  : array[0..15] of shortint);
+    4: (s6_addr   : array[0..15] of shortint);
+    5: (s6_addr16 : array[0..7] of smallint);
+    6: (s6_addr32 : array[0..3] of LongInt);
+  end;
+
+  TInetSockAddr6 = packed Record
+    {$ifdef BSD}  // as per RFC 2553
+      sin6_len   : byte;
+      sin6_family: byte;
+    {$ELSE}
+      sin6_family: word;
+    {$ENDIF}
+    sin6_port     : Word;
+    sin6_flowinfo : LongInt;
+    sin6_addr     : Tin6_addr;
+    sin6_scope_id : LongInt;
+  end;
+  sockaddr_in6 = TInetSockAddr6;
+  psockaddr_in6 = ^sockaddr_in6;
 
   TSockArray = Array[1..2] of Longint;
 

I still have to test this, so take with big grains of salt ;)

johannes
-- 
http://www.sipsolutions.de/
GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc
  Key-ID: 9AB78CA5 Johannes Berg <johannes at sipsolutions.de>
  Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20031109/e661a099/attachment.sig>


More information about the fpc-devel mailing list