[fpc-pascal] Documentation patch for fcl/netdb

2021-04-17 Thread Noel Duffy via fpc-pascal
I've added a documentation patch to bug 0037906 in the bug tracker. This covers the new code that I added to fcl/netdb for DNS resolution as well most of the other functions and procedures in the unit. The patch also adds examples that showcase the new functions. I've tested these on Fedora 32

Re: [fpc-pascal] Trouble integrating examples into fpcdoc

2021-04-05 Thread Noel Duffy via fpc-pascal
On 5/04/21 18:53, Michael Van Canneyt via fpc-pascal wrote: On Mon, 5 Apr 2021, Noel Duffy via fpc-pascal wrote: In the fpcdocs subversion project, there are a number of example directories each containing one or more small programs and a Makefile. My question is, is that Makefile

[fpc-pascal] Trouble integrating examples into fpcdoc

2021-04-04 Thread Noel Duffy via fpc-pascal
In the fpcdocs subversion project, there are a number of example directories each containing one or more small programs and a Makefile. My question is, is that Makefile automatically generated, or is it hand-crafted? I'm writing documentation for the netdb module and want to add some example

Re: [fpc-pascal] Patches for Issue #37906 - DNS over TCP

2021-01-30 Thread Noel Duffy via fpc-pascal
On 30/01/21 11:43 pm, Michael Van Canneyt via fpc-pascal wrote: On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: Lastly, a minor point: in the source for netdb.pp there's a comment warning of stringfromlabel's lack of checks. Since it now has a good few checks, I think th

Re: [fpc-pascal] Patches for Issue #37906 - DNS over TCP

2021-01-30 Thread Noel Duffy via fpc-pascal
On 30/01/21 9:45 pm, Michael Van Canneyt via fpc-pascal wrote: On Sat, 30 Jan 2021, Noel Duffy via fpc-pascal wrote: I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker: https://bugs.freepascal.org/view.php?id=37906 I've broken the changes into three p

[fpc-pascal] Patches for Issue #37906 - DNS over TCP

2021-01-29 Thread Noel Duffy via fpc-pascal
I've added patches to resolve issue #37906, DNS over TCP, to the bug tracker: https://bugs.freepascal.org/view.php?id=37906 I've broken the changes into three patches: 1. netdb.patch, which updates packages/fcl-net/src/netdb.pp, adding support for DNS over TCP 2. netdb-example.patch, which add

Re: [fpc-pascal] Unit testing for RTL packages

2021-01-24 Thread Noel Duffy via fpc-pascal
On 24/01/21 11:53 pm, Sven Barth via fpc-pascal wrote: Am 24.01.2021 um 08:37 schrieb Noel Duffy via fpc-pascal: How should one go about adding unit tests to a package in the RTL? In many packages, for instance fcl-db, there is a tests folder with fpcunit units and programs in them, and

[fpc-pascal] Unit testing for RTL packages

2021-01-23 Thread Noel Duffy via fpc-pascal
How should one go about adding unit tests to a package in the RTL? In many packages, for instance fcl-db, there is a tests folder with fpcunit units and programs in them, and they're referenced in fpmake.pp as example programs, but these do not appear to be built or run during a standard build

Re: [fpc-pascal] FPDoc now with Markdown support

2021-01-02 Thread Noel Duffy via fpc-pascal
On 3/01/21 3:31 am, Michael Van Canneyt via fpc-pascal wrote: Hello ! I didn't make it quite in time for the new year, but still: The fpdoc engine (what is used to document the FPC & Lazarus units) is now capable of outputting the documentation in markdown. This can be used as input for mkdo

Re: [fpc-pascal] netdb, TCP, and DNS queries

