ALcune correzioni sparse, risistemati i commenti interni delle varie
[gapil.git] / sources / SockAddr.c
diff --git a/sources/SockAddr.c b/sources/SockAddr.c
new file mode 100644 (file)
index 0000000..9a585eb
--- /dev/null
@@ -0,0 +1,70 @@
+/* SockAddr.c
+ * 
+ * Copyright (C) 2004 Simone Piccardi
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/***************************************************************
+ *
+ * File SockAddr.c 
+ * Routines for socket address resolution. 
+ *
+ *
+ * Author: S. Piccardi
+ *
+ * $Id$
+ *
+ ***************************************************************/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>          /* standard I/O functions */
+#include <signal.h>         /* signal handling declarations */
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/socket.h>     /* socket function and declaration */
+#include <netdb.h>          /* resolver functions */
+
+
+#include "macros.h"
+/* *************************************************************************
+ *
+ *  Functions for socket address automatic resolution
+ *
+ * ************************************************************************* */
+/*
+ * Function tcp_socket
+ * Create and attach a SysV shared memory segment to the current process.
+ *
+ * First call get a shared memory segment with KEY key access and size SIZE,
+ * by creating it with R/W privilege for the user (this is the meaning of
+ * the ored flags). The function return an identifier shmid used for any 
+ * further reference to the shared memory segment. 
+ * Second call attach the shared memory segment to this process and return a
+ * pointer to it (of void * type). 
+ * Then initialize shared memory to the given value
+ *
+ * Input:  an host name
+ *         a service name
+ * Return: the IP address of the host in a sockaddr structure
+ */
+int tcp_addr(char * address, char * service, struct sockaddr * sa) 
+{
+    struct addrinfo hints;
+    
+
+    /* OK, exit */
+    return 0;
+}