Changes for Delphi 2009 compatibility.
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@95 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
e0b3eeb0c2
commit
c7c54cd9df
85
blcksock.pas
85
blcksock.pas
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 009.004.002 |
|
||||
| Project : Ararat Synapse | 009.005.000 |
|
||||
|==============================================================================|
|
||||
| Content: Library base |
|
||||
|==============================================================================|
|
||||
@ -174,10 +174,10 @@ type
|
||||
{:Procedural type for OnStatus event. Sender is calling TBlockSocket object,
|
||||
Reason is one of set Status events and value is optional data.}
|
||||
THookSocketStatus = procedure(Sender: TObject; Reason: THookSocketReason;
|
||||
const Value: string) of object;
|
||||
const Value: String) of object;
|
||||
|
||||
{:This procedural type is used for DataFilter hooks.}
|
||||
THookDataFilter = procedure(Sender: TObject; var Value: string) of object;
|
||||
THookDataFilter = procedure(Sender: TObject; var Value: AnsiString) of object;
|
||||
|
||||
{:This procedural type is used for hook OnCreateSocket. By this hook you can
|
||||
insert your code after initialisation of socket. (you can set special socket
|
||||
@ -267,7 +267,7 @@ type
|
||||
FLocalSin: TVarSin;
|
||||
FRemoteSin: TVarSin;
|
||||
FTag: integer;
|
||||
FBuffer: string;
|
||||
FBuffer: AnsiString;
|
||||
FRaiseExcept: Boolean;
|
||||
FNonBlockMode: Boolean;
|
||||
FMaxLineLength: Integer;
|
||||
@ -440,7 +440,7 @@ type
|
||||
|
||||
{:Similar to @link(RecvBufferEx), but readed data is stored in binary
|
||||
string, not in memory buffer.}
|
||||
function RecvBufferStr(Length: Integer; Timeout: Integer): AnsiString; virtual;
|
||||
function RecvBufferStr(Len: Integer; Timeout: Integer): AnsiString; virtual;
|
||||
|
||||
{:Note: This is high-level receive function. It using internal
|
||||
@link(LineBuffer) and you can combine this function freely with other
|
||||
@ -698,7 +698,7 @@ type
|
||||
{:Buffer used by all high-level receiving functions. This buffer is used for
|
||||
optimized reading of data from socket. In normal cases you not need access
|
||||
to this buffer directly!}
|
||||
property LineBuffer: string read FBuffer write FBuffer;
|
||||
property LineBuffer: AnsiString read FBuffer write FBuffer;
|
||||
|
||||
{:Size of Winsock receive buffer. If it is not supported by socket provider,
|
||||
it return as size one kilobyte.}
|
||||
@ -844,8 +844,8 @@ type
|
||||
FSocksRemotePort: string;
|
||||
FBypassFlag: Boolean;
|
||||
FSocksType: TSocksType;
|
||||
function SocksCode(IP, Port: string): string;
|
||||
function SocksDecode(Value: string): integer;
|
||||
function SocksCode(IP, Port: string): Ansistring;
|
||||
function SocksDecode(Value: Ansistring): integer;
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
@ -1154,13 +1154,13 @@ type
|
||||
FCiphers: string;
|
||||
FCertificateFile: string;
|
||||
FPrivateKeyFile: string;
|
||||
FCertificate: string;
|
||||
FPrivateKey: string;
|
||||
FPFX: string;
|
||||
FCertificate: Ansistring;
|
||||
FPrivateKey: Ansistring;
|
||||
FPFX: Ansistring;
|
||||
FPFXfile: string;
|
||||
FCertCA: string;
|
||||
FCertCA: Ansistring;
|
||||
FCertCAFile: string;
|
||||
FTrustCertificate: string;
|
||||
FTrustCertificate: Ansistring;
|
||||
FTrustCertificateFile: string;
|
||||
FVerifyCert: Boolean;
|
||||
FUsername: string;
|
||||
@ -1295,15 +1295,15 @@ type
|
||||
|
||||
{:Used for loading certificate from binary string. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
property Certificate: string read FCertificate write FCertificate;
|
||||
property Certificate: Ansistring read FCertificate write FCertificate;
|
||||
|
||||
{:Used for loading private key from binary string. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
property PrivateKey: string read FPrivateKey write FPrivateKey;
|
||||
property PrivateKey: Ansistring read FPrivateKey write FPrivateKey;
|
||||
|
||||
{:Used for loading PFX from binary string. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
property PFX: string read FPFX write FPFX;
|
||||
property PFX: Ansistring read FPFX write FPFX;
|
||||
|
||||
{:Used for loading PFX from disk file. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
@ -1315,11 +1315,11 @@ type
|
||||
|
||||
{:Used for loading trusted certificates from binary string. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
property TrustCertificate: string read FTrustCertificate write FTrustCertificate;
|
||||
property TrustCertificate: Ansistring read FTrustCertificate write FTrustCertificate;
|
||||
|
||||
{:Used for loading CA certificates from binary string. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
property CertCA: string read FCertCA write FCertCA;
|
||||
property CertCA: Ansistring read FCertCA write FCertCA;
|
||||
|
||||
{:Used for loading CA certificates from disk file. See to plugin documentation
|
||||
if this method is supported and how!}
|
||||
@ -1677,7 +1677,7 @@ begin
|
||||
f := FFamily;
|
||||
FLastError := synsock.SetVarSin(sin, ip, port, FamilyToAF(f),
|
||||
GetSocketprotocol, GetSocketType, FPreferIP4);
|
||||
DoStatus(HR_ResolvingEnd, IP + ':' + Port);
|
||||
DoStatus(HR_ResolvingEnd, GetSinIP(sin) + ':' + IntTostr(GetSinPort(sin)));
|
||||
end;
|
||||
|
||||
function TBlockSocket.GetSinIP(Sin: TVarSin): string;
|
||||
@ -1956,11 +1956,10 @@ procedure TBlockSocket.SendString(Data: AnsiString);
|
||||
var
|
||||
buf: TMemory;
|
||||
begin
|
||||
// SendBuffer(PChar(Data), Length(Data));
|
||||
{$IFDEF CIL}
|
||||
buf := BytesOf(Data);
|
||||
{$ELSE}
|
||||
buf := pchar(data);
|
||||
buf := Pointer(data);
|
||||
{$ENDIF}
|
||||
SendBuffer(buf, Length(Data));
|
||||
end;
|
||||
@ -2019,7 +2018,7 @@ begin
|
||||
end
|
||||
{$ELSE}
|
||||
Setlength(s, FSendMaxChunk);
|
||||
yr := Stream.read(Pchar(s)^, FSendMaxChunk);
|
||||
yr := Stream.read(Pointer(s)^, FSendMaxChunk);
|
||||
if yr > 0 then
|
||||
begin
|
||||
SetLength(s, yr);
|
||||
@ -2124,7 +2123,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBlockSocket.RecvBufferStr(Length: Integer; Timeout: Integer): AnsiString;
|
||||
function TBlockSocket.RecvBufferStr(Len: Integer; Timeout: Integer): AnsiString;
|
||||
var
|
||||
x: integer;
|
||||
{$IFDEF CIL}
|
||||
@ -2132,11 +2131,11 @@ var
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := '';
|
||||
if Length > 0 then
|
||||
if Len > 0 then
|
||||
begin
|
||||
{$IFDEF CIL}
|
||||
Setlength(Buf, Length);
|
||||
x := RecvBufferEx(buf, Length , Timeout);
|
||||
Setlength(Buf, Len);
|
||||
x := RecvBufferEx(buf, Len , Timeout);
|
||||
if FLastError = 0 then
|
||||
begin
|
||||
SetLength(Buf, x);
|
||||
@ -2145,8 +2144,8 @@ begin
|
||||
else
|
||||
Result := '';
|
||||
{$ELSE}
|
||||
Setlength(Result, Length);
|
||||
x := RecvBufferEx(PChar(Result), Length , Timeout);
|
||||
Setlength(Result, Len);
|
||||
x := RecvBufferEx(Pointer(Result), Len , Timeout);
|
||||
if FLastError = 0 then
|
||||
SetLength(Result, x)
|
||||
else
|
||||
@ -2378,7 +2377,7 @@ begin
|
||||
s := RecvBufferStr(FSendMaxChunk, Timeout);
|
||||
if FLastError <> 0 then
|
||||
Exit;
|
||||
Stream.Write(Pchar(s)^, FSendMaxChunk);
|
||||
WriteStrToStream(Stream, s);
|
||||
{$ENDIF}
|
||||
end;
|
||||
n := Size mod FSendMaxChunk;
|
||||
@ -2394,7 +2393,7 @@ begin
|
||||
s := RecvBufferStr(n, Timeout);
|
||||
if FLastError <> 0 then
|
||||
Exit;
|
||||
Stream.Write(Pchar(s)^, n);
|
||||
WriteStrToStream(Stream, s);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
@ -2929,7 +2928,7 @@ end;
|
||||
|
||||
procedure TBlockSocket.DoReadFilter(Buffer: TMemory; var Len: Integer);
|
||||
var
|
||||
s: string;
|
||||
s: AnsiString;
|
||||
begin
|
||||
if assigned(OnReadFilter) then
|
||||
if Len > 0 then
|
||||
@ -3252,7 +3251,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSocksBlockSocket.SocksCode(IP, Port: string): string;
|
||||
function TSocksBlockSocket.SocksCode(IP, Port: string): Ansistring;
|
||||
var
|
||||
ip6: TIp6Bytes;
|
||||
n: integer;
|
||||
@ -3294,7 +3293,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSocksBlockSocket.SocksDecode(Value: string): integer;
|
||||
function TSocksBlockSocket.SocksDecode(Value: Ansistring): integer;
|
||||
var
|
||||
Atyp: Byte;
|
||||
y, n: integer;
|
||||
@ -3435,7 +3434,7 @@ function TUDPBlockSocket.SendBufferTo(Buffer: TMemory; Length: Integer): Integer
|
||||
var
|
||||
SIp: string;
|
||||
SPort: integer;
|
||||
Buf: string;
|
||||
Buf: Ansistring;
|
||||
begin
|
||||
Result := 0;
|
||||
FUsingSocks := False;
|
||||
@ -3450,9 +3449,9 @@ begin
|
||||
SPort := GetRemoteSinPort;
|
||||
SetRemoteSin(FSocksRemoteIP, FSocksRemotePort);
|
||||
SetLength(Buf,Length);
|
||||
Move(Buffer^, PChar(Buf)^, Length);
|
||||
Move(Buffer^, Pointer(Buf)^, Length);
|
||||
Buf := #0 + #0 + #0 + SocksCode(Sip, IntToStr(SPort)) + Buf;
|
||||
Result := inherited SendBufferTo(PChar(Buf), System.Length(buf));
|
||||
Result := inherited SendBufferTo(Pointer(Buf), System.Length(buf));
|
||||
SetRemoteSin(Sip, IntToStr(SPort));
|
||||
{$ENDIF}
|
||||
end
|
||||
@ -3463,7 +3462,7 @@ end;
|
||||
|
||||
function TUDPBlockSocket.RecvBufferFrom(Buffer: TMemory; Length: Integer): Integer;
|
||||
var
|
||||
Buf: string;
|
||||
Buf: Ansistring;
|
||||
x: integer;
|
||||
begin
|
||||
Result := inherited RecvBufferFrom(Buffer, Length);
|
||||
@ -3471,11 +3470,11 @@ begin
|
||||
begin
|
||||
{$IFNDEF CIL}
|
||||
SetLength(Buf, Result);
|
||||
Move(Buffer^, PChar(Buf)^, Result);
|
||||
Move(Buffer^, Pointer(Buf)^, Result);
|
||||
x := SocksDecode(Buf);
|
||||
Result := Result - x + 1;
|
||||
Buf := Copy(Buf, x, Result);
|
||||
Move(PChar(Buf)^, Buffer^, Result);
|
||||
Move(Pointer(Buf)^, Buffer^, Result);
|
||||
SetRemoteSin(FSocksResponseIP, FSocksResponsePort);
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -3496,14 +3495,14 @@ begin
|
||||
Multicast6.ipv6mr_multiaddr.u6_addr8[n] := Ip6[n];
|
||||
Multicast6.ipv6mr_interface := 0;
|
||||
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IPV6, IPV6_JOIN_GROUP,
|
||||
pchar(@Multicast6), SizeOf(Multicast6)));
|
||||
PAnsiChar(@Multicast6), SizeOf(Multicast6)));
|
||||
end
|
||||
else
|
||||
begin
|
||||
Multicast.imr_multiaddr.S_addr := swapbytes(strtoip(MCastIP));
|
||||
Multicast.imr_interface.S_addr := INADDR_ANY;
|
||||
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
pchar(@Multicast), SizeOf(Multicast)));
|
||||
PAnsiChar(@Multicast), SizeOf(Multicast)));
|
||||
end;
|
||||
ExceptCheck;
|
||||
end;
|
||||
@ -3522,14 +3521,14 @@ begin
|
||||
Multicast6.ipv6mr_multiaddr.u6_addr8[n] := Ip6[n];
|
||||
Multicast6.ipv6mr_interface := 0;
|
||||
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
|
||||
pchar(@Multicast6), SizeOf(Multicast6)));
|
||||
PAnsiChar(@Multicast6), SizeOf(Multicast6)));
|
||||
end
|
||||
else
|
||||
begin
|
||||
Multicast.imr_multiaddr.S_addr := swapbytes(strtoip(MCastIP));
|
||||
Multicast.imr_interface.S_addr := INADDR_ANY;
|
||||
SockCheck(synsock.SetSockOpt(FSocket, IPPROTO_IP, IP_DROP_MEMBERSHIP,
|
||||
pchar(@Multicast), SizeOf(Multicast)));
|
||||
PAnsiChar(@Multicast), SizeOf(Multicast)));
|
||||
end;
|
||||
ExceptCheck;
|
||||
end;
|
||||
|
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 003.012.001 |
|
||||
| Project : Ararat Synapse | 003.012.002 |
|
||||
|==============================================================================|
|
||||
| Content: HTTP client |
|
||||
|==============================================================================|
|
||||
@ -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-2007. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c) 1999-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -679,7 +679,7 @@ begin
|
||||
begin
|
||||
FDownloadSize := Size;
|
||||
FSock.RecvStreamSize(FDocument, FTimeout, Size);
|
||||
FDocument.Seek(0, soFromEnd);
|
||||
FDocument.Position := FDocument.Size;
|
||||
Result := FSock.LastError = 0;
|
||||
end
|
||||
else
|
||||
|
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.000.004 |
|
||||
| Project : Ararat Synapse | 001.001.000 |
|
||||
|==============================================================================|
|
||||
| Content: SSL support by OpenSSL |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2005, Lukas Gebauer |
|
||||
| Copyright (c)1999-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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)2005. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2005-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -105,7 +105,7 @@ type
|
||||
function Init(server:Boolean): Boolean;
|
||||
function DeInit: Boolean;
|
||||
function Prepare(server:Boolean): Boolean;
|
||||
function LoadPFX(pfxdata: string): Boolean;
|
||||
function LoadPFX(pfxdata: ansistring): Boolean;
|
||||
function CreateSelfSignedCert(Host: string): Boolean; override;
|
||||
public
|
||||
{:See @inherited}
|
||||
@ -156,9 +156,9 @@ implementation
|
||||
{==============================================================================}
|
||||
|
||||
{$IFNDEF CIL}
|
||||
function PasswordCallback(buf:PChar; size:Integer; rwflag:Integer; userdata: Pointer):Integer; cdecl;
|
||||
function PasswordCallback(buf:PAnsiChar; size:Integer; rwflag:Integer; userdata: Pointer):Integer; cdecl;
|
||||
var
|
||||
Password: String;
|
||||
Password: AnsiString;
|
||||
begin
|
||||
Password := '';
|
||||
if TCustomSSL(userdata) is TCustomSSL then
|
||||
@ -166,7 +166,7 @@ begin
|
||||
if Length(Password) > (Size - 1) then
|
||||
SetLength(Password, Size - 1);
|
||||
Result := Length(Password);
|
||||
StrLCopy(buf, PChar(Password + #0), Result + 1);
|
||||
StrLCopy(buf, PAnsiChar(Password + #0), Result + 1);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
@ -197,10 +197,11 @@ begin
|
||||
end;
|
||||
|
||||
function TSSLOpenSSL.SSLCheck: Boolean;
|
||||
{$IFDEF CIL}
|
||||
var
|
||||
{$IFDEF CIL}
|
||||
sb: StringBuilder;
|
||||
{$ENDIF}
|
||||
s : AnsiString;
|
||||
begin
|
||||
Result := true;
|
||||
FLastErrorDesc := '';
|
||||
@ -214,8 +215,9 @@ begin
|
||||
ErrErrorString(FLastError, sb, 256);
|
||||
FLastErrorDesc := Trim(sb.ToString);
|
||||
{$ELSE}
|
||||
FLastErrorDesc := StringOfChar(#0, 256);
|
||||
ErrErrorString(FLastError, FLastErrorDesc, Length(FLastErrorDesc));
|
||||
s := StringOfChar(#0, 256);
|
||||
ErrErrorString(FLastError, s, Length(s));
|
||||
FLastErrorDesc := s;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
@ -307,7 +309,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSSLOpenSSL.LoadPFX(pfxdata: string): Boolean;
|
||||
function TSSLOpenSSL.LoadPFX(pfxdata: Ansistring): Boolean;
|
||||
var
|
||||
cert, pkey, ca: SslPtr;
|
||||
b: PBIO;
|
||||
@ -392,6 +394,8 @@ begin
|
||||
end;
|
||||
|
||||
function TSSLOpenSSL.Init(server:Boolean): Boolean;
|
||||
var
|
||||
s: AnsiString;
|
||||
begin
|
||||
Result := False;
|
||||
FLastErrorDesc := '';
|
||||
@ -416,7 +420,8 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
SslCtxSetCipherList(Fctx, FCiphers);
|
||||
s := FCiphers;
|
||||
SslCtxSetCipherList(Fctx, s);
|
||||
if FVerifyCert then
|
||||
SslCtxSetVerify(FCtx, SSL_VERIFY_PEER, nil)
|
||||
else
|
||||
@ -632,7 +637,7 @@ end;
|
||||
function TSSLOpenSSL.GetPeerSubject: string;
|
||||
var
|
||||
cert: PX509;
|
||||
s: string;
|
||||
s: ansistring;
|
||||
{$IFDEF CIL}
|
||||
sb: StringBuilder;
|
||||
{$ENDIF}
|
||||
@ -660,7 +665,7 @@ end;
|
||||
|
||||
function TSSLOpenSSL.GetPeerName: string;
|
||||
var
|
||||
s: string;
|
||||
s: ansistring;
|
||||
begin
|
||||
s := GetPeerSubject;
|
||||
s := SeparateRight(s, '/CN=');
|
||||
@ -670,7 +675,7 @@ end;
|
||||
function TSSLOpenSSL.GetPeerIssuer: string;
|
||||
var
|
||||
cert: PX509;
|
||||
s: string;
|
||||
s: ansistring;
|
||||
{$IFDEF CIL}
|
||||
sb: StringBuilder;
|
||||
{$ENDIF}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 003.004.001 |
|
||||
| Project : Ararat Synapse | 003.005.000 |
|
||||
|==============================================================================|
|
||||
| Content: SSL support by OpenSSL |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2005, Lukas Gebauer |
|
||||
| Copyright (c)1999-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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)2002-2005. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2002-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -652,7 +652,7 @@ var
|
||||
function SslLibraryInit:Integer;
|
||||
procedure SslLoadErrorStrings;
|
||||
// function SslCtxSetCipherList(arg0: PSSL_CTX; str: PChar):Integer;
|
||||
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: String):Integer;
|
||||
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: AnsiString):Integer;
|
||||
function SslCtxNew(meth: PSSL_METHOD):PSSL_CTX;
|
||||
procedure SslCtxFree(arg0: PSSL_CTX);
|
||||
function SslSetFd(s: PSSL; fd: Integer):Integer;
|
||||
@ -661,19 +661,19 @@ var
|
||||
function SslMethodTLSV1:PSSL_METHOD;
|
||||
function SslMethodV23:PSSL_METHOD;
|
||||
function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer;
|
||||
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: String; len: integer):Integer;
|
||||
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: AnsiString; len: integer):Integer;
|
||||
// function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer;
|
||||
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer;
|
||||
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer;
|
||||
function SslCtxUseCertificate(ctx: PSSL_CTX; x: SslPtr):Integer;
|
||||
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: String):Integer;
|
||||
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer;
|
||||
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: AnsiString):Integer;
|
||||
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer;
|
||||
// function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: PChar):Integer;
|
||||
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: String):Integer;
|
||||
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: AnsiString):Integer;
|
||||
function SslCtxCheckPrivateKeyFile(ctx: PSSL_CTX):Integer;
|
||||
procedure SslCtxSetDefaultPasswdCb(ctx: PSSL_CTX; cb: PPasswdCb);
|
||||
procedure SslCtxSetDefaultPasswdCbUserdata(ctx: PSSL_CTX; u: SslPtr);
|
||||
// function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):Integer;
|
||||
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: String; const CApath: String):Integer;
|
||||
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: AnsiString; const CApath: AnsiString):Integer;
|
||||
function SslNew(ctx: PSSL_CTX):PSSL;
|
||||
procedure SslFree(ssl: PSSL);
|
||||
function SslAccept(ssl: PSSL):Integer;
|
||||
@ -683,29 +683,29 @@ var
|
||||
function SslPeek(ssl: PSSL; buf: SslPtr; num: Integer):Integer;
|
||||
function SslWrite(ssl: PSSL; buf: SslPtr; num: Integer):Integer;
|
||||
function SslPending(ssl: PSSL):Integer;
|
||||
function SslGetVersion(ssl: PSSL):String;
|
||||
function SslGetVersion(ssl: PSSL):AnsiString;
|
||||
function SslGetPeerCertificate(ssl: PSSL):PX509;
|
||||
procedure SslCtxSetVerify(ctx: PSSL_CTX; mode: Integer; arg2: PFunction);
|
||||
function SSLGetCurrentCipher(s: PSSL):SslPtr;
|
||||
function SSLCipherGetName(c: SslPtr): String;
|
||||
function SSLCipherGetName(c: SslPtr): AnsiString;
|
||||
function SSLCipherGetBits(c: SslPtr; var alg_bits: Integer):Integer;
|
||||
function SSLGetVerifyResult(ssl: PSSL):Integer;
|
||||
|
||||
// libeay.dll
|
||||
function X509New: PX509;
|
||||
procedure X509Free(x: PX509);
|
||||
function X509NameOneline(a: PX509_NAME; var buf: String; size: Integer):String;
|
||||
function X509NameOneline(a: PX509_NAME; var buf: AnsiString; size: Integer):AnsiString;
|
||||
function X509GetSubjectName(a: PX509):PX509_NAME;
|
||||
function X509GetIssuerName(a: PX509):PX509_NAME;
|
||||
function X509NameHash(x: PX509_NAME):Cardinal;
|
||||
// function SslX509Digest(data: PX509; _type: PEVP_MD; md: PChar; len: PInteger):Integer;
|
||||
function X509Digest(data: PX509; _type: PEVP_MD; md: String; var len: Integer):Integer;
|
||||
function X509Digest(data: PX509; _type: PEVP_MD; md: AnsiString; var len: Integer):Integer;
|
||||
function X509print(b: PBIO; a: PX509): integer;
|
||||
function X509SetVersion(x: PX509; version: integer): integer;
|
||||
function X509SetPubkey(x: PX509; pkey: EVP_PKEY): integer;
|
||||
function X509SetIssuerName(x: PX509; name: PX509_NAME): integer;
|
||||
function X509NameAddEntryByTxt(name: PX509_NAME; field: string; _type: integer;
|
||||
bytes: string; len, loc, _set: integer): integer;
|
||||
function X509NameAddEntryByTxt(name: PX509_NAME; field: Ansistring; _type: integer;
|
||||
bytes: Ansistring; len, loc, _set: integer): integer;
|
||||
function X509Sign(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer;
|
||||
function X509GmtimeAdj(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME;
|
||||
function X509SetNotBefore(x: PX509; tm: PASN1_UTCTIME): integer;
|
||||
@ -714,11 +714,11 @@ var
|
||||
function EvpPkeyNew: EVP_PKEY;
|
||||
procedure EvpPkeyFree(pk: EVP_PKEY);
|
||||
function EvpPkeyAssign(pkey: EVP_PKEY; _type: integer; key: Prsa): integer;
|
||||
function EvpGetDigestByName(Name: String): PEVP_MD;
|
||||
function EvpGetDigestByName(Name: AnsiString): PEVP_MD;
|
||||
procedure EVPcleanup;
|
||||
// function ErrErrorString(e: integer; buf: PChar): PChar;
|
||||
function SSLeayversion(t: integer): string;
|
||||
procedure ErrErrorString(e: integer; var buf: string; len: integer);
|
||||
function SSLeayversion(t: integer): Ansistring;
|
||||
procedure ErrErrorString(e: integer; var buf: Ansistring; len: integer);
|
||||
function ErrGetError: integer;
|
||||
procedure ErrClearError;
|
||||
procedure ErrFreeStrings;
|
||||
@ -730,10 +730,10 @@ var
|
||||
procedure BioFreeAll(b: PBIO);
|
||||
function BioSMem: PBIO_METHOD;
|
||||
function BioCtrlPending(b: PBIO): integer;
|
||||
function BioRead(b: PBIO; var Buf: String; Len: integer): integer;
|
||||
function BioWrite(b: PBIO; Buf: String; Len: integer): integer;
|
||||
function BioRead(b: PBIO; var Buf: AnsiString; Len: integer): integer;
|
||||
function BioWrite(b: PBIO; Buf: AnsiString; Len: integer): integer;
|
||||
function d2iPKCS12bio(b:PBIO; Pkcs12: SslPtr): SslPtr;
|
||||
function PKCS12parse(p12: SslPtr; pass: string; var pkey, cert, ca: SslPtr): integer;
|
||||
function PKCS12parse(p12: SslPtr; pass: Ansistring; var pkey, cert, ca: SslPtr): integer;
|
||||
procedure PKCS12free(p12: SslPtr);
|
||||
function RsaGenerateKey(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA;
|
||||
function Asn1UtctimeNew: PASN1_UTCTIME;
|
||||
@ -763,7 +763,7 @@ type
|
||||
TSslGetError = function(s: PSSL; ret_code: Integer):Integer; cdecl;
|
||||
TSslLibraryInit = function:Integer; cdecl;
|
||||
TSslLoadErrorStrings = procedure; cdecl;
|
||||
TSslCtxSetCipherList = function(arg0: PSSL_CTX; str: PChar):Integer; cdecl;
|
||||
TSslCtxSetCipherList = function(arg0: PSSL_CTX; str: PAnsiChar):Integer; cdecl;
|
||||
TSslCtxNew = function(meth: PSSL_METHOD):PSSL_CTX; cdecl;
|
||||
TSslCtxFree = procedure(arg0: PSSL_CTX); cdecl;
|
||||
TSslSetFd = function(s: PSSL; fd: Integer):Integer; cdecl;
|
||||
@ -773,46 +773,46 @@ type
|
||||
TSslMethodV23 = function:PSSL_METHOD; cdecl;
|
||||
TSslCtxUsePrivateKey = function(ctx: PSSL_CTX; pkey: sslptr):Integer; cdecl;
|
||||
TSslCtxUsePrivateKeyASN1 = function(pk: integer; ctx: PSSL_CTX; d: sslptr; len: integer):Integer; cdecl;
|
||||
TSslCtxUsePrivateKeyFile = function(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer; cdecl;
|
||||
TSslCtxUsePrivateKeyFile = function(ctx: PSSL_CTX; const _file: PAnsiChar; _type: Integer):Integer; cdecl;
|
||||
TSslCtxUseCertificate = function(ctx: PSSL_CTX; x: SslPtr):Integer; cdecl;
|
||||
TSslCtxUseCertificateASN1 = function(ctx: PSSL_CTX; len: Integer; d: SslPtr):Integer; cdecl;
|
||||
TSslCtxUseCertificateFile = function(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer; cdecl;
|
||||
TSslCtxUseCertificateChainFile = function(ctx: PSSL_CTX; const _file: PChar):Integer; cdecl;
|
||||
TSslCtxUseCertificateFile = function(ctx: PSSL_CTX; const _file: PAnsiChar; _type: Integer):Integer; cdecl;
|
||||
TSslCtxUseCertificateChainFile = function(ctx: PSSL_CTX; const _file: PAnsiChar):Integer; cdecl;
|
||||
TSslCtxCheckPrivateKeyFile = function(ctx: PSSL_CTX):Integer; cdecl;
|
||||
TSslCtxSetDefaultPasswdCb = procedure(ctx: PSSL_CTX; cb: SslPtr); cdecl;
|
||||
TSslCtxSetDefaultPasswdCbUserdata = procedure(ctx: PSSL_CTX; u: SslPtr); cdecl;
|
||||
TSslCtxLoadVerifyLocations = function(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):Integer; cdecl;
|
||||
TSslCtxLoadVerifyLocations = function(ctx: PSSL_CTX; const CAfile: PAnsiChar; const CApath: PAnsiChar):Integer; cdecl;
|
||||
TSslNew = function(ctx: PSSL_CTX):PSSL; cdecl;
|
||||
TSslFree = procedure(ssl: PSSL); cdecl;
|
||||
TSslAccept = function(ssl: PSSL):Integer; cdecl;
|
||||
TSslConnect = function(ssl: PSSL):Integer; cdecl;
|
||||
TSslShutdown = function(ssl: PSSL):Integer; cdecl;
|
||||
TSslRead = function(ssl: PSSL; buf: PChar; num: Integer):Integer; cdecl;
|
||||
TSslPeek = function(ssl: PSSL; buf: PChar; num: Integer):Integer; cdecl;
|
||||
TSslWrite = function(ssl: PSSL; const buf: PChar; num: Integer):Integer; cdecl;
|
||||
TSslRead = function(ssl: PSSL; buf: PAnsiChar; num: Integer):Integer; cdecl;
|
||||
TSslPeek = function(ssl: PSSL; buf: PAnsiChar; num: Integer):Integer; cdecl;
|
||||
TSslWrite = function(ssl: PSSL; const buf: PAnsiChar; num: Integer):Integer; cdecl;
|
||||
TSslPending = function(ssl: PSSL):Integer; cdecl;
|
||||
TSslGetVersion = function(ssl: PSSL):PChar; cdecl;
|
||||
TSslGetVersion = function(ssl: PSSL):PAnsiChar; cdecl;
|
||||
TSslGetPeerCertificate = function(ssl: PSSL):PX509; cdecl;
|
||||
TSslCtxSetVerify = procedure(ctx: PSSL_CTX; mode: Integer; arg2: SslPtr); cdecl;
|
||||
TSSLGetCurrentCipher = function(s: PSSL):SslPtr; cdecl;
|
||||
TSSLCipherGetName = function(c: Sslptr):PChar; cdecl;
|
||||
TSSLCipherGetName = function(c: Sslptr):PAnsiChar; cdecl;
|
||||
TSSLCipherGetBits = function(c: SslPtr; alg_bits: PInteger):Integer; cdecl;
|
||||
TSSLGetVerifyResult = function(ssl: PSSL):Integer; cdecl;
|
||||
|
||||
// libeay.dll
|
||||
TX509New = function: PX509; cdecl;
|
||||
TX509Free = procedure(x: PX509); cdecl;
|
||||
TX509NameOneline = function(a: PX509_NAME; buf: PChar; size: Integer):PChar; cdecl;
|
||||
TX509NameOneline = function(a: PX509_NAME; buf: PAnsiChar; size: Integer):PAnsiChar; cdecl;
|
||||
TX509GetSubjectName = function(a: PX509):PX509_NAME; cdecl;
|
||||
TX509GetIssuerName = function(a: PX509):PX509_NAME; cdecl;
|
||||
TX509NameHash = function(x: PX509_NAME):Cardinal; cdecl;
|
||||
TX509Digest = function(data: PX509; _type: PEVP_MD; md: PChar; len: PInteger):Integer; cdecl;
|
||||
TX509Digest = function(data: PX509; _type: PEVP_MD; md: PAnsiChar; len: PInteger):Integer; cdecl;
|
||||
TX509print = function(b: PBIO; a: PX509): integer; cdecl;
|
||||
TX509SetVersion = function(x: PX509; version: integer): integer; cdecl;
|
||||
TX509SetPubkey = function(x: PX509; pkey: EVP_PKEY): integer; cdecl;
|
||||
TX509SetIssuerName = function(x: PX509; name: PX509_NAME): integer; cdecl;
|
||||
TX509NameAddEntryByTxt = function(name: PX509_NAME; field: PChar; _type: integer;
|
||||
bytes: PChar; len, loc, _set: integer): integer; cdecl;
|
||||
TX509NameAddEntryByTxt = function(name: PX509_NAME; field: PAnsiChar; _type: integer;
|
||||
bytes: PAnsiChar; len, loc, _set: integer): integer; cdecl;
|
||||
TX509Sign = function(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer; cdecl;
|
||||
TX509GmtimeAdj = function(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME; cdecl;
|
||||
TX509SetNotBefore = function(x: PX509; tm: PASN1_UTCTIME): integer; cdecl;
|
||||
@ -821,10 +821,10 @@ type
|
||||
TEvpPkeyNew = function: EVP_PKEY; cdecl;
|
||||
TEvpPkeyFree = procedure(pk: EVP_PKEY); cdecl;
|
||||
TEvpPkeyAssign = function(pkey: EVP_PKEY; _type: integer; key: Prsa): integer; cdecl;
|
||||
TEvpGetDigestByName = function(Name: PChar): PEVP_MD; cdecl;
|
||||
TEvpGetDigestByName = function(Name: PAnsiChar): PEVP_MD; cdecl;
|
||||
TEVPcleanup = procedure; cdecl;
|
||||
TSSLeayversion = function(t: integer): PChar; cdecl;
|
||||
TErrErrorString = procedure(e: integer; buf: PChar; len: integer); cdecl;
|
||||
TSSLeayversion = function(t: integer): PAnsiChar; cdecl;
|
||||
TErrErrorString = procedure(e: integer; buf: PAnsiChar; len: integer); cdecl;
|
||||
TErrGetError = function: integer; cdecl;
|
||||
TErrClearError = procedure; cdecl;
|
||||
TErrFreeStrings = procedure; cdecl;
|
||||
@ -836,10 +836,10 @@ type
|
||||
TBioFreeAll = procedure(b: PBIO); cdecl;
|
||||
TBioSMem = function: PBIO_METHOD; cdecl;
|
||||
TBioCtrlPending = function(b: PBIO): integer; cdecl;
|
||||
TBioRead = function(b: PBIO; Buf: PChar; Len: integer): integer; cdecl;
|
||||
TBioWrite = function(b: PBIO; Buf: PChar; Len: integer): integer; cdecl;
|
||||
TBioRead = function(b: PBIO; Buf: PAnsiChar; Len: integer): integer; cdecl;
|
||||
TBioWrite = function(b: PBIO; Buf: PAnsiChar; Len: integer): integer; cdecl;
|
||||
Td2iPKCS12bio = function(b:PBIO; Pkcs12: SslPtr): SslPtr; cdecl;
|
||||
TPKCS12parse = function(p12: SslPtr; pass: PChar; var pkey, cert, ca: SslPtr): integer; cdecl;
|
||||
TPKCS12parse = function(p12: SslPtr; pass: PAnsiChar; var pkey, cert, ca: SslPtr): integer; cdecl;
|
||||
TPKCS12free = procedure(p12: SslPtr); cdecl;
|
||||
TRsaGenerateKey = function(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA; cdecl;
|
||||
TAsn1UtctimeNew = function: PASN1_UTCTIME; cdecl;
|
||||
@ -986,10 +986,10 @@ begin
|
||||
end;
|
||||
|
||||
//function SslCtxSetCipherList(arg0: PSSL_CTX; str: PChar):Integer;
|
||||
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: String):Integer;
|
||||
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: AnsiString):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxSetCipherList) then
|
||||
Result := _SslCtxSetCipherList(arg0, PChar(str))
|
||||
Result := _SslCtxSetCipherList(arg0, PAnsiChar(str))
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1056,7 +1056,7 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: String; len: integer):Integer;
|
||||
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: AnsiString; len: integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxUsePrivateKeyASN1) then
|
||||
Result := _SslCtxUsePrivateKeyASN1(pk, ctx, Sslptr(d), len)
|
||||
@ -1065,10 +1065,10 @@ begin
|
||||
end;
|
||||
|
||||
//function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer;
|
||||
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer;
|
||||
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxUsePrivateKeyFile) then
|
||||
Result := _SslCtxUsePrivateKeyFile(ctx, PChar(_file), _type)
|
||||
Result := _SslCtxUsePrivateKeyFile(ctx, PAnsiChar(_file), _type)
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1081,7 +1081,7 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: String):Integer;
|
||||
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: AnsiString):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxUseCertificateASN1) then
|
||||
Result := _SslCtxUseCertificateASN1(ctx, len, SslPtr(d))
|
||||
@ -1089,19 +1089,19 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer;
|
||||
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxUseCertificateFile) then
|
||||
Result := _SslCtxUseCertificateFile(ctx, PChar(_file), _type)
|
||||
Result := _SslCtxUseCertificateFile(ctx, PAnsiChar(_file), _type)
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
//function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: PChar):Integer;
|
||||
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: String):Integer;
|
||||
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: AnsiString):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxUseCertificateChainFile) then
|
||||
Result := _SslCtxUseCertificateChainFile(ctx, PChar(_file))
|
||||
Result := _SslCtxUseCertificateChainFile(ctx, PAnsiChar(_file))
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1127,7 +1127,7 @@ begin
|
||||
end;
|
||||
|
||||
//function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):Integer;
|
||||
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: String; const CApath: String):Integer;
|
||||
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: AnsiString; const CApath: AnsiString):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslCtxLoadVerifyLocations) then
|
||||
Result := _SslCtxLoadVerifyLocations(ctx, SslPtr(CAfile), SslPtr(CApath))
|
||||
@ -1177,7 +1177,7 @@ end;
|
||||
function SslRead(ssl: PSSL; buf: SslPtr; num: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslRead) then
|
||||
Result := _SslRead(ssl, PChar(buf), num)
|
||||
Result := _SslRead(ssl, PAnsiChar(buf), num)
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
@ -1186,7 +1186,7 @@ end;
|
||||
function SslPeek(ssl: PSSL; buf: SslPtr; num: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslPeek) then
|
||||
Result := _SslPeek(ssl, PChar(buf), num)
|
||||
Result := _SslPeek(ssl, PAnsiChar(buf), num)
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
@ -1195,7 +1195,7 @@ end;
|
||||
function SslWrite(ssl: PSSL; buf: SslPtr; num: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslWrite) then
|
||||
Result := _SslWrite(ssl, PChar(buf), num)
|
||||
Result := _SslWrite(ssl, PAnsiChar(buf), num)
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
@ -1209,7 +1209,7 @@ begin
|
||||
end;
|
||||
|
||||
//function SslGetVersion(ssl: PSSL):PChar;
|
||||
function SslGetVersion(ssl: PSSL):String;
|
||||
function SslGetVersion(ssl: PSSL):AnsiString;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SslGetVersion) then
|
||||
Result := _SslGetVersion(ssl)
|
||||
@ -1244,7 +1244,7 @@ begin
|
||||
end;
|
||||
|
||||
//function SSLCipherGetName(c: SslPtr):PChar;
|
||||
function SSLCipherGetName(c: SslPtr):String;
|
||||
function SSLCipherGetName(c: SslPtr):AnsiString;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SSLCipherGetName) then
|
||||
Result := _SSLCipherGetName(c)
|
||||
@ -1285,10 +1285,10 @@ begin
|
||||
end;
|
||||
|
||||
//function SslX509NameOneline(a: PX509_NAME; buf: PChar; size: Integer):PChar;
|
||||
function X509NameOneline(a: PX509_NAME; var buf: String; size: Integer):String;
|
||||
function X509NameOneline(a: PX509_NAME; var buf: AnsiString; size: Integer):AnsiString;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_X509NameOneline) then
|
||||
Result := _X509NameOneline(a, PChar(buf),size)
|
||||
Result := _X509NameOneline(a, PAnsiChar(buf),size)
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
@ -1318,10 +1318,10 @@ begin
|
||||
end;
|
||||
|
||||
//function SslX509Digest(data: PX509; _type: PEVP_MD; md: PChar; len: PInteger):Integer;
|
||||
function X509Digest(data: PX509; _type: PEVP_MD; md: String; var len: Integer):Integer;
|
||||
function X509Digest(data: PX509; _type: PEVP_MD; md: AnsiString; var len: Integer):Integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_X509Digest) then
|
||||
Result := _X509Digest(data, _type, PChar(md), @len)
|
||||
Result := _X509Digest(data, _type, PAnsiChar(md), @len)
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1340,15 +1340,15 @@ begin
|
||||
_EvpPkeyFree(pk);
|
||||
end;
|
||||
|
||||
function SSLeayversion(t: integer): string;
|
||||
function SSLeayversion(t: integer): Ansistring;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_SSLeayversion) then
|
||||
Result := PChar(_SSLeayversion(t))
|
||||
Result := PAnsiChar(_SSLeayversion(t))
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure ErrErrorString(e: integer; var buf: string; len: integer);
|
||||
procedure ErrErrorString(e: integer; var buf: Ansistring; len: integer);
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_ErrErrorString) then
|
||||
_ErrErrorString(e, Pointer(buf), len);
|
||||
@ -1436,19 +1436,19 @@ begin
|
||||
end;
|
||||
|
||||
//function BioRead(b: PBIO; Buf: PChar; Len: integer): integer;
|
||||
function BioRead(b: PBIO; var Buf: String; Len: integer): integer;
|
||||
function BioRead(b: PBIO; var Buf: AnsiString; Len: integer): integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_BioRead) then
|
||||
Result := _BioRead(b, PChar(Buf), Len)
|
||||
Result := _BioRead(b, PAnsiChar(Buf), Len)
|
||||
else
|
||||
Result := -2;
|
||||
end;
|
||||
|
||||
//function BioWrite(b: PBIO; Buf: PChar; Len: integer): integer;
|
||||
function BioWrite(b: PBIO; Buf: String; Len: integer): integer;
|
||||
function BioWrite(b: PBIO; Buf: AnsiString; Len: integer): integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_BioWrite) then
|
||||
Result := _BioWrite(b, PChar(Buf), Len)
|
||||
Result := _BioWrite(b, PAnsiChar(Buf), Len)
|
||||
else
|
||||
Result := -2;
|
||||
end;
|
||||
@ -1469,7 +1469,7 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function PKCS12parse(p12: SslPtr; pass: string; var pkey, cert, ca: SslPtr): integer;
|
||||
function PKCS12parse(p12: SslPtr; pass: Ansistring; var pkey, cert, ca: SslPtr): integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_PKCS12parse) then
|
||||
Result := _PKCS12parse(p12, SslPtr(pass), pkey, cert, ca)
|
||||
@ -1523,11 +1523,11 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function X509NameAddEntryByTxt(name: PX509_NAME; field: string; _type: integer;
|
||||
bytes: string; len, loc, _set: integer): integer;
|
||||
function X509NameAddEntryByTxt(name: PX509_NAME; field: Ansistring; _type: integer;
|
||||
bytes: Ansistring; len, loc, _set: integer): integer;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_X509NameAddEntryByTxt) then
|
||||
Result := _X509NameAddEntryByTxt(name, PChar(field), _type, PChar(Bytes), len, loc, _set)
|
||||
Result := _X509NameAddEntryByTxt(name, PAnsiChar(field), _type, PAnsiChar(Bytes), len, loc, _set)
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1594,10 +1594,10 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function EvpGetDigestByName(Name: String): PEVP_MD;
|
||||
function EvpGetDigestByName(Name: AnsiString): PEVP_MD;
|
||||
begin
|
||||
if InitSSLInterface and Assigned(_EvpGetDigestByName) then
|
||||
Result := _EvpGetDigestByName(PChar(Name))
|
||||
Result := _EvpGetDigestByName(PAnsiChar(Name))
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
234
sswin32.pas
234
sswin32.pas
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 002.000.002 |
|
||||
| Project : Ararat Synapse | 002.002.000 |
|
||||
|==============================================================================|
|
||||
| Content: Socket Independent Platform Layer - Win32 definition include |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2003, Lukas Gebauer |
|
||||
| Copyright (c)1999-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -244,7 +244,7 @@ uses
|
||||
SyncObjs, SysUtils, Classes,
|
||||
Windows;
|
||||
|
||||
function InitSocketInterface(stack: string): Boolean;
|
||||
function InitSocketInterface(stack: String): Boolean;
|
||||
function DestroySocketInterface: Boolean;
|
||||
|
||||
const
|
||||
@ -255,7 +255,6 @@ const
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
u_char = Char;
|
||||
u_short = Word;
|
||||
u_int = Integer;
|
||||
u_long = Longint;
|
||||
@ -331,9 +330,9 @@ type
|
||||
0: (sin_family: u_short;
|
||||
sin_port: u_short;
|
||||
sin_addr: TInAddr;
|
||||
sin_zero: array[0..7] of Char);
|
||||
sin_zero: array[0..7] of byte);
|
||||
1: (sa_family: u_short;
|
||||
sa_data: array[0..13] of Char)
|
||||
sa_data: array[0..13] of byte)
|
||||
end;
|
||||
|
||||
TIP_mreq = record
|
||||
@ -368,35 +367,35 @@ type
|
||||
|
||||
PHostEnt = ^THostEnt;
|
||||
THostEnt = packed record
|
||||
h_name: PChar;
|
||||
h_aliases: ^PChar;
|
||||
h_name: PAnsiChar;
|
||||
h_aliases: ^PAnsiChar;
|
||||
h_addrtype: Smallint;
|
||||
h_length: Smallint;
|
||||
case integer of
|
||||
0: (h_addr_list: ^PChar);
|
||||
0: (h_addr_list: ^PAnsiChar);
|
||||
1: (h_addr: ^PInAddr);
|
||||
end;
|
||||
|
||||
PNetEnt = ^TNetEnt;
|
||||
TNetEnt = packed record
|
||||
n_name: PChar;
|
||||
n_aliases: ^PChar;
|
||||
n_name: PAnsiChar;
|
||||
n_aliases: ^PAnsiChar;
|
||||
n_addrtype: Smallint;
|
||||
n_net: u_long;
|
||||
end;
|
||||
|
||||
PServEnt = ^TServEnt;
|
||||
TServEnt = packed record
|
||||
s_name: PChar;
|
||||
s_aliases: ^PChar;
|
||||
s_name: PAnsiChar;
|
||||
s_aliases: ^PAnsiChar;
|
||||
s_port: Smallint;
|
||||
s_proto: PChar;
|
||||
s_proto: PAnsiChar;
|
||||
end;
|
||||
|
||||
PProtoEnt = ^TProtoEnt;
|
||||
TProtoEnt = packed record
|
||||
p_name: PChar;
|
||||
p_aliases: ^Pchar;
|
||||
p_name: PAnsiChar;
|
||||
p_aliases: ^PAnsichar;
|
||||
p_proto: Smallint;
|
||||
end;
|
||||
|
||||
@ -540,7 +539,7 @@ type
|
||||
ai_socktype: integer; // SOCK_xxx.
|
||||
ai_protocol: integer; // 0 or IPPROTO_xxx for IPv4 and IPv6.
|
||||
ai_addrlen: u_int; // Length of ai_addr.
|
||||
ai_canonname: PChar; // Canonical name for nodename.
|
||||
ai_canonname: PAnsiChar; // Canonical name for nodename.
|
||||
ai_addr: PSockAddr; // Binary address.
|
||||
ai_next: PAddrInfo; // Next structure in linked list.
|
||||
end;
|
||||
@ -719,11 +718,11 @@ type
|
||||
TWSAData = packed record
|
||||
wVersion: Word;
|
||||
wHighVersion: Word;
|
||||
szDescription: array[0..WSADESCRIPTION_LEN] of Char;
|
||||
szSystemStatus: array[0..WSASYS_STATUS_LEN] of Char;
|
||||
szDescription: array[0..WSADESCRIPTION_LEN] of AnsiChar;
|
||||
szSystemStatus: array[0..WSASYS_STATUS_LEN] of AnsiChar;
|
||||
iMaxSockets: Word;
|
||||
iMaxUdpDg: Word;
|
||||
lpVendorInfo: PChar;
|
||||
lpVendorInfo: PAnsiChar;
|
||||
end;
|
||||
|
||||
function IN6_IS_ADDR_UNSPECIFIED(const a: PInAddr6): boolean;
|
||||
@ -751,26 +750,26 @@ type
|
||||
stdcall;
|
||||
TWSAGetLastError = function: Integer;
|
||||
stdcall;
|
||||
TGetServByName = function(name, proto: PChar): PServEnt;
|
||||
TGetServByName = function(name, proto: PAnsiChar): PServEnt;
|
||||
stdcall;
|
||||
TGetServByPort = function(port: Integer; proto: PChar): PServEnt;
|
||||
TGetServByPort = function(port: Integer; proto: PAnsiChar): PServEnt;
|
||||
stdcall;
|
||||
TGetProtoByName = function(name: PChar): PProtoEnt;
|
||||
TGetProtoByName = function(name: PAnsiChar): PProtoEnt;
|
||||
stdcall;
|
||||
TGetProtoByNumber = function(proto: Integer): PProtoEnt;
|
||||
stdcall;
|
||||
TGetHostByName = function(name: PChar): PHostEnt;
|
||||
TGetHostByName = function(name: PAnsiChar): PHostEnt;
|
||||
stdcall;
|
||||
TGetHostByAddr = function(addr: Pointer; len, Struc: Integer): PHostEnt;
|
||||
stdcall;
|
||||
TGetHostName = function(name: PChar; len: Integer): Integer;
|
||||
TGetHostName = function(name: PAnsiChar; len: Integer): Integer;
|
||||
stdcall;
|
||||
TShutdown = function(s: TSocket; how: Integer): Integer;
|
||||
stdcall;
|
||||
TSetSockOpt = function(s: TSocket; level, optname: Integer; optval: PChar;
|
||||
TSetSockOpt = function(s: TSocket; level, optname: Integer; optval: PAnsiChar;
|
||||
optlen: Integer): Integer;
|
||||
stdcall;
|
||||
TGetSockOpt = function(s: TSocket; level, optname: Integer; optval: PChar;
|
||||
TGetSockOpt = function(s: TSocket; level, optname: Integer; optval: PAnsiChar;
|
||||
var optlen: Integer): Integer;
|
||||
stdcall;
|
||||
TSendTo = function(s: TSocket; const Buf; len, flags: Integer; addrto: PSockAddr;
|
||||
@ -791,9 +790,9 @@ type
|
||||
stdcall;
|
||||
TIoctlSocket = function(s: TSocket; cmd: DWORD; var arg: Integer): Integer;
|
||||
stdcall;
|
||||
TInet_ntoa = function(inaddr: TInAddr): PChar;
|
||||
TInet_ntoa = function(inaddr: TInAddr): PAnsiChar;
|
||||
stdcall;
|
||||
TInet_addr = function(cp: PChar): u_long;
|
||||
TInet_addr = function(cp: PAnsiChar): u_long;
|
||||
stdcall;
|
||||
Thtons = function(hostshort: u_short): u_short;
|
||||
stdcall;
|
||||
@ -817,13 +816,13 @@ type
|
||||
timeout: PTimeVal): Longint;
|
||||
stdcall;
|
||||
|
||||
TGetAddrInfo = function(NodeName: PChar; ServName: PChar; Hints: PAddrInfo;
|
||||
TGetAddrInfo = function(NodeName: PAnsiChar; ServName: PAnsiChar; Hints: PAddrInfo;
|
||||
var Addrinfo: PAddrInfo): integer;
|
||||
stdcall;
|
||||
TFreeAddrInfo = procedure(ai: PAddrInfo);
|
||||
stdcall;
|
||||
TGetNameInfo = function( addr: PSockAddr; namelen: Integer; host: PChar;
|
||||
hostlen: DWORD; serv: PChar; servlen: DWORD; flags: integer): integer;
|
||||
TGetNameInfo = function( addr: PSockAddr; namelen: Integer; host: PAnsiChar;
|
||||
hostlen: DWORD; serv: PAnsiChar; servlen: DWORD; flags: integer): integer;
|
||||
stdcall;
|
||||
|
||||
T__WSAFDIsSet = function (s: TSocket; var FDSet: TFDSet): Bool;
|
||||
@ -891,7 +890,7 @@ type
|
||||
case sin_family: u_short of
|
||||
AF_INET: (sin_port: u_short;
|
||||
sin_addr: TInAddr;
|
||||
sin_zero: array[0..7] of Char);
|
||||
sin_zero: array[0..7] of byte);
|
||||
AF_INET6: (sin6_port: u_short;
|
||||
sin6_flowinfo: u_long;
|
||||
sin6_addr: TInAddr6;
|
||||
@ -905,7 +904,7 @@ function Bind(s: TSocket; const addr: TVarSin): Integer;
|
||||
function Connect(s: TSocket; const name: TVarSin): Integer;
|
||||
function GetSockName(s: TSocket; var name: TVarSin): Integer;
|
||||
function GetPeerName(s: TSocket; var name: TVarSin): Integer;
|
||||
function GetHostName: string;
|
||||
function GetHostName: AnsiString;
|
||||
function Send(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
|
||||
function Recv(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
|
||||
function SendTo(s: TSocket; Buf: TMemory; len, flags: Integer; addrto: TVarSin): Integer;
|
||||
@ -913,12 +912,12 @@ function RecvFrom(s: TSocket; Buf: TMemory; len, flags: Integer; var from: TVarS
|
||||
function Accept(s: TSocket; var addr: TVarSin): TSocket;
|
||||
|
||||
function IsNewApi(Family: integer): Boolean;
|
||||
function SetVarSin(var Sin: TVarSin; IP, Port: string; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
|
||||
function GetSinIP(Sin: TVarSin): string;
|
||||
function SetVarSin(var Sin: TVarSin; IP, Port: AnsiString; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
|
||||
function GetSinIP(Sin: TVarSin): AnsiString;
|
||||
function GetSinPort(Sin: TVarSin): Integer;
|
||||
procedure ResolveNameToIP(Name: string; Family, SockProtocol, SockType: integer; const IPList: TStrings);
|
||||
function ResolveIPToName(IP: string; Family, SockProtocol, SockType: integer): string;
|
||||
function ResolvePort(Port: string; Family, SockProtocol, SockType: integer): Word;
|
||||
procedure ResolveNameToIP(Name: AnsiString; Family, SockProtocol, SockType: integer; const IPList: TStrings);
|
||||
function ResolveIPToName(IP: AnsiString; Family, SockProtocol, SockType: integer): AnsiString;
|
||||
function ResolvePort(Port: AnsiString; Family, SockProtocol, SockType: integer): Word;
|
||||
|
||||
{==============================================================================}
|
||||
implementation
|
||||
@ -1058,14 +1057,14 @@ begin
|
||||
Result := ssGetPeerName(s, @name, Len);
|
||||
end;
|
||||
|
||||
function GetHostName: string;
|
||||
function GetHostName: AnsiString;
|
||||
var
|
||||
s: string;
|
||||
s: AnsiString;
|
||||
begin
|
||||
Result := '';
|
||||
setlength(s, 255);
|
||||
ssGetHostName(pchar(s), Length(s) - 1);
|
||||
Result := Pchar(s);
|
||||
ssGetHostName(pAnsichar(s), Length(s) - 1);
|
||||
Result := PAnsichar(s);
|
||||
end;
|
||||
|
||||
function Send(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
|
||||
@ -1107,7 +1106,7 @@ begin
|
||||
Result := (Family = AF_INET6) and SockWship6Api;
|
||||
end;
|
||||
|
||||
function SetVarSin(var Sin: TVarSin; IP, Port: string; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
|
||||
function SetVarSin(var Sin: TVarSin; IP, Port: AnsiString; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
|
||||
type
|
||||
pu_long = ^u_long;
|
||||
var
|
||||
@ -1119,7 +1118,7 @@ var
|
||||
Sin1, Sin2: TVarSin;
|
||||
TwoPass: boolean;
|
||||
|
||||
function GetAddr(const IP, port: string; Hints: TAddrInfo; var Sin: TVarSin): integer;
|
||||
function GetAddr(const IP, port: AnsiString; Hints: TAddrInfo; var Sin: TVarSin): integer;
|
||||
var
|
||||
Addr: PAddrInfo;
|
||||
begin
|
||||
@ -1130,23 +1129,23 @@ var
|
||||
begin
|
||||
Hints.ai_socktype := 0;
|
||||
Hints.ai_protocol := 0;
|
||||
Result := synsock.GetAddrInfo(PChar(IP), nil, @Hints, Addr);
|
||||
Result := synsock.GetAddrInfo(PAnsiChar(IP), nil, @Hints, Addr);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (IP = cAnyHost) or (IP = c6AnyHost) then
|
||||
begin
|
||||
Hints.ai_flags := AI_PASSIVE;
|
||||
Result := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
|
||||
Result := synsock.GetAddrInfo(nil, PAnsiChar(Port), @Hints, Addr);
|
||||
end
|
||||
else
|
||||
if (IP = cLocalhost) or (IP = c6Localhost) then
|
||||
begin
|
||||
Result := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
|
||||
Result := synsock.GetAddrInfo(nil, PAnsiChar(Port), @Hints, Addr);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := synsock.GetAddrInfo(PChar(IP), PChar(Port), @Hints, Addr);
|
||||
Result := synsock.GetAddrInfo(PAnsiChar(IP), PAnsiChar(Port), @Hints, Addr);
|
||||
end;
|
||||
end;
|
||||
if Result = 0 then
|
||||
@ -1169,7 +1168,7 @@ begin
|
||||
ProtoEnt := synsock.GetProtoByNumber(SockProtocol);
|
||||
ServEnt := nil;
|
||||
if ProtoEnt <> nil then
|
||||
ServEnt := synsock.GetServByName(PChar(Port), ProtoEnt^.p_name);
|
||||
ServEnt := synsock.GetServByName(PAnsiChar(Port), ProtoEnt^.p_name);
|
||||
if ServEnt = nil then
|
||||
Sin.sin_port := synsock.htons(StrToIntDef(Port, 0))
|
||||
else
|
||||
@ -1178,10 +1177,10 @@ begin
|
||||
Sin.sin_addr.s_addr := u_long(INADDR_BROADCAST)
|
||||
else
|
||||
begin
|
||||
Sin.sin_addr.s_addr := synsock.inet_addr(PChar(IP));
|
||||
Sin.sin_addr.s_addr := synsock.inet_addr(PAnsiChar(IP));
|
||||
if Sin.sin_addr.s_addr = u_long(INADDR_NONE) then
|
||||
begin
|
||||
HostEnt := synsock.GetHostByName(PChar(IP));
|
||||
HostEnt := synsock.GetHostByName(PAnsiChar(IP));
|
||||
Result := synsock.WSAGetLastError;
|
||||
if HostEnt <> nil then
|
||||
Sin.sin_addr.S_addr := u_long(Pu_long(HostEnt^.h_addr_list^)^);
|
||||
@ -1233,10 +1232,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetSinIP(Sin: TVarSin): string;
|
||||
function GetSinIP(Sin: TVarSin): AnsiString;
|
||||
var
|
||||
p: PChar;
|
||||
host, serv: string;
|
||||
p: PAnsiChar;
|
||||
host, serv: AnsiString;
|
||||
hostlen, servlen: integer;
|
||||
r: integer;
|
||||
begin
|
||||
@ -1253,10 +1252,10 @@ begin
|
||||
servlen := NI_MAXSERV;
|
||||
setlength(host, hostlen);
|
||||
setlength(serv, servlen);
|
||||
r := getnameinfo(@sin, SizeOfVarSin(sin), PChar(host), hostlen,
|
||||
PChar(serv), servlen, NI_NUMERICHOST + NI_NUMERICSERV);
|
||||
r := getnameinfo(@sin, SizeOfVarSin(sin), PAnsiChar(host), hostlen,
|
||||
PAnsiChar(serv), servlen, NI_NUMERICHOST + NI_NUMERICSERV);
|
||||
if r = 0 then
|
||||
Result := PChar(host);
|
||||
Result := PAnsiChar(host);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1268,7 +1267,7 @@ begin
|
||||
Result := synsock.ntohs(Sin.sin_port);
|
||||
end;
|
||||
|
||||
procedure ResolveNameToIP(Name: string; Family, SockProtocol, SockType: integer; const IPList: TStrings);
|
||||
procedure ResolveNameToIP(Name: AnsiString; Family, SockProtocol, SockType: integer; const IPList: TStrings);
|
||||
type
|
||||
TaPInAddr = array[0..250] of PInAddr;
|
||||
PaPInAddr = ^TaPInAddr;
|
||||
@ -1277,24 +1276,24 @@ var
|
||||
Addr: PAddrInfo;
|
||||
AddrNext: PAddrInfo;
|
||||
r: integer;
|
||||
host, serv: string;
|
||||
host, serv: AnsiString;
|
||||
hostlen, servlen: integer;
|
||||
RemoteHost: PHostEnt;
|
||||
IP: u_long;
|
||||
PAdrPtr: PaPInAddr;
|
||||
i: Integer;
|
||||
s: string;
|
||||
s: AnsiString;
|
||||
InAddr: TInAddr;
|
||||
begin
|
||||
IPList.Clear;
|
||||
if not IsNewApi(Family) then
|
||||
begin
|
||||
IP := synsock.inet_addr(PChar(Name));
|
||||
IP := synsock.inet_addr(PAnsiChar(Name));
|
||||
if IP = u_long(INADDR_NONE) then
|
||||
begin
|
||||
SynSockCS.Enter;
|
||||
try
|
||||
RemoteHost := synsock.GetHostByName(PChar(Name));
|
||||
RemoteHost := synsock.GetHostByName(PAnsiChar(Name));
|
||||
if RemoteHost <> nil then
|
||||
begin
|
||||
PAdrPtr := PAPInAddr(RemoteHost^.h_addr_list);
|
||||
@ -1324,7 +1323,7 @@ begin
|
||||
Hints.ai_socktype := SockType;
|
||||
Hints.ai_protocol := SockProtocol;
|
||||
Hints.ai_flags := 0;
|
||||
r := synsock.GetAddrInfo(PChar(Name), nil, @Hints, Addr);
|
||||
r := synsock.GetAddrInfo(PAnsiChar(Name), nil, @Hints, Addr);
|
||||
if r = 0 then
|
||||
begin
|
||||
AddrNext := Addr;
|
||||
@ -1338,11 +1337,11 @@ begin
|
||||
setlength(host, hostlen);
|
||||
setlength(serv, servlen);
|
||||
r := getnameinfo(AddrNext^.ai_addr, AddrNext^.ai_addrlen,
|
||||
PChar(host), hostlen, PChar(serv), servlen,
|
||||
PAnsiChar(host), hostlen, PAnsiChar(serv), servlen,
|
||||
NI_NUMERICHOST + NI_NUMERICSERV);
|
||||
if r = 0 then
|
||||
begin
|
||||
host := PChar(host);
|
||||
host := PAnsiChar(host);
|
||||
IPList.Add(host);
|
||||
end;
|
||||
end;
|
||||
@ -1358,7 +1357,7 @@ begin
|
||||
IPList.Add(cAnyHost);
|
||||
end;
|
||||
|
||||
function ResolvePort(Port: string; Family, SockProtocol, SockType: integer): Word;
|
||||
function ResolvePort(Port: AnsiString; Family, SockProtocol, SockType: integer): Word;
|
||||
var
|
||||
ProtoEnt: PProtoEnt;
|
||||
ServEnt: PServEnt;
|
||||
@ -1374,7 +1373,7 @@ begin
|
||||
ProtoEnt := synsock.GetProtoByNumber(SockProtocol);
|
||||
ServEnt := nil;
|
||||
if ProtoEnt <> nil then
|
||||
ServEnt := synsock.GetServByName(PChar(Port), ProtoEnt^.p_name);
|
||||
ServEnt := synsock.GetServByName(PAnsiChar(Port), ProtoEnt^.p_name);
|
||||
if ServEnt = nil then
|
||||
Result := StrToIntDef(Port, 0)
|
||||
else
|
||||
@ -1392,7 +1391,7 @@ begin
|
||||
Hints.ai_socktype := SockType;
|
||||
Hints.ai_protocol := Sockprotocol;
|
||||
Hints.ai_flags := AI_PASSIVE;
|
||||
r := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
|
||||
r := synsock.GetAddrInfo(nil, PAnsiChar(Port), @Hints, Addr);
|
||||
if (r = 0) and Assigned(Addr) then
|
||||
begin
|
||||
if Addr^.ai_family = AF_INET then
|
||||
@ -1407,12 +1406,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ResolveIPToName(IP: string; Family, SockProtocol, SockType: integer): string;
|
||||
function ResolveIPToName(IP: AnsiString; Family, SockProtocol, SockType: integer): AnsiString;
|
||||
var
|
||||
Hints: TAddrInfo;
|
||||
Addr: PAddrInfo;
|
||||
r: integer;
|
||||
host, serv: string;
|
||||
host, serv: AnsiString;
|
||||
hostlen, servlen: integer;
|
||||
RemoteHost: PHostEnt;
|
||||
IPn: u_long;
|
||||
@ -1420,7 +1419,7 @@ begin
|
||||
Result := IP;
|
||||
if not IsNewApi(Family) then
|
||||
begin
|
||||
IPn := synsock.inet_addr(PChar(IP));
|
||||
IPn := synsock.inet_addr(PAnsiChar(IP));
|
||||
if IPn <> u_long(INADDR_NONE) then
|
||||
begin
|
||||
SynSockCS.Enter;
|
||||
@ -1442,7 +1441,7 @@ begin
|
||||
Hints.ai_socktype := SockType;
|
||||
Hints.ai_protocol := SockProtocol;
|
||||
Hints.ai_flags := 0;
|
||||
r := synsock.GetAddrInfo(PChar(IP), nil, @Hints, Addr);
|
||||
r := synsock.GetAddrInfo(PAnsiChar(IP), nil, @Hints, Addr);
|
||||
if (r = 0) and Assigned(Addr)then
|
||||
begin
|
||||
hostlen := NI_MAXHOST;
|
||||
@ -1450,10 +1449,10 @@ begin
|
||||
setlength(host, hostlen);
|
||||
setlength(serv, servlen);
|
||||
r := getnameinfo(Addr^.ai_addr, Addr^.ai_addrlen,
|
||||
PChar(host), hostlen, PChar(serv), servlen,
|
||||
PAnsiChar(host), hostlen, PAnsiChar(serv), servlen,
|
||||
NI_NUMERICSERV);
|
||||
if r = 0 then
|
||||
Result := PChar(host);
|
||||
Result := PAnsiChar(host);
|
||||
end;
|
||||
finally
|
||||
if Assigned(Addr) then
|
||||
@ -1464,7 +1463,7 @@ end;
|
||||
|
||||
{=============================================================================}
|
||||
|
||||
function InitSocketInterface(stack: string): Boolean;
|
||||
function InitSocketInterface(stack: String): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
SockEnhancedApi := False;
|
||||
@ -1479,46 +1478,46 @@ begin
|
||||
LibHandle := LoadLibrary(PChar(Stack));
|
||||
if LibHandle <> 0 then
|
||||
begin
|
||||
WSAIoctl := GetProcAddress(LibHandle, PChar('WSAIoctl'));
|
||||
__WSAFDIsSet := GetProcAddress(LibHandle, PChar('__WSAFDIsSet'));
|
||||
CloseSocket := GetProcAddress(LibHandle, PChar('closesocket'));
|
||||
IoctlSocket := GetProcAddress(LibHandle, PChar('ioctlsocket'));
|
||||
WSAGetLastError := GetProcAddress(LibHandle, PChar('WSAGetLastError'));
|
||||
WSAStartup := GetProcAddress(LibHandle, PChar('WSAStartup'));
|
||||
WSACleanup := GetProcAddress(LibHandle, PChar('WSACleanup'));
|
||||
ssAccept := GetProcAddress(LibHandle, PChar('accept'));
|
||||
ssBind := GetProcAddress(LibHandle, PChar('bind'));
|
||||
ssConnect := GetProcAddress(LibHandle, PChar('connect'));
|
||||
ssGetPeerName := GetProcAddress(LibHandle, PChar('getpeername'));
|
||||
ssGetSockName := GetProcAddress(LibHandle, PChar('getsockname'));
|
||||
GetSockOpt := GetProcAddress(LibHandle, PChar('getsockopt'));
|
||||
Htonl := GetProcAddress(LibHandle, PChar('htonl'));
|
||||
Htons := GetProcAddress(LibHandle, PChar('htons'));
|
||||
Inet_Addr := GetProcAddress(LibHandle, PChar('inet_addr'));
|
||||
Inet_Ntoa := GetProcAddress(LibHandle, PChar('inet_ntoa'));
|
||||
Listen := GetProcAddress(LibHandle, PChar('listen'));
|
||||
Ntohl := GetProcAddress(LibHandle, PChar('ntohl'));
|
||||
Ntohs := GetProcAddress(LibHandle, PChar('ntohs'));
|
||||
ssRecv := GetProcAddress(LibHandle, PChar('recv'));
|
||||
ssRecvFrom := GetProcAddress(LibHandle, PChar('recvfrom'));
|
||||
Select := GetProcAddress(LibHandle, PChar('select'));
|
||||
ssSend := GetProcAddress(LibHandle, PChar('send'));
|
||||
ssSendTo := GetProcAddress(LibHandle, PChar('sendto'));
|
||||
SetSockOpt := GetProcAddress(LibHandle, PChar('setsockopt'));
|
||||
ShutDown := GetProcAddress(LibHandle, PChar('shutdown'));
|
||||
Socket := GetProcAddress(LibHandle, PChar('socket'));
|
||||
GetHostByAddr := GetProcAddress(LibHandle, PChar('gethostbyaddr'));
|
||||
GetHostByName := GetProcAddress(LibHandle, PChar('gethostbyname'));
|
||||
GetProtoByName := GetProcAddress(LibHandle, PChar('getprotobyname'));
|
||||
GetProtoByNumber := GetProcAddress(LibHandle, PChar('getprotobynumber'));
|
||||
GetServByName := GetProcAddress(LibHandle, PChar('getservbyname'));
|
||||
GetServByPort := GetProcAddress(LibHandle, PChar('getservbyport'));
|
||||
ssGetHostName := GetProcAddress(LibHandle, PChar('gethostname'));
|
||||
WSAIoctl := GetProcAddress(LibHandle, PAnsiChar(AnsiString('WSAIoctl')));
|
||||
__WSAFDIsSet := GetProcAddress(LibHandle, PAnsiChar(AnsiString('__WSAFDIsSet')));
|
||||
CloseSocket := GetProcAddress(LibHandle, PAnsiChar(AnsiString('closesocket')));
|
||||
IoctlSocket := GetProcAddress(LibHandle, PAnsiChar(AnsiString('ioctlsocket')));
|
||||
WSAGetLastError := GetProcAddress(LibHandle, PAnsiChar(AnsiString('WSAGetLastError')));
|
||||
WSAStartup := GetProcAddress(LibHandle, PAnsiChar(AnsiString('WSAStartup')));
|
||||
WSACleanup := GetProcAddress(LibHandle, PAnsiChar(AnsiString('WSACleanup')));
|
||||
ssAccept := GetProcAddress(LibHandle, PAnsiChar(AnsiString('accept')));
|
||||
ssBind := GetProcAddress(LibHandle, PAnsiChar(AnsiString('bind')));
|
||||
ssConnect := GetProcAddress(LibHandle, PAnsiChar(AnsiString('connect')));
|
||||
ssGetPeerName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getpeername')));
|
||||
ssGetSockName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getsockname')));
|
||||
GetSockOpt := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getsockopt')));
|
||||
Htonl := GetProcAddress(LibHandle, PAnsiChar(AnsiString('htonl')));
|
||||
Htons := GetProcAddress(LibHandle, PAnsiChar(AnsiString('htons')));
|
||||
Inet_Addr := GetProcAddress(LibHandle, PAnsiChar(AnsiString('inet_addr')));
|
||||
Inet_Ntoa := GetProcAddress(LibHandle, PAnsiChar(AnsiString('inet_ntoa')));
|
||||
Listen := GetProcAddress(LibHandle, PAnsiChar(AnsiString('listen')));
|
||||
Ntohl := GetProcAddress(LibHandle, PAnsiChar(AnsiString('ntohl')));
|
||||
Ntohs := GetProcAddress(LibHandle, PAnsiChar(AnsiString('ntohs')));
|
||||
ssRecv := GetProcAddress(LibHandle, PAnsiChar(AnsiString('recv')));
|
||||
ssRecvFrom := GetProcAddress(LibHandle, PAnsiChar(AnsiString('recvfrom')));
|
||||
Select := GetProcAddress(LibHandle, PAnsiChar(AnsiString('select')));
|
||||
ssSend := GetProcAddress(LibHandle, PAnsiChar(AnsiString('send')));
|
||||
ssSendTo := GetProcAddress(LibHandle, PAnsiChar(AnsiString('sendto')));
|
||||
SetSockOpt := GetProcAddress(LibHandle, PAnsiChar(AnsiString('setsockopt')));
|
||||
ShutDown := GetProcAddress(LibHandle, PAnsiChar(AnsiString('shutdown')));
|
||||
Socket := GetProcAddress(LibHandle, PAnsiChar(AnsiString('socket')));
|
||||
GetHostByAddr := GetProcAddress(LibHandle, PAnsiChar(AnsiString('gethostbyaddr')));
|
||||
GetHostByName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('gethostbyname')));
|
||||
GetProtoByName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getprotobyname')));
|
||||
GetProtoByNumber := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getprotobynumber')));
|
||||
GetServByName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getservbyname')));
|
||||
GetServByPort := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getservbyport')));
|
||||
ssGetHostName := GetProcAddress(LibHandle, PAnsiChar(AnsiString('gethostname')));
|
||||
|
||||
{$IFNDEF FORCEOLDAPI}
|
||||
GetAddrInfo := GetProcAddress(LibHandle, PChar('getaddrinfo'));
|
||||
FreeAddrInfo := GetProcAddress(LibHandle, PChar('freeaddrinfo'));
|
||||
GetNameInfo := GetProcAddress(LibHandle, PChar('getnameinfo'));
|
||||
GetAddrInfo := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getaddrinfo')));
|
||||
FreeAddrInfo := GetProcAddress(LibHandle, PAnsiChar(AnsiString('freeaddrinfo')));
|
||||
GetNameInfo := GetProcAddress(LibHandle, PAnsiChar(AnsiString('getnameinfo')));
|
||||
SockEnhancedApi := Assigned(GetAddrInfo) and Assigned(FreeAddrInfo)
|
||||
and Assigned(GetNameInfo);
|
||||
if not SockEnhancedApi then
|
||||
@ -1526,9 +1525,9 @@ begin
|
||||
LibWship6Handle := LoadLibrary(PChar(DLLWship6));
|
||||
if LibWship6Handle <> 0 then
|
||||
begin
|
||||
GetAddrInfo := GetProcAddress(LibWship6Handle, PChar('getaddrinfo'));
|
||||
FreeAddrInfo := GetProcAddress(LibWship6Handle, PChar('freeaddrinfo'));
|
||||
GetNameInfo := GetProcAddress(LibWship6Handle, PChar('getnameinfo'));
|
||||
GetAddrInfo := GetProcAddress(LibWship6Handle, PAnsiChar(AnsiString('getaddrinfo')));
|
||||
FreeAddrInfo := GetProcAddress(LibWship6Handle, PAnsiChar(AnsiString('freeaddrinfo')));
|
||||
GetNameInfo := GetProcAddress(LibWship6Handle, PAnsiChar(AnsiString('getnameinfo')));
|
||||
SockWship6Api := Assigned(GetAddrInfo) and Assigned(FreeAddrInfo)
|
||||
and Assigned(GetNameInfo);
|
||||
end;
|
||||
@ -1584,4 +1583,3 @@ begin
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.000.000 |
|
||||
| Project : Ararat Synapse | 001.001.000 |
|
||||
|==============================================================================|
|
||||
| Content: Socket debug tools |
|
||||
|==============================================================================|
|
||||
@ -61,14 +61,14 @@ type
|
||||
class procedure HookMonitor(Sender: TObject; Writing: Boolean; const Buffer: TMemory; Len: Integer);
|
||||
end;
|
||||
|
||||
procedure AppendToLog(const value: string);
|
||||
procedure AppendToLog(const value: Ansistring);
|
||||
|
||||
var
|
||||
LogFile: string;
|
||||
|
||||
implementation
|
||||
|
||||
procedure AppendToLog(const value: string);
|
||||
procedure AppendToLog(const value: Ansistring);
|
||||
var
|
||||
st: TFileStream;
|
||||
s: string;
|
||||
@ -132,7 +132,7 @@ end;
|
||||
|
||||
class procedure TSynaDebug.HookMonitor(Sender: TObject; Writing: Boolean; const Buffer: TMemory; Len: Integer);
|
||||
var
|
||||
s, d: string;
|
||||
s, d: Ansistring;
|
||||
begin
|
||||
setlength(s, len);
|
||||
move(Buffer^, pointer(s)^, len);
|
||||
|
30
synaicnv.pas
30
synaicnv.pas
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.000.002 |
|
||||
| Project : Ararat Synapse | 001.001.000 |
|
||||
|==============================================================================|
|
||||
| Content: ICONV support for Win32, Linux and .NET |
|
||||
|==============================================================================|
|
||||
| Copyright (c)2004, Lukas Gebauer |
|
||||
| Copyright (c)2004-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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)2004. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2004-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -92,9 +92,9 @@ type
|
||||
var
|
||||
iconvLibHandle: TLibHandle = 0;
|
||||
|
||||
function SynaIconvOpen(const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpenTranslit(const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpenIgnore(const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpen(const tocode, fromcode: Ansistring): iconv_t;
|
||||
function SynaIconvOpenTranslit(const tocode, fromcode: Ansistring): iconv_t;
|
||||
function SynaIconvOpenIgnore(const tocode, fromcode: Ansistring): iconv_t;
|
||||
function SynaIconv(cd: iconv_t; inbuf: AnsiString; var outbuf: AnsiString): integer;
|
||||
function SynaIconvClose(var cd: iconv_t): integer;
|
||||
function SynaIconvCtl(cd: iconv_t; request: integer; argument: argptr): integer;
|
||||
@ -139,7 +139,7 @@ uses SyncObjs;
|
||||
|
||||
{$ELSE}
|
||||
type
|
||||
Ticonv_open = function(tocode: pchar; fromcode: pchar): iconv_t; cdecl;
|
||||
Ticonv_open = function(tocode: pAnsichar; fromcode: pAnsichar): iconv_t; cdecl;
|
||||
Ticonv = function(cd: iconv_t; var inbuf: pointer; var inbytesleft: size_t;
|
||||
var outbuf: pointer; var outbytesleft: size_t): size_t; cdecl;
|
||||
Ticonv_close = function(cd: iconv_t): integer; cdecl;
|
||||
@ -156,7 +156,7 @@ var
|
||||
IconvCS: TCriticalSection;
|
||||
Iconvloaded: boolean = false;
|
||||
|
||||
function SynaIconvOpen (const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpen (const tocode, fromcode: Ansistring): iconv_t;
|
||||
begin
|
||||
{$IFDEF CIL}
|
||||
try
|
||||
@ -167,18 +167,18 @@ begin
|
||||
end;
|
||||
{$ELSE}
|
||||
if InitIconvInterface and Assigned(_iconv_open) then
|
||||
Result := _iconv_open(PChar(tocode), PChar(fromcode))
|
||||
Result := _iconv_open(PAnsiChar(tocode), PAnsiChar(fromcode))
|
||||
else
|
||||
Result := iconv_t(-1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function SynaIconvOpenTranslit (const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpenTranslit (const tocode, fromcode: Ansistring): iconv_t;
|
||||
begin
|
||||
Result := SynaIconvOpen(tocode + '//IGNORE//TRANSLIT', fromcode);
|
||||
end;
|
||||
|
||||
function SynaIconvOpenIgnore (const tocode, fromcode: string): iconv_t;
|
||||
function SynaIconvOpenIgnore (const tocode, fromcode: Ansistring): iconv_t;
|
||||
begin
|
||||
Result := SynaIconvOpen(tocode + '//IGNORE', fromcode);
|
||||
end;
|
||||
@ -283,10 +283,10 @@ begin
|
||||
if (IconvLibHandle <> 0) then
|
||||
begin
|
||||
{$IFNDEF CIL}
|
||||
_iconv_open := GetProcAddress(IconvLibHandle, Pchar('libiconv_open'));
|
||||
_iconv := GetProcAddress(IconvLibHandle, Pchar('libiconv'));
|
||||
_iconv_close := GetProcAddress(IconvLibHandle, Pchar('libiconv_close'));
|
||||
_iconvctl := GetProcAddress(IconvLibHandle, Pchar('libiconvctl'));
|
||||
_iconv_open := GetProcAddress(IconvLibHandle, PAnsiChar(AnsiString('libiconv_open')));
|
||||
_iconv := GetProcAddress(IconvLibHandle, PAnsiChar(AnsiString('libiconv')));
|
||||
_iconv_close := GetProcAddress(IconvLibHandle, PAnsiChar(AnsiString('libiconv_close')));
|
||||
_iconvctl := GetProcAddress(IconvLibHandle, PAnsiChar(AnsiString('libiconvctl')));
|
||||
{$ENDIF}
|
||||
Result := True;
|
||||
Iconvloaded := True;
|
||||
|
10
synaip.pas
10
synaip.pas
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.000.002 |
|
||||
| Project : Ararat Synapse | 001.001.000 |
|
||||
|==============================================================================|
|
||||
| Content: IP address support procedures and functions |
|
||||
|==============================================================================|
|
||||
| Copyright (c)2006, Lukas Gebauer |
|
||||
| Copyright (c)2006-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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) 2006. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c) 2006-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -71,7 +71,7 @@ function IsIP(const Value: string): Boolean;
|
||||
function IsIP6(const Value: string): Boolean;
|
||||
|
||||
{:Returns a string with the "Host" ip address converted to binary form.}
|
||||
function IPToID(Host: string): string;
|
||||
function IPToID(Host: string): Ansistring;
|
||||
|
||||
{:Convert IPv6 address from their string form to binary byte array.}
|
||||
function StrToIp6(value: string): TIp6Bytes;
|
||||
@ -180,7 +180,7 @@ begin
|
||||
end;
|
||||
|
||||
{==============================================================================}
|
||||
function IPToID(Host: string): string;
|
||||
function IPToID(Host: string): Ansistring;
|
||||
var
|
||||
s: string;
|
||||
i, x: Integer;
|
||||
|
20
synamisc.pas
20
synamisc.pas
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.002.000 |
|
||||
| Project : Ararat Synapse | 001.003.000 |
|
||||
|==============================================================================|
|
||||
| Content: misc. procedures and functions |
|
||||
|==============================================================================|
|
||||
@ -104,8 +104,8 @@ implementation
|
||||
procedure WakeOnLan(MAC, IP: string);
|
||||
var
|
||||
sock: TUDPBlockSocket;
|
||||
HexMac: string;
|
||||
data: string;
|
||||
HexMac: Ansistring;
|
||||
data: Ansistring;
|
||||
n: integer;
|
||||
b: Byte;
|
||||
begin
|
||||
@ -144,7 +144,7 @@ end;
|
||||
function GetDNSbyIpHlp: string;
|
||||
type
|
||||
PTIP_ADDRESS_STRING = ^TIP_ADDRESS_STRING;
|
||||
TIP_ADDRESS_STRING = array[0..15] of char;
|
||||
TIP_ADDRESS_STRING = array[0..15] of Ansichar;
|
||||
PTIP_ADDR_STRING = ^TIP_ADDR_STRING;
|
||||
TIP_ADDR_STRING = packed record
|
||||
Next: PTIP_ADDR_STRING;
|
||||
@ -154,12 +154,12 @@ type
|
||||
end;
|
||||
PTFixedInfo = ^TFixedInfo;
|
||||
TFixedInfo = packed record
|
||||
HostName: array[1..128 + 4] of char;
|
||||
DomainName: array[1..128 + 4] of char;
|
||||
HostName: array[1..128 + 4] of Ansichar;
|
||||
DomainName: array[1..128 + 4] of Ansichar;
|
||||
CurrentDNSServer: PTIP_ADDR_STRING;
|
||||
DNSServerList: TIP_ADDR_STRING;
|
||||
NodeType: UINT;
|
||||
ScopeID: array[1..256 + 4] of char;
|
||||
ScopeID: array[1..256 + 4] of Ansichar;
|
||||
EnableRouting: UINT;
|
||||
EnableProxy: UINT;
|
||||
EnableDNS: UINT;
|
||||
@ -180,7 +180,7 @@ begin
|
||||
if IpHlpModule = 0 then
|
||||
exit;
|
||||
try
|
||||
GetNetworkParams := GetProcAddress(IpHlpModule,'GetNetworkParams');
|
||||
GetNetworkParams := GetProcAddress(IpHlpModule,PAnsiChar(AnsiString('GetNetworkParams')));
|
||||
if @GetNetworkParams = nil then
|
||||
Exit;
|
||||
err := GetNetworkParams(Nil, @InfoSize);
|
||||
@ -225,7 +225,7 @@ begin
|
||||
DataType := REG_SZ;
|
||||
DataSize := SizeOf(Temp);
|
||||
if RegQueryValueEx(OpenKey, Vn, nil, @DataType, @Temp, @DataSize) = ERROR_SUCCESS then
|
||||
Result := string(Temp);
|
||||
SetString(Result, Temp, DataSize div SizeOf(Char) - 1);
|
||||
RegCloseKey(OpenKey);
|
||||
end;
|
||||
end ;
|
||||
@ -316,7 +316,7 @@ begin
|
||||
if WininetModule = 0 then
|
||||
exit;
|
||||
try
|
||||
InternetQueryOption := GetProcAddress(WininetModule,'InternetQueryOptionA');
|
||||
InternetQueryOption := GetProcAddress(WininetModule,PAnsiChar(AnsiString('InternetQueryOptionA')));
|
||||
if @InternetQueryOption = nil then
|
||||
Exit;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 007.002.000 |
|
||||
| Project : Ararat Synapse | 007.003.000 |
|
||||
|==============================================================================|
|
||||
| Content: Serial port support |
|
||||
|==============================================================================|
|
||||
| Copyright (c)2001-2007, Lukas Gebauer |
|
||||
| Copyright (c)2001-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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)2001-2007. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2001-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -1254,7 +1254,7 @@ var
|
||||
s: string;
|
||||
l: Integer;
|
||||
CorCRLF: Boolean;
|
||||
t: string;
|
||||
t: ansistring;
|
||||
tl: integer;
|
||||
ti: LongWord;
|
||||
begin
|
||||
|
19
synautil.pas
19
synautil.pas
@ -1,5 +1,5 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 004.012.000 |
|
||||
| Project : Ararat Synapse | 004.013.000 |
|
||||
|==============================================================================|
|
||||
| Content: support procedures and functions |
|
||||
|==============================================================================|
|
||||
@ -72,6 +72,11 @@ uses
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, SynaFpc;
|
||||
|
||||
{$IFDEF VER100}
|
||||
type
|
||||
int64 = integer;
|
||||
{$ENDIF}
|
||||
|
||||
{:Return your timezone bias from UTC time in minutes.}
|
||||
function TimeZoneBias: integer;
|
||||
|
||||
@ -226,7 +231,7 @@ function ParseURL(URL: string; var Prot, User, Pass, Host, Port, Path,
|
||||
|
||||
{:Replaces all "Search" string values found within "Value" string, with the
|
||||
"Replace" string value.}
|
||||
function ReplaceString(Value, Search, Replace: string): string;
|
||||
function ReplaceString(Value, Search, Replace: AnsiString): AnsiString;
|
||||
|
||||
{:It is like RPos, but search is from specified possition.}
|
||||
function RPosEx(const Sub, Value: string; From: integer): Integer;
|
||||
@ -1283,7 +1288,7 @@ end;
|
||||
|
||||
{==============================================================================}
|
||||
|
||||
function ReplaceString(Value, Search, Replace: string): string;
|
||||
function ReplaceString(Value, Search, Replace: AnsiString): AnsiString;
|
||||
var
|
||||
x, l, ls, lr: Integer;
|
||||
begin
|
||||
@ -1489,7 +1494,7 @@ end;
|
||||
{$IFNDEF CIL}
|
||||
function IncPoint(const p: pointer; Value: integer): pointer;
|
||||
begin
|
||||
Result := PChar(p) + Value;
|
||||
Result := PAnsiChar(p) + Value;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
@ -1664,7 +1669,7 @@ end;
|
||||
|
||||
function SwapBytes(Value: integer): integer;
|
||||
var
|
||||
s: string;
|
||||
s: AnsiString;
|
||||
x, y, xl, yl: Byte;
|
||||
begin
|
||||
s := CodeLongInt(Value);
|
||||
@ -1691,7 +1696,7 @@ begin
|
||||
Result := StringOf(Buf);
|
||||
{$ELSE}
|
||||
Setlength(Result, Len);
|
||||
x := Stream.read(Pchar(Result)^, Len);
|
||||
x := Stream.read(PAnsiChar(Result)^, Len);
|
||||
SetLength(Result, x);
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -1708,7 +1713,7 @@ begin
|
||||
buf := BytesOf(Value);
|
||||
Stream.Write(buf,length(Value));
|
||||
{$ELSE}
|
||||
Stream.Write(PChar(Value)^, Length(Value));
|
||||
Stream.Write(PAnsiChar(Value)^, Length(Value));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
34
tlntsend.pas
34
tlntsend.pas
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.002.001 |
|
||||
| Project : Ararat Synapse | 001.003.000 |
|
||||
|==============================================================================|
|
||||
| Content: TELNET and SSH2 client |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2007, Lukas Gebauer |
|
||||
| Copyright (c)1999-2008, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -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)2002-2007. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2002-2008. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -94,15 +94,15 @@ type
|
||||
TTelnetSend = class(TSynaClient)
|
||||
private
|
||||
FSock: TTCPBlockSocket;
|
||||
FBuffer: string;
|
||||
FBuffer: Ansistring;
|
||||
FState: TTelnetState;
|
||||
FSessionLog: string;
|
||||
FSubNeg: string;
|
||||
FSubType: char;
|
||||
FTermType: string;
|
||||
FSessionLog: Ansistring;
|
||||
FSubNeg: Ansistring;
|
||||
FSubType: Ansichar;
|
||||
FTermType: Ansistring;
|
||||
function Connect: Boolean;
|
||||
function Negotiate(const Buf: string): string;
|
||||
procedure FilterHook(Sender: TObject; var Value: string);
|
||||
function Negotiate(const Buf: Ansistring): Ansistring;
|
||||
procedure FilterHook(Sender: TObject; var Value: AnsiString);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -136,10 +136,10 @@ type
|
||||
|
||||
{:all readed datas in this session (from connect) is stored in this large
|
||||
string.}
|
||||
property SessionLog: string read FSessionLog write FSessionLog;
|
||||
property SessionLog: Ansistring read FSessionLog write FSessionLog;
|
||||
|
||||
{:Terminal type indentification. By default is 'SYNAPSE'.}
|
||||
property TermType: string read FTermType write FTermType;
|
||||
property TermType: Ansistring read FTermType write FTermType;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -190,18 +190,18 @@ begin
|
||||
Result := FSock.RecvTerminated(FTimeout, Value) <> '';
|
||||
end;
|
||||
|
||||
procedure TTelnetSend.FilterHook(Sender: TObject; var Value: string);
|
||||
procedure TTelnetSend.FilterHook(Sender: TObject; var Value: AnsiString);
|
||||
begin
|
||||
Value := Negotiate(Value);
|
||||
FSessionLog := FSessionLog + Value;
|
||||
end;
|
||||
|
||||
function TTelnetSend.Negotiate(const Buf: string): string;
|
||||
function TTelnetSend.Negotiate(const Buf: Ansistring): Ansistring;
|
||||
var
|
||||
n: integer;
|
||||
c: char;
|
||||
Reply: string;
|
||||
SubReply: string;
|
||||
c: Ansichar;
|
||||
Reply: Ansistring;
|
||||
SubReply: Ansistring;
|
||||
begin
|
||||
Result := '';
|
||||
for n := 1 to Length(Buf) do
|
||||
|
Loading…
Reference in New Issue
Block a user