Skulltag Archive

Hosted by Dark-Assassin

The default theme was not avalible in the backup, sorry.
View unanswered posts | View active topics It is currently Sat Aug 17, 2019 11:35 pm

Forum rules


Eruanna is in charge of skulltag.wad, so talk to her about including any contributions.

Remmirath is in charge of the maps, so talk to him about including or improving any maps.



Reply to topic  [ 5 posts ] 
IPv6 Concept 
Author Message
Developer

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 477
Location: Tennessee
Reply with quote
IPv6 Concept
Do not use this code. It works but it's written by me who knows barely anything about sockets. However, it could be looked at in the future for research and study.

Notes:
-The biggest headache I had while dealing with this was the NETADDRESS_s struct. It should be changed to store an IP address string. Stuff like this:
Code:
*(int *)&a->abIP = *(int *)&s->sin_addr;
just outright sucks not only because it doesn't work with sin6_addr, the way it's used throughout is terrible and over complicated. It should just be a simple string.

-Once you have a working IPv6 application, you can easily make it work with IPv4 as it uses the same commands as IPv6 does. Just use the struct sockaddr_storage and provide simple if/elseif statements to do the same functions.

-To specify a port when connecting to an IPv6 address, use a dash "-", instead of a colon ":".

Research Links for Converting IPv4 to IPv6:
Userlevel IPv6 Programming Introduction
Porting applications to IPv6 HowTo
Porting IPv4 applications to IPv6
Porting applications to IPv6: simple and easy! (PDF)
Jumping from IPv4 to IPv6


Sun Feb 19, 2012 5:51 am
Profile
Lead Developer

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 6037
Location: USA
Reply with quote
TIHan wrote:
It should be changed to store an IP address string. Stuff like this:
Code:
*(int *)&a->abIP = *(int *)&s->sin_addr;
just outright sucks not only because it doesn't work with sin6_addr, the way it's used throughout is terrible and over complicated. It should just be a simple string.

That's the most effective way to store an IPv4 address. Such an address is 4 bytes in size and is stored in a 4 byte data type there. Storing it as a string would need up to 5*3+1= 16 bytes, i.e. four times more memory than necessary. Just because you don't care about the memory waste here (and nowadays memory waste for a single IP address is no problem anymore), doesn't make this approach terrible. In fact, it's well thought out.

Anyway, if you don't want to deal with abIP directly just write two access functions to get and set it from a string. That would be the proper C++ approach to this and you don't even need to worry about how NETADDRESS_s stores the data internally anymore.


Sun Feb 19, 2012 6:53 am
Profile ICQ
Developer

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 477
Location: Tennessee
Reply with quote
Torr Samaho wrote:
Such an address is 4 bytes in size and is stored in a 4 byte data type there. Storing it as a string would need up to 5*3+1= 16 bytes, i.e. four times more memory than necessary. Just because you don't care about the memory waste here (and nowadays memory waste for a single IP address is no problem anymore), doesn't make this approach terrible. In fact, it's well thought out.


I understand your point. But, saving 12 bytes for less maintainability/readability may not be what is it really worth, then again probably doing some of this stuff is not meant to be readable. The benefit that I can see from it is that NETADDRESS_s doesn't need to know about the data types of the sockets in order to store them directly; which basically means it doesn't care how it stores data.


Sun Feb 19, 2012 2:11 pm
Profile
Developer

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 477
Location: Tennessee
Reply with quote
http://www.rfc-editor.org/rfc/rfc6540.txt

"
Given the global lack of available IPv4 space, and limitations in
IPv4 extension and transition technologies, this document advises
that IPv6 support is no longer considered optional. It also cautions
that there are places in existing IETF documents where the term "IP"
is used in a way that could be misunderstood by implementers as the
term "IP" becomes a generic that can mean IPv4 + IPv6, IPv6-only, or
IPv4-only, depending on context and application.
"


Fri Apr 13, 2012 1:47 pm
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 4534
Location: Fantastic Planet
Reply with quote
Oh snap. The time of IPv6 may very well be upon us. ;p


Fri Apr 13, 2012 3:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.