PDA

Click to See Complete Forum and Search --> : Your own protocol?


made_of_asp
Oct 19th, 2002, 12:14 AM
Hi :)

Does anyone know how are protocols created (TCP/IP, UDP)? How would you create your own protocol? Like your own winsock.dll?

parksie
Oct 19th, 2002, 05:58 AM
A lot of protocols are "layered", for example they use other protocols in their own way. Take HTTP. It uses the HTTP protocol, which is on top of TCP (to hold up the connection) which is on top of IP (to actually route the packets). Similarly, UDP is also based on IP (datagrams).

But there's no reason why you can't design your own protocol. There should be an RFC for TCP/IP, and I expect there are design documents available for NetBEUI, IPX/SPX, whatever :)

made_of_asp
Oct 19th, 2002, 07:21 AM
Thanks for your reply Parksie :)

I know that they are layered, but how would i send RAW data? Would i need to write a driver for that or something like that?

parksie
Oct 19th, 2002, 07:41 AM
Yes. How, I have no idea :D (never tried writing a transport protocol)

CornedBee
Oct 19th, 2002, 10:27 AM
Most new protocols are very high-level, based on top of either UDP or TCP. Lower protocols are far harder to work with: replace UDP or TCP and you'll have a hard time getting computers to accept it (you need to write low-level software that gets it) and firewalls letting it through. Replace IP and you probably need to adjust all nodes on the network connection to handle it, which means you can't use it on the internet but only on a local network.

7th layer protocols are created by many internet apps: DirectPlay has it's own, most games that don't use DirectPlay (like Blizzard Games Starcraft, Diablo 1/2, Warcraft, C&C1234, ...) have their own. Just don't expect them to get widely accepted.

Morphine
Nov 1st, 2002, 11:22 AM
If you're looking to send out RAW data then you can try using windows RAW sockets. The problem with them is that they're not totally RAW.

It depends on what exactly you want to do... I wrote a program that bastardizes the ARP protocol which provides a mapping between IP addresses and MAC addresses to allow a win2k box to act as a switch/router.... more like a layer2/3 switch but anyway.... to do this I needed to send out ARP broadcast packets, which are NOT sent to ANY IP address, and are instead sent to the MAC address of ff:ff:ff:ff:ff:ff ... the RAW socket functionality that windows provides WILL NOT let you send a raw packet with no destination IP address (in other words, if the packet is not meant to go through a router then windows cannot send it).... The way to get around this is to use the pcap library. You get a handle to the interface and create a packet (containing nothing but 0x69 if you like....) and call

pcap_sendpacket( )

and it throws it on the wire.... .. . where it gets ignored by all the devices that won't understand it...

either way, check out

pcap library (http://winpcap.polito.it/)

parksie
Nov 1st, 2002, 11:25 AM
You should never need raw sockets like that ;)

In fact, it's impossible to do as non-root on a Unix system...

Morphine
Nov 3rd, 2002, 08:16 PM
it depends, in our case we'd be taking something encapsulated in http and decapsulating it, and then sending it to its intended destination.... . . to do this, we can either maintain our own ARP tables, or use raw sockets and let the kernel handle the address resolution. We were basically creating an http tunnel, but getting the two windows 2000 boxen to automagically route traffic across the internet, and then make it appear as if it came from the local subnet....