Skip to content

Commit

Permalink
update Synapse to the last sources
Browse files Browse the repository at this point in the history
  • Loading branch information
DmBel committed Jun 30, 2023
1 parent fdeddba commit 7844828
Show file tree
Hide file tree
Showing 28 changed files with 1,011 additions and 361 deletions.
15 changes: 8 additions & 7 deletions asn1util.pas
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 002.001.000 |
| Project : Ararat Synapse | 002.001.001 |
|==============================================================================|
| Content: support for ASN.1 BER coding and decoding |
|==============================================================================|
| Copyright (c)1999-2014, Lukas Gebauer |
| Copyright (c)1999-2021, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
Expand Down Expand Up @@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c) 1999-2014 |
| Portions created by Lukas Gebauer are Copyright (c) 1999-2021 |
| Portions created by Hernan Sanchez are Copyright (c) 2000. |
| All Rights Reserved. |
|==============================================================================|
Expand Down Expand Up @@ -379,9 +379,9 @@ function ASNItem(var Start: Integer; const Buffer: AnsiString;
{==============================================================================}
function MibToId(Mib: String): AnsiString;
var
x: Integer;
x: int64;

function WalkInt(var s: String): Integer;
function WalkInt(var s: String): int64;
var
x: Integer;
t: AnsiString;
Expand All @@ -397,7 +397,7 @@ function MibToId(Mib: String): AnsiString;
t := Copy(s, 1, x - 1);
s := Copy(s, x + 1, Length(s) - x);
end;
Result := StrToIntDef(t, 0);
Result := StrToInt64Def(t, 0);
end;

begin
Expand All @@ -415,7 +415,8 @@ function MibToId(Mib: String): AnsiString;
{==============================================================================}
function IdToMib(const Id: AnsiString): String;
var
x, y, n: Integer;
x, y: int64;
n: Integer;
begin
Result := '';
n := 1;
Expand Down
34 changes: 14 additions & 20 deletions blcksock.pas
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 009.010.000 |
| Project : Ararat Synapse | 009.010.002 |
|==============================================================================|
| Content: Library base |
|==============================================================================|
| Copyright (c)1999-2017, Lukas Gebauer |
| Copyright (c)1999-2021, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
Expand Down Expand Up @@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)1999-2017. |
| Portions created by Lukas Gebauer are Copyright (c)1999-2021. |
| All Rights Reserved. |
|==============================================================================|
| Contributor(s): |
Expand Down Expand Up @@ -265,6 +265,7 @@ ESocketMinus2 = class (ESynapseError);
LT_TLSv1,
LT_TLSv1_1,
LT_TLSv1_2,
LT_TLSv1_3,
LT_SSHv2
);

Expand Down Expand Up @@ -2621,12 +2622,13 @@ procedure TBlockSocket.RecvStreamRaw(const Stream: TStream; Timeout: Integer);
procedure TBlockSocket.RecvStreamSize(const Stream: TStream; Timeout: Integer; Size: int64);
var
s: TSynaBytes;
n: integer;
n: int64;
{$IFDEF CIL}
buf: TMemory;
{$ENDIF}
begin
for n := 1 to (Size div FSendMaxChunk) do
n := Size div int64(FSendMaxChunk);
while n > 0 do
begin
{$IFDEF CIL}
SetLength(buf, FSendMaxChunk);
Expand All @@ -2640,8 +2642,9 @@ procedure TBlockSocket.RecvStreamSize(const Stream: TStream; Timeout: Integer; S
Exit;
WriteStrToStream(Stream, s);
{$ENDIF}
dec(n);
end;
n := Size mod FSendMaxChunk;
n := Size mod int64(FSendMaxChunk);
if n > 0 then
begin
{$IFDEF CIL}
Expand Down Expand Up @@ -3665,7 +3668,7 @@ function TSocksBlockSocket.SocksCode(IP: string; const Port: string): string;
end;
end;

function TSocksBlockSocket.SocksDecode(const Value: string): integer;
function TSocksBlockSocket.SocksDecode(const Value: string): integer;
var
Atyp: Byte;
y, n: integer;
Expand Down Expand Up @@ -3859,7 +3862,7 @@ function TUDPBlockSocket.RecvBufferFrom(Buffer: TMemory; Length: Integer): Integ
end;

{$IFNDEF CIL}
procedure TUDPBlockSocket.AddMulticast(const MCastIP:string);
procedure TUDPBlockSocket.AddMulticast(const MCastIP: string);
var
Multicast: TIP_mreq;
Multicast6: TIPv6_mreq;
Expand All @@ -3870,11 +3873,7 @@ procedure TUDPBlockSocket.AddMulticast(const MCastIP:string);
begin
ip6 := StrToIp6(MCastIP);
for n := 0 to 15 do
{$IFNDEF POSIX}
Multicast6.ipv6mr_multiaddr.u6_addr8[n] := Ip6[n];
{$ELSE}
Multicast6.ipv6mr_multiaddr.s6_addr[n] := Ip6[n];
{$ENDIF}
Multicast6.ipv6mr_multiaddr.{$IFDEF POSIX}s6_addr{$ELSE}u6_addr8{$ENDIF}[n] := Ip6[n];
Multicast6.ipv6mr_interface := 0;
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IPV6, IPV6_JOIN_GROUP,
Pointer(@Multicast6), SizeOf(Multicast6)));
Expand All @@ -3890,7 +3889,7 @@ procedure TUDPBlockSocket.AddMulticast(const MCastIP:string);
ExceptCheck;
end;

procedure TUDPBlockSocket.DropMulticast(const MCastIP:string);
procedure TUDPBlockSocket.DropMulticast(const MCastIP: string);
var
Multicast: TIP_mreq;
Multicast6: TIPv6_mreq;
Expand All @@ -3901,12 +3900,7 @@ procedure TUDPBlockSocket.DropMulticast(const MCastIP:string);
begin
ip6 := StrToIp6(MCastIP);
for n := 0 to 15 do
{$IFNDEF POSIX}
Multicast6.ipv6mr_multiaddr.u6_addr8[n] := Ip6[n];
{$ELSE}
Multicast6.ipv6mr_multiaddr.s6_addr[n] := Ip6[n];
{$ENDIF}

Multicast6.ipv6mr_multiaddr.{$IFDEF POSIX}s6_addr{$ELSE}u6_addr8{$ENDIF}[n] := Ip6[n];
Multicast6.ipv6mr_interface := 0;
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
Pointer(@Multicast6), SizeOf(Multicast6)));
Expand Down
Loading

0 comments on commit 7844828

Please sign in to comment.