



















by Jose Solares on Jun.01, 2005, under english, Linux
Note:This code expects to be using sockets blocking I/O request, to use non blocking I/O we should use libevent or a similar solution (like threads), this is outside of the scope of this code. It also assumes that we already have the server listening on a port and that we have already accepted a client connection `cliente_socket`. RCVBUFFER is 256.
char buffer[RCVBUFFER + 2]; buffer[RCVBUFFER] = 0; char response[] = {2,6,1,0,7,1,0,2,1,6,0x81}; int message_size,i,j; char counter = 0; if (( message_size = recv(client_socket, buffer, RCVBUFFER, 0)) < 0 ) err_handler ("recv() failed"); if ( message_size == 17 ) { if ( send(client_socket, response, 11, 0) != 11 ) err_handler ("send() failed"); } else { printf ( "- %d - \n", message_size ); err_handler ("Protocol Error"); } printf ("Starting...\n"); for (;;) { if (( message_size = recv(client_socket, buffer, RCVBUFFER, 0)) < 0 ) err_handler ("recv() failed"); if (message_size > 5 && bufer[0] == -128) counter = buffer[3]; i = (buffer[0] == -128)? 5 : 0; buffer[message_size + 1] = '\0'; buffer[message_size] = '\n'; //printf ("Capturing %d bytes\n",message_size); fprintf (stderr, "%s",&buffer[i]); //printf ("Current Counter : %d\n",counter); if (message_size == 1) { if (buffer[0] == 0x50) { char respond[] = {0x51}; if ( send (client_socket, respond, 1, 0) != 1) err_handler("send() failed"); } } else { i = message_size - 1; if (buffer[i-2] == 0x20 && buffer[i-1] == 0x0d && buffer[i] == 0x0a) { char respond[] = {0x40, 0x05, 0x01, ++counter, 0x81}; if ( send (client_socket, respond, 5, 0) != 5 ) err_handler("send() failed"); } } /* Do Something with the Data we received */ }
by Jose Solares on Jun.01, 2005, under english, Linux
As i didnt find any GNU/Linux Applications that could speak RDT and i had a need for a proyect at work, armed with ethereal and RDTT i did a reverse engineering of the packets captured, this is what i learned of RDT.
This Draft specifies a Server, see example code using this information here
When we start listening the RDT client sends us a 17 byte packet, albeit it has a distinct structure from other packets received, at no other time did i get a 17 byte packet in all the time i captured packets so i just send a response when i receive 17 bytes, in order to start receiving the data we want, we need to send back a response:
byte response[] = {2, 6, 1, 0, 7, 1, 0, 2, 1, 6, 0x81};
Just then do we start receiving the data:
We define a checksum-like number that the client expects to get back so it knows that we have indeed received the data :
( buffer[ 0 ] == -128 && msize > 5 )?buffer[ 3 ]:0; or ( buffer[ 0 ] == 0x80 && msize > 5 )?buffer[ 3 ]:0;
depending on the OS and data types you want to use
buffer is a char * where we store the data received with functions recv o read
msize is an int where recv/read return the quantity of data read
We send the above checksum when we get a `200d0a` at the end of a packet, using a char[]
{0x40, 0x05, 0x01, ++checksum, 0x81};
RDT has something similar to the ping on IRC, It periodically sends us a 1 byte packet with 0x50, expecting us to send a 1 byte packet with 0x51
I hope you find this information useful.
by Jose Solares on Mar.24, 2005, under english
This class works in VS.NET 2003, it can be modified to use a different kind of encryption, you would need to modify the constructor to change the type of encryption you wish to use.
by Jose Solares on Mar.24, 2005, under Asterisk, english
To use this application in asterisk you need to download it into the apps directory inside of the asterisk source, you also need to modify the Makefile in said directory so that waitforsound gets compiled as well, you might also find useful WaitForSilence, this application is included in the HEAD version of the asterisk cvs.
by Jose Solares on Mar.12, 2005, under english
Well i finally got around and added english as a language for the content on this page, thanks to the way textpattern is constructed it was fairly easy to accomplish this.
First we create a page for each section we want in the other language, in my case english. we can copy the original into a language specific page
Next we add the sections we want in english, like “contactus-en”, “default-en” and “archive-en”, this in part of the way i have my site setup, i have miscellaneous articles in archive, my contact info in contactus, and the main page in default.
We then modify our pages to translate everything we have in our original language (spanish) into english for our new content.
Then we create the content (articles) with the info we want in english, like the welcome intro but in english with section set to default-en, our articles we want in english in archive-en, our contact info translated in contactus-en.
Categorization is an entirely different beast that we wont be addressing now.
And thus we can add sections and pages for any language we want, all thanks to the flexibility of textpattern.
Use the form below to search the site:
Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!
All entries, chronologically...