[Vala] [PATCH] Add network ordering functions.



From 06313d583bbf083c26e4c543678006ab7b2720f1 Mon Sep 17 00:00:00 2001
From: Michael B. Trausch <mike trausch us>
Date: Wed, 8 Jul 2009 18:29:10 -0400
Subject: [PATCH] Add network ordering functions.

This commit adds the htonl, htons, ntohl, and ntohs functions to the
Posix namespace.

Signed-off-by: Michael B. Trausch <mike trausch us>
---
 vapi/posix.vapi |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/vapi/posix.vapi b/vapi/posix.vapi
index 113a2f6..82f0b67 100644
--- a/vapi/posix.vapi
+++ b/vapi/posix.vapi
@@ -1863,5 +1863,14 @@ namespace Posix {
        public void FD_ZERO (fd_set @set);
        [CCode (cheader_filename = "sys/select.h")]
        public int pselect (int nfds, fd_set? readfds, fd_set? writefds, fd_set? exceptfds, timespec timeout, 
sigset_t sigmask);
-}

+       // 16/32-bit network conversion functions (POSIX.1-2001)
+       [CCode (cheader_filename = "arpa/inet.h")]
+       uint32 htonl(uint32 host_long);
+       [CCode (cheader_filename = "arpa/inet.h")]
+       ushort htons(ushort host_short);
+       [CCode (cheader_filename = "arpa/inet.h")]
+       uint32 ntohl(uint32 net_long);
+       [CCode (cheader_filename = "arpa/inet.h")]
+       ushort ntohs(ushort net_short);
+}
--
1.6.0.4




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]