r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

Graham
29-Jan-2010
[1939]
Where's the video codec you did??
eFishAnt
29-Jan-2010
[1940]
I need to port it to the latest R3.  There was a point where the 
GC got changed and the real-time performance went crazy, and I want 
to blend it into the new architecture...so I don't want to put out 
something that requires an old R3 alpha...and the dialect is not 
100% clean...guess I'm being kind of a Carl here...not ready for 
prime-time yet.
BrianH
29-Jan-2010
[1941]
This is the best place we have now to discuss SSL on R3.
Andreas
29-Jan-2010
[1942x2]
Fine with me
How would I implement a ssl:// port scheme in the hostkit, that behaves 
just as tcp:// does, but allowing me to hook the native actors (open, 
mainly)
BrianH
29-Jan-2010
[1944]
The tcp:// scheme is defined in the host kit, as are all native schemes.
Andreas
29-Jan-2010
[1945x2]
no, only the tcp device is defined in the hostkit
how the device is wired up to the tcp:// scheme, is somewhere else
BrianH
29-Jan-2010
[1947]
That's all you need. The scheme is a stub.
Andreas
29-Jan-2010
[1948x2]
And where is that stub?
How is it wired to the tcp device?
BrianH
29-Jan-2010
[1950x2]
Just a few lines of mezz code in mezz-ports.r
make-scheme [
	title: "TCP Networking"
	name: 'tcp
	spec: system/standard/port-spec-net
	info: system/standard/net-info ; for C enums
	awake: func [event] [print ['TCP-event event/type] true]
]
Andreas
29-Jan-2010
[1952x2]
ok
How does this connect to the hostkit device?
BrianH
29-Jan-2010
[1954]
If I knew how to do this, it would be done already. Learning how 
is on my todo list, but I'm hoping someone else (like you) gets to 
it first.
Andreas
29-Jan-2010
[1955x3]
hehe
fair enough :)
I know that we have a array in host-device.c that lists all devices
BrianH
29-Jan-2010
[1958]
I only know that it can be done, not how (yet).
Andreas
29-Jan-2010
[1959x2]
I doubt that it can be done without changes to one of the binary 
blobs
I assume that somewhere there is a mapping between indices into this 
array to names like 'tcp
Steeve
29-Jan-2010
[1961]
maybe including a row device allowing to build our own datagrams 
would be the best :-)
Andreas
29-Jan-2010
[1962x2]
in reb-device.h we have an enum for those indices
RDI_NET is the index for the tcp port device
BrianH
29-Jan-2010
[1964]
Not assuming that yet. All you have to do is say that you are taking 
charge of R3 SSL and you will get all the help you need. I would 
suggest using the Putty SSL code as a start because it's small and 
license compatible (i.e. not a GPL derivative).
Graham
29-Jan-2010
[1965]
Hmm... Andreas already volunteered to do the Arm port ...and had 
no reply.
Andreas
29-Jan-2010
[1966x4]
And I posted the ready-to-be-merged changes for dll loading on Linux, 
no reply there
I'd be happy to give SSL a go, to get something to experiment with
The main information I miss for now, is how to wire up a device defined 
in the hostkit
And from all I can see, that is for now somewhere hidden in libr3.so
Cyphre
1-Feb-2010
[1970]
Andreas, yes, looks like the symbol table for devices is inside the 
.so for now.  But if you are really impatient, I think it would be 
possible to override for example 'clipboard device  and 'turn' it 
into sll port?
ChristianE
17-Feb-2010
[1971]
I'm lost in current somewhat fragmented documentation on asynchronous 
networking. Does anyone happen to know of an example somewhere on 
how to do a http request and meanwhile displaying a progress bar 
or just print some progress info to the console? I know I have to 
use a AWAKE handler, but I just don't grasp what to do therein.


Let's say I want to PRIN "." to the console (or draw something to 
the GUI) every 0.25 secs the http request is taking . Are there any 
docs out there on how to accomplish something like that?
Graham
17-Feb-2010
[1972x4]
You would have to modify the existing awake handler to print.

I don't think you can display a progress bar as the only way to update 
the GUI is by creating a GUI event, and that is not documented yet.
So, in this example of sending a fax http://rebol.wik.is/Rebol3/R3_GUI/Sendfax.r


the net-log function is altered to update the GUI ... but in fact 
nothing happens until all the network actiivty ceases.
In R2 you'd do a wait to allow the GUI to update ... but you can't 
do a wait inside a wait
The http protocol lacks any net-log or debugging so could write one 
and insert it into the awake handler ...
ChristianE
17-Feb-2010
[1976]
Thanks, Graham, your answer is appreciated. I was thinking along 
the lines of repeatedly waiting on an open http port for only a short 
while and on every loop iteration updating a busy indicator just 
to show that something is going on. Sounds like that's not possible, 
so I think I'll leave it as it is for now.
Gabriele
18-Feb-2010
[1977]
request-download shows a progress bar.
Graham
18-Feb-2010
[1978]
>> value? 'request-download
== false
ChristianE
18-Feb-2010
[1979]
Gabriele, it seems as if that REQUEST-DOWNLOAD has yet to find it's 
way into R3. Though on the other hand, it's seems very likely to 
me that you know about R3 resources I'm not aware of.
Henrik
18-Feb-2010
[1980x2]
if you can do a read and get the number of bytes read into a callback 
then you have the possibility of creating your own progress bar.
R2's read-thru does this.
ChristianE
18-Feb-2010
[1982]
Ok, Henrik, are you saying that theoretically it should be possible 
to adapt REQUEST-DOWNLOAD or alike to R3 with current R3/HTTP-scheme? 
If so, I'll have a go and study the source, it's just that I am not 
able to tell wether I just dont get it or if something is missing 
for now. Is it expected to be possible yet?
Henrik
18-Feb-2010
[1983]
I don't know if it's possible with the current R3/HTTP scheme.
ChristianE
18-Feb-2010
[1984]
Thanks, Henrik, anyway. I'll take Gabriele's answer for a "yes, it's 
possible" because he has written the scheme, so he would know for 
sure ;-) I'll study his protocol and the underlying TCP stuff deeper 
after the weekend.
Gabriele
19-Feb-2010
[1985x4]
ah, sorry guys, didn't notice this was a R3 group. hmm, it shoud 
in principle be even easier for R3, but i guess there are no examples 
to show...
starting from here: http://www.rebol.net/wiki/Scheme:_HTTP
what you want is the bottom of the page, "Lowest level: asynchronous 
operation"
you need basically to respond to 'connect and do a read, use 'read 
events to report progress, and use 'done to know when all the data 
is ready.