2020-12-13 Thread Noel Duffy via fpc-pascal
On 7/12/20 11:29 am, Michael Van Canneyt via fpc-pascal wrote: On Mon, 7 Dec 2020, Noel Duffy via fpc-pascal wrote: All of these are in the new version as well. Perhaps I need to redo the changes against trunk to avoid confusion. Yes, please. Line 55 contains: {$if defined(android

Re: [fpc-pascal] netdb, TCP, and DNS queries

2020-12-06 Thread Noel Duffy via fpc-pascal
On 7/12/20 12:41 am, Michael Van Canneyt via fpc-pascal wrote: On Sun, 6 Dec 2020, Noel Duffy via fpc-pascal wrote: Hi all, Following up on the work I've being doing to add support for DNS queries over TCP to netdb and to add support for querying all of the standard resource types su

[fpc-pascal] netdb, TCP, and DNS queries

2020-12-05 Thread Noel Duffy via fpc-pascal
Hi all, Following up on the work I've being doing to add support for DNS queries over TCP to netdb and to add support for querying all of the standard resource types such as MX, SOA, TXT, NS, etc, I've added the proposed changes to a note in the Bugtracker: https://bugs.freepascal.org/view.ph

Re: [fpc-pascal] netdb, DNS and TCP

2020-10-12 Thread Noel Duffy via fpc-pascal
On 11/10/20 9:42 pm, Michael Van Canneyt via fpc-pascal wrote: On Sun, 11 Oct 2020, Noel Duffy via fpc-pascal wrote: To avoid that duplication, the code would need to use a dynamic buffer and fill it just before socket writing. The TCP variant would include its length field in the buffer

Re: [fpc-pascal] netdb, DNS and TCP

2020-10-12 Thread Noel Duffy via fpc-pascal
On 11/10/20 9:42 pm, Michael Van Canneyt via fpc-pascal wrote: On Sun, 11 Oct 2020, Noel Duffy via fpc-pascal wrote: To avoid that duplication, the code would need to use a dynamic buffer and fill it just before socket writing. The TCP variant would include its length field in the buffer

[fpc-pascal] netdb, DNS and TCP

2020-10-10 Thread Noel Duffy via fpc-pascal
Hi all, To keep track of the work I've been doing on DNS in netdb, I created bug #37906 in Mantis. https://bugs.freepascal.org/view.php?id=37906 I've attached to a note on that bug report a proof-of-concept version of netdb.pp and a small program that uses it to make text queries over TCP. Th

Re: [fpc-pascal] Buffer size for TCP DNS queries in netdb

2020-09-27 Thread Noel Duffy via fpc-pascal
On 26/09/20 9:07 pm, Michael Van Canneyt via fpc-pascal wrote: On Sat, 26 Sep 2020, Noel Duffy via fpc-pascal wrote: To restate the question, is 64k too much overhead for DNS queries? That overhead would be present on all queries, regardless of whether UDP or TCP was used. I would then

Re: [fpc-pascal] Buffer size for TCP DNS queries in netdb

2020-09-26 Thread Noel Duffy via fpc-pascal
On 26/09/20 9:07 pm, Michael Van Canneyt via fpc-pascal wrote: On Sat, 26 Sep 2020, Noel Duffy via fpc-pascal wrote: To restate the question, is 64k too much overhead for DNS queries? That overhead would be present on all queries, regardless of whether UDP or TCP was used. I would then

[fpc-pascal] Buffer size for TCP DNS queries in netdb

2020-09-26 Thread Noel Duffy via fpc-pascal
Hi all, I've spent some time this past couple of weeks reading through the DNS resolver code in netdb and poring over RFCs that specify the protocol with a view to adding support for additional resource record queries. Things like TXT, SOA, and so forth. I'm using netdb from fpc 3.2.0 as the s

Re: [fpc-pascal] netdb and DNS queries for MX, TXT, and other resource types

2020-09-16 Thread Noel Duffy via fpc-pascal
On 16/09/20 8:43 pm, Michael Van Canneyt via fpc-pascal wrote: On Wed, 16 Sep 2020, Noel Duffy via fpc-pascal wrote: I'm in need of a library to perform DNS lookups for a range of different resource types such as MX, TXT, PTR and so on. At first I thought that netdb would do the job

[fpc-pascal] netdb and DNS queries for MX, TXT, and other resource types

2020-09-15 Thread Noel Duffy via fpc-pascal
I'm in need of a library to perform DNS lookups for a range of different resource types such as MX, TXT, PTR and so on. At first I thought that netdb would do the job, but it turns out that it only supports direct A and AAA lookups. However, the code actually has the ability to query all resour

Re: [fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations

2020-05-16 Thread Noel Duffy via fpc-pascal
On 17/05/20 3:00 am, Michael Van Canneyt wrote: On Sat, 16 May 2020, Michael Van Canneyt wrote: On Sat, 16 May 2020, Jonas Maebe wrote: On 15/05/2020 12:39, Noel Duffy via fpc-pascal wrote: While doing some work on bug 37060, the refactoring of StrToHostAddr and StrToHostAddr6 in the

Re: [fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations

2020-05-16 Thread Noel Duffy via fpc-pascal
On 17/05/20 1:21 am, Jonas Maebe wrote: On 15/05/2020 12:39, Noel Duffy via fpc-pascal wrote: While doing some work on bug 37060, the refactoring of StrToHostAddr and StrToHostAddr6 in the sockets unit,(https://bugs.freepascal.org/view.php?id=37060), I found that StrToHostAddr is doing no

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-15 Thread Noel Duffy via fpc-pascal
Per discussions, I've posted a proposed patch on bug 37060 https://bugs.freepascal.org/view.php?id=37060 I've also attached a test program that exercises the new functions. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.free

Re: [fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations

2020-05-15 Thread Noel Duffy via fpc-pascal
On 15/05/20 11:25 pm, Michael Van Canneyt wrote: On Fri, 15 May 2020, Noel Duffy via fpc-pascal wrote: That must be a new record in bug fix speed. You fixed that within ten minutes of my message to the list! I forgot to mention in my message, but did mention in the bug report, that

Re: [fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations

2020-05-15 Thread Noel Duffy via fpc-pascal
On 15/05/20 10:48 pm, Michael Van Canneyt wrote: On Fri, 15 May 2020, Noel Duffy via fpc-pascal wrote: While doing some work on bug 37060, the refactoring of StrToHostAddr and StrToHostAddr6 in the sockets unit,(https://bugs.freepascal.org/view.php?id=37060), I found that StrToHostAddr is

[fpc-pascal] Bug 37080 -- StrToHostAddr accepts all Pascal number notations

2020-05-15 Thread Noel Duffy via fpc-pascal
While doing some work on bug 37060, the refactoring of StrToHostAddr and StrToHostAddr6 in the sockets unit,(https://bugs.freepascal.org/view.php?id=37060), I found that StrToHostAddr is doing no validation at all on input address characters before calling the function Val, so any Pascal notati

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 14/05/20 12:36 am, Michael Van Canneyt wrote: On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 9:24 pm, Bart via fpc-pascal wrote: On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal As I've already learned the hard way, the sockets unit is compiled in

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 9:24 pm, Bart via fpc-pascal wrote: On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal As I've already learned the hard way, the sockets unit is compiled in "fpc" mode, so there's no "out" parameters. Otherwise I would definitely have used on

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 8:36 pm, Michael Van Canneyt wrote: On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 7:26 pm, Michael Van Canneyt wrote: BTW, I didn't see an obvious way within Mantis to link one bug to another, or to indicate any kind of relationship. Is this pos

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 6:41 pm, Marc Weustink via fpc-pascal wrote: On 12-5-2020 14:56, Marco van de Voort wrote: Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: I'm all for it, but please use the following names: function TryStrToHostAddr(IP: String; var ip4: in_addr): Boolean; function TryStrTo

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 7:26 pm, Michael Van Canneyt wrote: Always a new issue for new changes. Makes it easier to track where something went wrong if something is wrong. Done. https://bugs.freepascal.org/view.php?id=37060 I will try to get a patch ready for this in the next couple of days. BTW, I didn

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
On 12/05/20 10:32 pm, Michael Van Canneyt wrote:> On Tue, 12 May 2020, Noel Duffy via fpc-pascal wrote:>>>> A simple solution is to add functions to the sockets unit which accep a var record into which the output will be written and which return a boolean to indicate success

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
On 13/05/20 12:56 am, Marco van de Voort wrote: Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: The names I use here are the libc names, which many other languages also use. Now, StrToHostAddr and StrToHostAddr6 can call the appropriate function, and programs that use those functions w

[fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
While working with StrToHostAddr and StrToHostAddr6 over the past couple of weeks I've run into issues caused by the functions returning all zero addresses to indicate errors. All-zero addresses are technically valid according to the RFCs, so an all-zero address shouldn't be used as an error se

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
I've submitted a test program and proposed patch to fix the IPv6 parsing issues with StrToHostAddr6. https://bugs.freepascal.org/view.php?id=37013 Because I only checked out the packages and rtl directories from Subversion, my patch's root directory is packages. I hope this isn't a problem, b

Re: [fpc-pascal] Compiler mode for code in rtl and rtl-extra

2020-05-11 Thread Noel Duffy via fpc-pascal
On 11/05/20 7:29 pm, Michael Van Canneyt wrote: On Mon, 11 May 2020, Noel Duffy via fpc-pascal wrote: Example error messages: sockets.inc(497,5) Error: Identifier not found "Result" sockets.inc(510,53) Fatal: Syntax error, ":" expected but "identifier RES&quo

[fpc-pascal] Compiler mode for code in rtl and rtl-extra

2020-05-10 Thread Noel Duffy via fpc-pascal
I've been beavering away at a fix for https://bugs.freepascal.org/view.php?id=37013 and I've run into something unexpected. When I try to build rtl-extra with my proposed patch applied, I get compiler errors for things like the use of result variables and var/out variables. I'm so used to these

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-07 Thread Noel Duffy via fpc-pascal
On 7/05/20 9:43 pm, Michael Van Canneyt wrote: On Thu, 7 May 2020, Noel Duffy via fpc-pascal wrote: Well, considering the amount of RFCs I implemented for FPC, I think I'll join you. Let me know what golf course you picked. If your email address is any indication, new zealand is a bit fa

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-07 Thread Noel Duffy via fpc-pascal
On 7/05/20 9:17 pm, Michael Van Canneyt wrote: On Thu, 7 May 2020, Noel Duffy via fpc-pascal wrote: Great. My worry was that the sockets unit might fall into the same category as the libc one, available but deprecated and not recommended for use. Plus, when rewriting something that's

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-07 Thread Noel Duffy via fpc-pascal
On 6/05/20 11:40 pm, Karoly Balogh (Charlie/SGR) wrote: As much as we use the compiler and associated libraries ourselves, we can't cover every use case, or find every bug. A lot of packages are there for completeness, or because someone submitted it, or for compatibility with Delphi, not becaus

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-07 Thread Noel Duffy via fpc-pascal
On 6/05/20 11:21 pm, Christo Crause via fpc-pascal wrote: > On Wed, May 6, 2020 at 12:19 PM Noel Duffy via fpc-pascal > <mailto:fpc-pascal@lists.freepascal.org>> > wrote: > > So I guess the question is, is it worth the effort to make > StrToHostAddr6 RFC4291 c

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-06 Thread Noel Duffy via fpc-pascal
On 3/05/20 10:28 pm, Michael Van Canneyt wrote: On Sun, 3 May 2020, Noel Duffy via fpc-pascal wrote: On Sun, 3 May 2020 09:57:46 +0200 (CEST) Michael Van Canneyt wrote: Yes, please open a bug report. If you attach a small console test program that demonstrates the bug (and subsequently

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-03 Thread Noel Duffy via fpc-pascal
On 3/05/20 10:28 pm, Michael Van Canneyt wrote: Yes, please open a bug report. If you attach a small console test program that demonstrates the bug (and subsequently the fix) then I will make sure it ends up in the correct place. If you make sure it exits with exit code 0 if all is well, an

Re: [fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-03 Thread Noel Duffy via fpc-pascal
On Sun, 3 May 2020 09:57:46 +0200 (CEST) Michael Van Canneyt wrote: On Sun, 3 May 2020, Noel Duffy via fpc-pascal wrote: The problem is that the StrToHostAddr6 function doesn't set its return value until the end of the function. If a parse error occurs mid-function, it zeroes the reco

[fpc-pascal] Bugs in StrToHostAddr6 in sockets unit

2020-05-03 Thread Noel Duffy via fpc-pascal
Using fpc 3.0.4 on Fedora 30. I've just started using the StrToHostAddr6 function in the sockets unit to parse IPv6 addresses. I've found a couple of issues with it. 1. Even if address parsing fails, StrToHostAddr6 doesn't return an all-zero result in the in6_addr return value. The documentat

Re: [fpc-pascal] StrToHostAddr in sockets unit accepts negative octets

2020-04-21 Thread Noel Duffy via fpc-pascal
On 20/04/20 7:41 pm, Karoly Balogh (Charlie/SGR) wrote: Hi, On Mon, 20 Apr 2020, Noel Duffy via fpc-pascal wrote: I have already fixed it, with a simplistic fix, I think. Committed as SVN r44845. Great, good to know it's fixed. Not having the SVN repo to hand, I can't tell how r

Re: [fpc-pascal] StrToHostAddr in sockets unit accepts negative octets

2020-04-19 Thread Noel Duffy via fpc-pascal
On 19/04/20 11:48 pm, Karoly Balogh (Charlie/SGR) wrote: Hi, On Sun, 19 Apr 2020, Michael Van Canneyt wrote: The StrToHostAddr function in the sockets unit accepts negative octets in the source ip address. Consider this program: This should indeed be ckecked. Please report this in the bugtra

[fpc-pascal] StrToHostAddr in sockets unit accepts negative octets

2020-04-19 Thread Noel Duffy via fpc-pascal
Running fpc 3.0.4 on Fedora 30. The StrToHostAddr function in the sockets unit accepts negative octets in the source ip address. Consider this program: program ip4_neg; {$mode objfpc}{$H+} uses sockets; var ip4_addr: in_addr; begin ip4_addr := StrToHostAddr('172.-16.32.14'); if ip4_ad

Re: [fpc-pascal] Ncurses unit and newer releases of ncurses

2020-03-31 Thread Noel Duffy via fpc-pascal
On 30/03/20 8:17 pm, Michael Van Canneyt wrote: On Sun, 29 Mar 2020, Noel Duffy via fpc-pascal wrote: Running fpc 3.0.4 on Fedora 30. The ncurses unit is based on version 5.6 of ncurses, according to constants defined in the source. The upstream ncurses is now at 6.2, and I wondered if

[fpc-pascal] Ncurses unit and newer releases of ncurses

2020-03-29 Thread Noel Duffy via fpc-pascal
Running fpc 3.0.4 on Fedora 30. The ncurses unit is based on version 5.6 of ncurses, according to constants defined in the source. The upstream ncurses is now at 6.2, and I wondered if there are plans afoot to upgrade the ncurses unit to support a more recent ncurses version. Newer releases su

[fpc-pascal] IStreamPersist - how is it used?

2015-10-30 Thread Noel Duffy
I'm currently looking into ways to write all the objects in my application to a stream. I don't expect to have more than one or two hundred objects, so a fully-fledged framework like tiOPF seems like overkill. I am trying to find out what the RTL offers to solve this kind of problem. I came ac

Re: [fpc-pascal] Is it possible to specialize a generic class more than once, with different types, in the same unit?

2014-11-17 Thread Noel Duffy
On Sun, 16 Nov 2014 11:06:09 -0300, silvioprog wrote: > On Sat, Nov 15, 2014 at 5:10 AM, Noel Duffy > wrote: > > >> I am running fpc 2.6.4 on Debian stable and on Fedora 20, and both >> display the same behaviour. > > > Compiled like a charm in FPC 2.7.1 fro

[fpc-pascal] Is it possible to specialize a generic class more than once, with different types, in the same unit?

2014-11-16 Thread Noel Duffy
I just started investigating the generics classes in fcl-stl for a program that I'm writing. I haven't written anything using generics in Free Pascal before, so this is all new to me. I am trying to specialize THashMap to map both strings to unsigned integers and then again to map integers back to