www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why the lack of networky bits in the standard library

reply Matthew Caron <matt.caron redlion.net> writes:
In C, if I want to parse a UDP packet, I need to build my own offsets 
into data based off constants in:
net/ethernet.h
netinet/udp.h

Things like:

#define PACKET_DATA_OFFSET_DEFAULT (
      ETHER_HDR_LEN + sizeof(struct iphdr) + \
      sizeof(struct udphdr))

That would be easy to port to D, if I had access to those structs and 
defines, but it doesn't seem like these have been ported over. Am I 
missing something obvious?

Thanks.

-- 
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518) 877-5173 x138 office
Dec 10 2012
parent =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
On 10-12-2012 21:22, Matthew Caron wrote:
 In C, if I want to parse a UDP packet, I need to build my own offsets
 into data based off constants in:
 net/ethernet.h
 netinet/udp.h

 Things like:

 #define PACKET_DATA_OFFSET_DEFAULT (
       ETHER_HDR_LEN + sizeof(struct iphdr) + \
       sizeof(struct udphdr))

 That would be easy to port to D, if I had access to those structs and
 defines, but it doesn't seem like these have been ported over. Am I
 missing something obvious?

 Thanks.

We haven't bound all C/POSIX headers in druntime yet. There's no particular reason it isn't done other than nobody having gotten around to it. -- Alex Rønne Petersen alex lycus.org http://lycus.org
Dec 10 2012