Re: [fpc-pascal] raw socket example
Here's an example: https://github.com/Laksen/fp-ethernet/blob/master/linuxraw.pas You need to change ifindex obviously, and I can't remember how that was found. But it should be relatively easy. On 11/18/2015 02:47 PM, Xiangrong Fang wrote: Hi, I am looking for some examples of writing linux raw socket programs in free pascal, anyone had experience on that? Thanks a lot! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] raw socket example
On Wed, Nov 18, 2015 at 12:45 PM, Daniel Gaspary wrote: > Need to change the fpsocket function call. > > > From fpSocket(AF_INET,SOCK_STREAM,0) > to fpSocket(AF_INET,SOCK_RAW,0); > > Is possible that the "0" needs to be changed too. > Just keep in mind that reading such socket is tricky. There's no more IP address (as shown in the example). The whole protocol stack needs to be handled manually. I don't think there's any publish FPC raw-socket example. The easiest way is to find C raw-socket example and port it to pascal. thanks, Dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] raw socket example
Need to change the fpsocket function call. >From fpSocket(AF_INET,SOCK_STREAM,0) to fpSocket(AF_INET,SOCK_RAW,0); Is possible that the "0" needs to be changed too. On Wed, Nov 18, 2015 at 3:20 PM, leledumbo wrote: > FPC docs has them: > http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html (server) > http://www.freepascal.org/docs-html/rtl/sockets/fpconnect.html (client) > > > > > -- > View this message in context: > http://free-pascal-general.1045716.n5.nabble.com/raw-socket-example-tp5723096p5723097.html > Sent from the Free Pascal - General mailing list archive at Nabble.com. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] raw socket example
FPC docs has them: http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html (server) http://www.freepascal.org/docs-html/rtl/sockets/fpconnect.html (client) -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/raw-socket-example-tp5723096p5723097.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] raw socket example
Hi, I am looking for some examples of writing linux raw socket programs in free pascal, anyone had experience on that? Thanks a lot! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OpenSSL
On 2015-11-18 13:32, Joost van der Sluis wrote: Op 18-11-15 om 08:00 schreef Torsten Bonde Christiansen: On 2015-11-17 18:25, Serguei TARASSOV wrote: On 17/11/2015 15:24, fpc-pascal-requ...@lists.freepascal.org wrote: In my program I need to use the OpenSSL unit from fpc (packages/openssl) AND I also need to use the lNET package. However my problem is that lNET also include a file named openssl.pas, although it seems to be never that the one included in packages it does not have the same methods included. So wheneven I include OpenSSL as a unit in my program it ALWAYS refer to the one in lNET, presumable because it is a package - how do I avoid this and instead use/refer to the fpc one? As Michael wrote it is not possible without unit renaming because there is no notion of package in compiler. The proper solution is to compile lNET package as a library (static library doesn't supported AFAIK but DLL is ok). Then write a small wrapper to import some types, classes, and functions and use DLL with shared memory. If you're required a really large interface of this package and then large wrapper to write, you should better decompose your application to compile some part as DLL with lNET package only. Thank you for your suggestion - but to be honest I think the easiest way for me is going to be: Use Lazarus to rename the OpenSSL unit from lnet, which hopefully renames all reference within the package itself. But where did you install lnet from in the first place? Just update to the latest version isn't that hard? I do not know which version you are using, but if it is a recent one, the rename of the openssl unit is the only change. ;) I've been using the one from here: http://svn.freepascal.org/svn/fpcprojects/lnet/tags/release_0_6_5 Btw: the openssl unit form lnet is exactly the same as the openssl unit in fpc. Maybe the trunk of lnet is updated, but otherwise there is actually a large difference in the two units. A whole lot of RSA/PEM and other certificate functions are not included in the lnet one. I made a quick diff of the two files (lnet vs. fpc opensl) and it is more than 100K bytes large... :) Regards, Torsten. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OpenSSL
On Wed, 18 Nov 2015, Joost van der Sluis wrote: Op 18-11-15 om 08:00 schreef Torsten Bonde Christiansen: On 2015-11-17 18:25, Serguei TARASSOV wrote: On 17/11/2015 15:24, fpc-pascal-requ...@lists.freepascal.org wrote: In my program I need to use the OpenSSL unit from fpc (packages/openssl) AND I also need to use the lNET package. However my problem is that lNET also include a file named openssl.pas, although it seems to be never that the one included in packages it does not have the same methods included. So wheneven I include OpenSSL as a unit in my program it ALWAYS refer to the one in lNET, presumable because it is a package - how do I avoid this and instead use/refer to the fpc one? As Michael wrote it is not possible without unit renaming because there is no notion of package in compiler. The proper solution is to compile lNET package as a library (static library doesn't supported AFAIK but DLL is ok). Then write a small wrapper to import some types, classes, and functions and use DLL with shared memory. If you're required a really large interface of this package and then large wrapper to write, you should better decompose your application to compile some part as DLL with lNET package only. Thank you for your suggestion - but to be honest I think the easiest way for me is going to be: Use Lazarus to rename the OpenSSL unit from lnet, which hopefully renames all reference within the package itself. But where did you install lnet from in the first place? Just update to the latest version isn't that hard? I do not know which version you are using, but if it is a recent one, the rename of the openssl unit is the only change. ;) Btw: the openssl unit form lnet is exactly the same as the openssl unit in fpc. if that is so, then why still distribute it with lnet ? Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OpenSSL
Op 18-11-15 om 08:00 schreef Torsten Bonde Christiansen: On 2015-11-17 18:25, Serguei TARASSOV wrote: On 17/11/2015 15:24, fpc-pascal-requ...@lists.freepascal.org wrote: In my program I need to use the OpenSSL unit from fpc (packages/openssl) AND I also need to use the lNET package. However my problem is that lNET also include a file named openssl.pas, although it seems to be never that the one included in packages it does not have the same methods included. So wheneven I include OpenSSL as a unit in my program it ALWAYS refer to the one in lNET, presumable because it is a package - how do I avoid this and instead use/refer to the fpc one? As Michael wrote it is not possible without unit renaming because there is no notion of package in compiler. The proper solution is to compile lNET package as a library (static library doesn't supported AFAIK but DLL is ok). Then write a small wrapper to import some types, classes, and functions and use DLL with shared memory. If you're required a really large interface of this package and then large wrapper to write, you should better decompose your application to compile some part as DLL with lNET package only. Thank you for your suggestion - but to be honest I think the easiest way for me is going to be: Use Lazarus to rename the OpenSSL unit from lnet, which hopefully renames all reference within the package itself. But where did you install lnet from in the first place? Just update to the latest version isn't that hard? I do not know which version you are using, but if it is a recent one, the rename of the openssl unit is the only change. ;) Btw: the openssl unit form lnet is exactly the same as the openssl unit in fpc. Joost. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal