Index: tests/tsp_port/src/tsp_port_rpc_clnt.c
===================================================================
--- tests/tsp_port/src/tsp_port_rpc_clnt.c	(révision 0)
+++ tests/tsp_port/src/tsp_port_rpc_clnt.c	(révision 205)
@@ -0,0 +1,2 @@
+#include <rpc/rpc.h>
+#include "tsp_port_rpc.h"
Index: tests/tsp_port/src/test_port_rpc_svc.c
===================================================================
--- tests/tsp_port/src/test_port_rpc_svc.c	(révision 0)
+++ tests/tsp_port/src/test_port_rpc_svc.c	(révision 205)
@@ -0,0 +1,109 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "test_port_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef WIN32
+#include <rpc/pmap_clnt.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#else
+#include <winsock2.h>
+#include <rpc/pmap_cln.h>
+#endif
+#include <string.h>
+#include <memory.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+static void
+tsp_port_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+	union {
+		TSP_port_enum get_next_1_arg;
+		TSP_port_struct set_1_arg;
+	} argument;
+	char *result;
+	xdrproc_t _xdr_argument, _xdr_result;
+	char *(*local)(char *, struct svc_req *);
+
+	switch (rqstp->rq_proc) {
+	case NULLPROC:
+		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+		return;
+
+	case get_next:
+		_xdr_argument = (xdrproc_t) xdr_TSP_port_enum;
+		_xdr_result = (xdrproc_t) xdr_TSP_port_enum;
+		local = (char *(*)(char *, struct svc_req *)) get_next_1_svc;
+		break;
+
+	case get:
+		_xdr_argument = (xdrproc_t) xdr_void;
+		_xdr_result = (xdrproc_t) xdr_TSP_port_struct;
+		local = (char *(*)(char *, struct svc_req *)) get_1_svc;
+		break;
+
+	case set:
+		_xdr_argument = (xdrproc_t) xdr_TSP_port_struct;
+		_xdr_result = (xdrproc_t) xdr_int;
+		local = (char *(*)(char *, struct svc_req *)) set_1_svc;
+		break;
+
+	default:
+		svcerr_noproc (transp);
+		return;
+	}
+	memset ((char *)&argument, 0, sizeof (argument));
+	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+		svcerr_decode (transp);
+		return;
+	}
+	result = (*local)((char *)&argument, rqstp);
+	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
+		svcerr_systemerr (transp);
+	}
+	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+		fprintf (stderr, "%s", "unable to free arguments");
+		exit (1);
+	}
+	return;
+}
+
+int
+main (int argc, char **argv)
+{
+	register SVCXPRT *transp;
+
+	pmap_unset (TSP_PORT, TSP_PORT_VERS);
+
+	transp = svcudp_create(RPC_ANYSOCK);
+	if (transp == NULL) {
+		fprintf (stderr, "%s", "cannot create udp service.");
+		exit(1);
+	}
+	if (!svc_register(transp, TSP_PORT, TSP_PORT_VERS, tsp_port_1, IPPROTO_UDP)) {
+		fprintf (stderr, "%s", "unable to register (TSP_PORT, TSP_PORT_VERS, udp).");
+		exit(1);
+	}
+
+	transp = svctcp_create(RPC_ANYSOCK, 0, 0);
+	if (transp == NULL) {
+		fprintf (stderr, "%s", "cannot create tcp service.");
+		exit(1);
+	}
+	if (!svc_register(transp, TSP_PORT, TSP_PORT_VERS, tsp_port_1, IPPROTO_TCP)) {
+		fprintf (stderr, "%s", "unable to register (TSP_PORT, TSP_PORT_VERS, tcp).");
+		exit(1);
+	}
+
+	svc_run ();
+	fprintf (stderr, "%s", "svc_run returned");
+	exit (1);
+	/* NOTREACHED */
+}
Index: tests/tsp_port/src/test_port_rpc_xdr.c
===================================================================
--- tests/tsp_port/src/test_port_rpc_xdr.c	(révision 0)
+++ tests/tsp_port/src/test_port_rpc_xdr.c	(révision 205)
@@ -0,0 +1,31 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "test_port_rpc.h"
+
+typedef int int32_t;
+bool_t
+xdr_TSP_port_enum (XDR *xdrs, TSP_port_enum *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_TSP_port_struct (XDR *xdrs, TSP_port_struct *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_int (xdrs, &objp->i))
+		 return FALSE;
+	 if (!xdr_double (xdrs, &objp->a))
+		 return FALSE;
+	 if (!xdr_string (xdrs, &objp->status_str, ~0))
+		 return FALSE;
+	return TRUE;
+}
Index: tests/tsp_port/src/test_server.c
===================================================================
--- tests/tsp_port/src/test_server.c	(révision 0)
+++ tests/tsp_port/src/test_server.c	(révision 205)
@@ -0,0 +1,23 @@
+// test.c : Defines the entry point for the console application.
+//
+
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#include "test_api.h"
+#include "test_rpc_server.h"
+
+int main(int argc, char* argv[])
+{
+    init_affichage(printf);
+    init_saisie(scanf);
+    
+    /* server main */
+    rpc_svc_main(argc, argv);
+
+	return 0;
+}
Index: tests/tsp_port/src/test_port_rpc_clnt.c
===================================================================
--- tests/tsp_port/src/test_port_rpc_clnt.c	(révision 0)
+++ tests/tsp_port/src/test_port_rpc_clnt.c	(révision 205)
@@ -0,0 +1,55 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "test_port_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+TSP_port_enum *
+get_next_1(TSP_port_enum *argp, CLIENT *clnt)
+{
+	static TSP_port_enum clnt_res;
+
+	memset((char *)&clnt_res, 0, sizeof(clnt_res));
+	if (clnt_call (clnt, get_next,
+		(xdrproc_t) xdr_TSP_port_enum, (caddr_t) argp,
+		(xdrproc_t) xdr_TSP_port_enum, (caddr_t) &clnt_res,
+		TIMEOUT) != RPC_SUCCESS) {
+		return (NULL);
+	}
+	return (&clnt_res);
+}
+
+TSP_port_struct *
+get_1(void *argp, CLIENT *clnt)
+{
+	static TSP_port_struct clnt_res;
+
+	memset((char *)&clnt_res, 0, sizeof(clnt_res));
+	if (clnt_call (clnt, get,
+		(xdrproc_t) xdr_void, (caddr_t) argp,
+		(xdrproc_t) xdr_TSP_port_struct, (caddr_t) &clnt_res,
+		TIMEOUT) != RPC_SUCCESS) {
+		return (NULL);
+	}
+	return (&clnt_res);
+}
+
+int *
+set_1(TSP_port_struct *argp, CLIENT *clnt)
+{
+	static int clnt_res;
+
+	memset((char *)&clnt_res, 0, sizeof(clnt_res));
+	if (clnt_call (clnt, set,
+		(xdrproc_t) xdr_TSP_port_struct, (caddr_t) argp,
+		(xdrproc_t) xdr_int, (caddr_t) &clnt_res,
+		TIMEOUT) != RPC_SUCCESS) {
+		return (NULL);
+	}
+	return (&clnt_res);
+}
Index: tests/tsp_port/src/test_api.c
===================================================================
--- tests/tsp_port/src/test_api.c	(révision 0)
+++ tests/tsp_port/src/test_api.c	(révision 205)
@@ -0,0 +1,349 @@
+// test.c : Defines the entry point for the console application.
+//
+
+#include <stdio.h>
+#include <assert.h>
+#include <pthread.h>
+#ifdef WIN32
+#  include <windows.h>
+#else
+#  include <netdb.h>
+#  include <string.h>
+#endif
+
+#include "test_api.h"
+#include "test_port_rpc.h"
+
+static pthread_mutex_t my_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static affiche_appli_fp affiche_appli = &printf;
+static saisie_appli_fp  saisie_appli  = &scanf;
+
+void init_affichage_argv(affiche_appli_fp function)
+{
+    affiche_appli = function;
+}
+
+void init_affichage(affiche_appli_fp function)
+{
+    affiche_appli = function;
+}
+
+void init_saisie(saisie_appli_fp function)
+{
+    saisie_appli = function;
+}
+
+int test_printf( char * format, ... )
+{
+   va_list args;
+   int len, iRet = -1;
+   char * buffer;
+
+   va_start( args, format );
+#ifdef WIN32
+   len = _vscprintf( format, args ) // _vscprintf doesn't count
+                               + 1; // terminating '\0'
+#else 
+   /* FIXME find a way to bound buffer length */
+   len = 1024;
+#endif
+   buffer = malloc( len * sizeof(char) );
+   vsprintf( buffer, format, args );
+    
+   if (NULL != affiche_appli)
+   {
+    iRet = affiche_appli( buffer );
+   }
+
+   fflush(stdout);
+   free( buffer );
+
+   return iRet;
+}
+
+int 
+test_scan_1_car( char * uncar ) {
+  int iRet = -1;
+  
+  fflush(stdin);
+   if (NULL != saisie_appli)
+   {
+    iRet = saisie_appli( "%c", uncar );
+   }
+
+   return iRet;
+}
+
+typedef struct wrapper_s
+{
+    int id;
+} wrapper_t;
+
+#if 0
+void affiche_boite()
+{ 
+  HWND parent; 
+  parent = GetDesktopWindow(); 
+  MessageBox(parent, "Ca marche", "Ca marche", MB_OKCANCEL); 
+} 
+#endif
+
+int tsp_usleep(int useconds)
+{
+
+#ifdef TSP_SYSTEM_HAVE_NANOSLEEP
+  struct timespec ts;
+  ts.tv_sec = useconds / 1000000;
+  ts.tv_nsec = (useconds % 1000000) * 1000;
+  return nanosleep(&ts, NULL);
+#else
+
+#ifdef TSP_SYSTEM_HAVE_THREADSAFE_USLEEP
+  return usleep(useconds);
+#else
+
+#ifdef TSP_SYSTEM_USE_WIN32_SLEEP
+  Sleep(useconds * 1000);
+  return 0;
+#else
+  ERROR__you_should_try_to_find_some_kind_of_wait_function
+#endif /*TSP_SYSTEM_HAVE_SLEEP*/
+
+#endif /*TSP_SYSTEM_HAVE_THREADSAFE_USLEEP*/
+
+#endif /*TSP_SYSTEM_HAVE_NANOSLEEP*/
+
+}
+
+/* The wrapper function in charge for setting the itimer value */
+static void * wrapper_routine(void * data)
+{
+    int i;
+    int id;
+    wrapper_t * wrapper_data = (wrapper_t *)data;    
+    
+    id = wrapper_data->id;
+     
+    // synchro de thread par mutex
+    for(i=0; i<10; i++)
+    {
+        pthread_mutex_lock(&my_mutex);
+        test_printf("%d", id);        
+        pthread_mutex_unlock(&my_mutex);
+        tsp_usleep(id*2);
+    }
+
+    test_printf("\n"); 
+
+    return NULL;
+}
+
+void printstruct(char * mes, void * arg)
+{
+	TSP_port_struct *val = (TSP_port_struct *)arg;
+    if (NULL == val)
+    {
+        test_printf("%s valeur nulle\n", mes);
+    }
+    else
+    {
+        test_printf("%s %d %f %s\n", mes, val->i, val->a, val->status_str);
+    }
+}
+
+char* stringtosend()
+{
+    char *tosend;
+    tosend = (char *)malloc(sizeof(char)*DEFAULT_BUFLEN);
+    tosend = strdup("this is a test");
+    return tosend;
+}
+
+int teststringrecu(char * recu)
+{
+    return strcmp(recu, stringtosend());
+}
+
+void test_gethostx()
+{
+    // header : WinSock2.h
+    // library : Ws2_32.lib
+    // DLL : Ws2_32.dll
+    // vient de oncrpc recompiler avec
+
+    char             name[1024];
+    struct hostent*  myhost;
+    struct hostent*  myhost_byaddr;
+    union {
+        u_int       addr;
+        u_short     parts[4];
+    } myu;
+    char* host;
+    char* last; /**<For strtok_r*/
+
+    gethostname(name,1024);
+    test_printf("hostname is  <%s> (as reported by gethostname)\n",name);
+    myhost = gethostbyname(name);
+
+    if (myhost == NULL) {
+        fprintf(stderr,"Cannot 'gethostbyname (hostname --> @IP)' check your /etc/hosts file.\n");
+        return ;
+    }
+    memset((char *)&myu, 0, sizeof(myu));
+    myu.addr = (u_int)ntohl(*((u_int*)myhost->h_addr_list[0]));
+    test_printf("@IP returned is <%d.%d.%d.%d> <addrtype= %s> (as reported by gethostbyname)\n",
+	    myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0],
+	    (myhost->h_addrtype == AF_INET6 ?  "AF_INET6" : "AF_INET"));
+      
+    myhost_byaddr = gethostbyaddr(myhost->h_addr_list[0], myhost->h_length,myhost->h_addrtype);
+      
+    if (myhost_byaddr == NULL) {
+        fprintf(stderr, "Cannot 'gethostbyaddr (@IP --> hostname)' check your /etc/hosts file\n");
+        return ;
+    }
+    myu.addr = (u_int)ntohl(*((u_int*)myhost_byaddr->h_addr_list[0]));
+      
+    test_printf("hostname returned is <%s> for @IP <%d.%d.%d.%d> <addrtype= %s> (as reported by gethostbyaddr)\n",
+	    myhost_byaddr->h_name,
+	    myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0],
+	    (myhost_byaddr->h_addrtype == AF_INET6 ?  "AF_INET6" : "AF_INET"));
+
+    htonl(INADDR_ANY);
+    
+    host = strdup(name);
+    last = strstr(host, ".");
+    test_printf("strstr : %s\n", last);
+
+ /*   host = strtok_r((char* )name, ":", &last);
+    test_printf("strtok_r : %s", host);*/
+
+    last = strtok(host, ".");
+    test_printf("strtok : %s\n", last);
+
+}
+
+void test_memoire()
+{
+    char *val;
+    TSP_port_struct* ssi;
+    int* out_temp;
+    int i;    
+    
+    test_printf("test memoire\n");
+
+    val = (char *)malloc(sizeof(char)*5);
+    val[0]='0';
+    val[1]='1';
+    val[2]='2';
+    val[3]='3';
+    val[4]='\0';
+    test_printf("malloc %s\n", val);
+    free(val);
+    
+    ssi = calloc(1,sizeof(TSP_port_struct));
+    ssi->a = 1;
+    ssi->i = 2;    
+    ssi->status_str = "t";
+    test_printf("calloc %d %d %c\n", ssi->a, ssi->i, ssi->status_str); 
+    free(ssi);
+    
+#ifdef WIN32
+    out_temp = _alloca(sizeof(int)*4);
+#else
+    out_temp = alloca(sizeof(int)*4);
+#endif
+    out_temp[0] = 10;
+    out_temp[1] = 20;
+    out_temp[2] = 30;
+    out_temp[3] = 40;
+    test_printf("alloca : ");
+    for (i=0;i<4;i++)
+    {
+        test_printf("%d", out_temp[i]);
+    }
+    test_printf("\n");
+
+#ifdef WIN32
+    Sleep(1000);
+#else
+    sleep(1);
+#endif
+
+    test_printf("Fin test memoire\n");
+}
+
+void test_pthread()
+{
+    pthread_t threadid1, threadid2;
+    wrapper_t wrapper_data1, wrapper_data2;
+    struct timeval tp;
+
+    test_printf("test pthread");
+
+    assert(1);
+
+    // test pthread
+    wrapper_data1.id=1;
+    wrapper_data2.id=2;        
+    
+    pthread_create(&threadid1, NULL, &wrapper_routine,
+                                            &wrapper_data1);
+
+    pthread_create(&threadid2, NULL, &wrapper_routine,
+                                            &wrapper_data2);
+    
+    
+    test_printf("Joining thread 1\n");
+    pthread_join(threadid1, NULL);
+    test_printf("Joining thread 2\n");
+    pthread_join(threadid2, NULL);
+
+    test_printf("\n");        
+
+    /* Save memory ! */
+    //pthread_detach(pthread_self());
+    
+    //sigfillset(&s_mask);
+    //pthread_sigmask(SIG_BLOCK,&s_mask,NULL);
+
+    //pthread_cancel(thread);
+    
+    // header : WinSock.h
+    gettimeofday(&tp, (void*)NULL);
+    test_printf("gettimeofday %l %l\n", tp.tv_sec, tp.tv_usec);
+
+    //affiche_boite();
+
+    test_printf("Fin test pthread");
+}
+
+int api_main()
+{
+    char c;
+
+    test_printf(" 0 pour les test host,\n");
+    test_printf(" 1 pour les test memoire,\n");
+    test_printf(" 2 pour les test api,\n");
+    test_printf(" entrer une valeur : ");
+    
+    test_scan_1_car(&c);
+    
+    if ( '0' == c )
+    {
+        test_gethostx();
+    }
+
+    if ( '1' == c )
+    {
+        test_memoire();
+    }
+
+    if ( '2' == c )
+    {
+        test_pthread();
+    }
+    
+    test_printf("\nFin test api\n");
+	return 0;
+}
Index: tests/tsp_port/src/test_rpc_server.c
===================================================================
--- tests/tsp_port/src/test_rpc_server.c	(révision 0)
+++ tests/tsp_port/src/test_rpc_server.c	(révision 205)
@@ -0,0 +1,346 @@
+#include <stdio.h>
+#include <rpc/rpc.h>
+#include <pthread.h>
+#ifdef WIN32
+#  include <ws2tcpip.h>
+#  include "getopt.h" 
+#else
+#  include <unistd.h>
+#  include <sys/types.h>
+#  include <sys/socket.h>
+#  include <netdb.h>
+#endif
+#include "test_port_rpc.h"
+#include "test_api.h"
+#include "test_rpc_server.h"
+
+static int count = 1;
+static TSP_port_enum port_enum = TSP_port_e0;
+static TSP_port_struct port_struct = {0,0.0,NULL};
+
+TSP_port_enum   *get_next_1_svc(TSP_port_enum * val, struct svc_req *rqstp)
+{
+    switch (*val)
+    {
+    case TSP_port_e0 :
+        port_enum = TSP_port_e1;
+        break;
+    case TSP_port_e1 :
+        port_enum = TSP_port_e2;
+        break;
+    case TSP_port_e2 :
+        port_enum = TSP_port_e3;
+        break;
+    case TSP_port_e3 :
+        port_enum = TSP_port_e4;
+        break;
+    case TSP_port_e4 :
+        port_enum = TSP_port_e1;
+        break;
+    }
+    test_printf("get next called; result: %d\n", port_enum);
+    return &port_enum;
+}
+
+TSP_port_struct *
+get_1_svc(void *argp, struct svc_req *rqstp)
+{
+    TSP_port_struct * val = (TSP_port_struct *)argp;
+    test_printf("value in struct: %d %f %s\n", val->i, val->a, val->status_str);
+    port_struct.i = val->i + 1;
+    port_struct.a = val->a + 1.0;
+    if ( NULL == val->status_str )
+    {
+        if (NULL != port_struct.status_str)
+        {
+            free(port_struct.status_str);
+        }
+        port_struct.status_str = strdup("a");
+    }
+    else
+    {
+        if (NULL == port_struct.status_str)
+        {
+            port_struct.status_str = strdup("g");    
+        }
+        else
+        {
+            port_struct.status_str[0] = val->status_str[0] + 1;
+        }
+    }
+    printstruct("Get value struct : ", &port_struct);
+    return &port_struct;
+}
+int *
+set_1_svc(TSP_port_struct *val, struct svc_req *rqstp)
+{
+    port_struct.i = val->i;
+    port_struct.a = val->a;
+    if (port_struct.status_str != NULL)
+    {
+        free(port_struct.status_str);
+    }
+    if ( NULL == val->status_str )
+    {
+        port_struct.status_str = strdup("s"); 
+    }
+    else
+    {
+        port_struct.status_str = strdup(val->status_str);
+    }
+    printstruct("Set value struct : ", &port_struct);
+    return &count;
+}
+
+void main_rpc()
+{
+    main();
+    exit(0);
+}
+
+#ifndef WIN32
+    #define WSACleanup()
+    #define closesocket(x) close(x)
+    #define INVALID_SOCKET -1
+    #define SOCKET_ERROR -1
+    typedef int SOCKET;
+#endif
+
+int server_socket()
+{
+#ifdef WIN32
+    WSADATA wsaData;
+#endif
+    SOCKET ListenSocket = INVALID_SOCKET,
+           ClientSocket = INVALID_SOCKET;
+    
+    struct addrinfo *result = NULL,
+                    hints;
+    char recvbuf[DEFAULT_BUFLEN];
+    int  iResult,
+         recvbuflen = DEFAULT_BUFLEN,
+        offset;
+    
+    memset(&recvbuf[0], '\0', DEFAULT_BUFLEN);
+
+#if WIN32
+    // Initialize Winsock
+    iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+    if (iResult != 0) {
+        test_printf("WSAStartup failed: %d\n", iResult);
+        return 1;
+    }
+#endif
+
+    memset(&hints, 0, sizeof(hints));
+
+    hints.ai_family = AF_INET;
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_protocol = IPPROTO_TCP;
+    hints.ai_flags = AI_PASSIVE;
+
+    // Resolve the server address and port
+    iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result);
+    if ( iResult != 0 ) {
+        test_printf("getaddrinfo failed: %d\n", iResult);
+        WSACleanup();
+        return 1;
+    }
+
+    // Create a SOCKET for connecting to server
+    ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
+    if (ListenSocket == INVALID_SOCKET) {
+#ifdef WIN32
+        test_printf("socket failed: %ld\n", WSAGetLastError());
+#else
+	perror("socket");
+#endif
+        freeaddrinfo(result);
+        WSACleanup();
+        return 1;
+    }
+
+    // Setup the TCP listening socket
+    iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen);
+    if (iResult == SOCKET_ERROR) {
+#ifdef WIN32
+        test_printf("bind failed: %d\n", WSAGetLastError());
+#else
+	perror("bind");
+#endif
+        freeaddrinfo(result);
+        closesocket(ListenSocket);
+        WSACleanup();
+        return 1;
+    }
+
+    freeaddrinfo(result);
+
+    iResult = listen(ListenSocket, SOMAXCONN);
+    if (iResult == SOCKET_ERROR) {
+#ifdef WIN32
+        test_printf("listen failed: %d\n", WSAGetLastError());
+#else
+	perror("listen");
+#endif
+        closesocket(ListenSocket);
+        WSACleanup();
+        return 1;
+    }
+
+    // Accept a client socket
+    ClientSocket = accept(ListenSocket, NULL, NULL);
+    if (ClientSocket == INVALID_SOCKET) {
+#ifdef WIN32
+        test_printf("accept failed: %d\n", WSAGetLastError());
+#else
+	perror("accept");
+#endif
+        closesocket(ListenSocket);
+        WSACleanup();
+        return 1;
+    }
+
+    // No longer need server socket
+    closesocket(ListenSocket);
+    
+    // Receive until the peer shuts down the connection
+    offset = 0;
+    do {
+        iResult = recv(ClientSocket, &recvbuf[offset], recvbuflen, 0);
+        if (iResult > 0)
+        {
+            test_printf("Bytes <%s> received: %d\n", &recvbuf[offset], iResult);
+            offset += iResult;
+            if (0 == teststringrecu(recvbuf))
+            {
+                test_printf ("reception finished : %s\n", recvbuf);
+            }
+        }
+        else if (iResult == 0)
+        {
+            test_printf("Connection closing...\n");
+        }
+        else  
+        {
+#ifdef WIN32
+            test_printf("recv failed: %d\n", WSAGetLastError());
+#else
+	    perror("recv");
+#endif
+            closesocket(ClientSocket);
+            WSACleanup();
+            return 1;
+        }
+
+    } while (iResult > 0);
+
+    // Echo the buffer back to the sender
+    iResult = send( ClientSocket, recvbuf, strlen(recvbuf), 0 );
+    if (iResult == SOCKET_ERROR) {
+#ifdef WIN32
+        test_printf("send failed: %d\n", WSAGetLastError());
+#else
+	perror("send");
+#endif
+
+        closesocket(ClientSocket);
+        WSACleanup();
+        return 1;
+    }
+
+    test_printf("Bytes <%s> Sent: %ld\n", recvbuf, iResult);
+    
+#ifdef WIN32
+    // shutdown the connection since we're done
+    iResult = shutdown(ClientSocket, SD_SEND);
+    if (iResult == SOCKET_ERROR) {
+        test_printf("shutdown failed: %d\n", WSAGetLastError());
+        closesocket(ClientSocket);
+        WSACleanup();
+        return 1;
+    }
+#endif
+
+    // cleanup
+    closesocket(ClientSocket);
+    WSACleanup();
+
+    return 0;
+}
+
+void rpc_svc_main(int argc, char* argv[])
+{
+    /* Main options handling */
+    /*  char*   error_string;*/
+    int     opt_ok  = 1;
+    char    c_opt;
+    int    help     = 0;
+    int    test_api = 0;
+    int    test_rpc = 0;
+    int    test_sock = 0;
+    
+#ifdef WIN32
+    rpc_nt_init();
+#endif
+
+    /* Analyse command line parameters */
+    while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"ht:")))) {    
+        switch (c_opt) {
+            case 'h':
+                opt_ok++;
+                help = 1;                
+            break;
+            case 't':
+                opt_ok+=2;
+                if (0 == strcmp(optarg, "api")) {
+                    test_api = 1;
+                }
+                else if (0 == strcmp(optarg, "socket")) {
+                    test_sock = 1;
+                }
+                else if (0 == strcmp(optarg, "rpc")) {
+                    test_rpc = 1;
+                }
+                else {
+                    fprintf(stderr,"Invalid command line option(s), correct it and rerun\n");
+                    opt_ok = 0;
+                }
+            break;
+            case '?':
+                fprintf(stderr,"Invalid command line option(s), correct it and rerun\n");
+                opt_ok = 0;
+            break;
+            default:
+                opt_ok = 0;
+            break;
+        } /* end of switch */
+    } /* end of while */
+    
+    /* check if global options are OK */
+    if (opt_ok < 2) {
+        fprintf(stderr,"    -h help\n");
+        fprintf(stderr,"    -t [api][socket][rpc] launch corresponding test\n");
+    }
+    else
+    {
+        if (help) {
+            fprintf(stderr,"Command line option(s)\n");
+            fprintf(stderr,"    -h help\n");
+            fprintf(stderr,"    -t [api][socket][rpc] launch corresponding test\n");
+        }
+        if (test_api) {
+            api_main();
+        }        
+        if (test_rpc) {
+            main_rpc();
+        }
+        if (test_sock) {
+            server_socket();
+        }
+    }
+
+#ifdef WIN32
+    rpc_nt_exit();
+#endif
+}
Index: tests/tsp_port/src/test_port_rpc.x
===================================================================
--- tests/tsp_port/src/test_port_rpc.x	(révision 0)
+++ tests/tsp_port/src/test_port_rpc.x	(révision 205)
@@ -0,0 +1,22 @@
+enum TSP_port_enum {
+  TSP_port_e0,
+  TSP_port_e1,
+  TSP_port_e2,
+  TSP_port_e3,
+  TSP_port_e4
+};
+
+struct TSP_port_struct {
+   int    i;
+   double a;
+   string status_str<>;
+};
+
+program TSP_PORT {
+	version TSP_PORT_VERS {
+		TSP_port_enum   get_next(TSP_port_enum) = 1;
+		TSP_port_struct get(void)               = 2;
+		int             set(TSP_port_struct)    = 3;
+	} = 1;
+} = 77;
+
Index: tests/tsp_port/src/test_port_rpc_server.c
===================================================================
--- tests/tsp_port/src/test_port_rpc_server.c	(révision 0)
+++ tests/tsp_port/src/test_port_rpc_server.c	(révision 205)
@@ -0,0 +1,43 @@
+/*
+ * This is sample code generated by rpcgen.
+ * These are only templates and you can use them
+ * as a guideline for developing your own functions.
+ */
+
+#include "test_port_rpc.h"
+
+TSP_port_enum *
+get_next_1_svc(TSP_port_enum *argp, struct svc_req *rqstp)
+{
+	static TSP_port_enum  result;
+
+	/*
+	 * insert server code here
+	 */
+
+	return &result;
+}
+
+TSP_port_struct *
+get_1_svc(void *argp, struct svc_req *rqstp)
+{
+	static TSP_port_struct  result;
+
+	/*
+	 * insert server code here
+	 */
+
+	return &result;
+}
+
+int *
+set_1_svc(TSP_port_struct *argp, struct svc_req *rqstp)
+{
+	static int  result;
+
+	/*
+	 * insert server code here
+	 */
+
+	return &result;
+}
Index: tests/tsp_port/src/test_api.h
===================================================================
--- tests/tsp_port/src/test_api.h	(révision 0)
+++ tests/tsp_port/src/test_api.h	(révision 205)
@@ -0,0 +1,39 @@
+#ifndef _TEST_H_
+#define _TEST_H_
+
+#if defined (WIN32) && defined (TSP_SHARED_LIBS)
+#  ifdef tsp_port_api_EXPORTS
+#    define _EXPORT_API __declspec(dllexport) 
+#  else
+#    define _EXPORT_API __declspec(dllimport) 
+#  endif
+#else
+#  undef _EXPORT_API
+#  define _EXPORT_API
+#include <stdarg.h>
+#endif
+
+#define DEFAULT_BUFLEN 512
+#define DEFAULT_PORT "27015"
+
+#ifdef __cplusplus
+extern "C" {  // only need to export C interface if
+              // used by C++ source code
+#endif
+
+typedef int (*affiche_appli_fp)(const char * format, ...);
+typedef int (*saisie_appli_fp)(const char * format, ...);
+
+_EXPORT_API void init_affichage(affiche_appli_fp function);
+_EXPORT_API void init_saisie(saisie_appli_fp function);
+_EXPORT_API int test_printf( char * format, ... );
+_EXPORT_API int test_scan_1_car( char * uncar );
+_EXPORT_API int api_main();
+_EXPORT_API void printstruct(char * mes, void* val);
+_EXPORT_API char* stringtosend();
+_EXPORT_API int teststringrecu(char * recu);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: tests/tsp_port/src/test_rpc_server.h
===================================================================
--- tests/tsp_port/src/test_rpc_server.h	(révision 0)
+++ tests/tsp_port/src/test_rpc_server.h	(révision 205)
@@ -0,0 +1,26 @@
+#ifndef _TEST_RPC_SVC_H_
+#define _TEST_RPC_SVC_H_
+
+#if defined(WIN32) && defined(TSP_SHARED_LIBS)
+#  ifdef tsp_port_rpc_svc_EXPORTS
+#    define _EXPORT_SERVER __declspec(dllexport) 
+#  else
+#    define _EXPORT_SERVER __declspec(dllimport)
+#  endif
+#else
+#  undef _EXPORT_SERVER
+#  define _EXPORT_SERVER
+#endif
+
+#ifdef __cplusplus
+extern "C" {  // only need to export C interface if
+              // used by C++ source code
+#endif
+
+_EXPORT_SERVER void rpc_svc_main(int argc, char* argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: tests/tsp_port/src/test.c
===================================================================
--- tests/tsp_port/src/test.c	(révision 0)
+++ tests/tsp_port/src/test.c	(révision 205)
@@ -0,0 +1,21 @@
+// test.c : Defines the entry point for the console application.
+//
+
+#include <stdio.h>
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#include "test_api.h"
+#include "test_rpc_client.h"
+
+int main(int argc, char* argv[])
+{
+    init_affichage(&printf);
+    init_saisie(&scanf);
+
+    /* client main */
+    rpc_clnt_main(argc, argv);
+
+    return 0;
+}
Index: tests/tsp_port/src/test_rpc_client.c
===================================================================
--- tests/tsp_port/src/test_rpc_client.c	(révision 0)
+++ tests/tsp_port/src/test_rpc_client.c	(révision 205)
@@ -0,0 +1,358 @@
+#include <stdio.h>
+#include <rpc/rpc.h>
+
+#ifdef WIN32
+    #include <ws2tcpip.h>
+    #include "getopt.h"
+#else
+    #include <unistd.h>
+    #include <sys/types.h>
+    #include <sys/socket.h>
+    #include <netdb.h>
+#endif
+
+#include "test_api.h"
+#include "test_port_rpc.h"
+#include "test_rpc_client.h"
+
+/* Default timeout can be changed using clnt_control() */
+/*static struct timeval TIMEOUT = { 25, 0 }; */
+
+void main_rpc(const char* provided_host)
+{
+    CLIENT *cl;
+    int i;
+    TSP_port_enum deb, elem;
+    TSP_port_struct val;
+    TSP_port_struct *redval;
+    char* host = "localhost";
+    char c;
+    int *res;
+    
+    if (NULL!=provided_host) {
+      host = strdup(provided_host);
+    } else {
+      test_printf(" 0 client mirepoix,\n");
+      test_printf(" 1 client frtldd04365721,\n");
+      test_printf(" autre client local : ");
+      test_scan_1_car(&c);
+      
+      if ('0' == c)
+	{
+	  host = strdup("mirepoix");
+	}
+      if ('1' == c)
+	{
+	  host = strdup("frtldd04365721");
+	}
+    }
+
+    do {
+	
+        cl = clnt_create(host, TSP_PORT, TSP_PORT_VERS, "tcp");
+        
+        deb = TSP_port_e0;
+
+        val.i = 10;
+        val.a = 10.0;
+        val.status_str = "0";
+
+        if (cl == NULL) {
+	        clnt_pcreateerror(host);
+	        exit (1);
+	        }
+        for (i = 0; i < 10; i++) {
+	        elem = *get_next_1(&deb, cl);
+            test_printf("New value enum: %d\n", elem);
+            deb = elem;
+            res = set_1(&val, cl);
+            if (NULL == res)
+            {
+                test_printf("erreur set retourne NULL\n");
+            }
+            else
+            {
+                test_printf("Set retourne %d\n", *res);
+            }        
+	        redval = get_1(&val, cl);
+            if (NULL == redval)
+            {
+                test_printf("get_1 valeur null\n");
+            }
+            else
+            {
+                val = *redval;
+                printstruct("New value struct : ", &val);
+            }        
+        }
+        
+        printstruct("Set value struct : ", &val);
+        res = set_1(&val, cl);
+        if (NULL == res)
+        {
+            test_printf("erreur set retourne NULL\n");
+        }
+        else
+        {
+            printstruct("Final value struct : ", &val);
+        }
+
+        clnt_destroy(cl);
+
+        test_printf("f pour sortir : ");
+        test_scan_1_car(&c);
+    }while('f' != c);
+}
+
+#ifndef WIN32
+#define WSACleanup() do {} while(0)
+#define closesocket(x) close(x)
+#define INVALID_SOCKET -1
+#define SOCKET_ERROR -1
+#endif
+
+int client_socket(const char* provided_host)
+{
+#ifdef WIN32
+    WSADATA wsaData;
+    SOCKET ConnectSocket = INVALID_SOCKET;
+#else
+    int ConnectSocket = 0;
+#endif
+    struct addrinfo *result = NULL,
+                    *ptr = NULL,
+                    hints;
+    char *sendbuf = "this is a test";
+    char *host = "localhost";
+    char recvbuf[DEFAULT_BUFLEN];
+    int iResult,
+        recvbuflen = DEFAULT_BUFLEN,
+        offset;
+    char c;
+    
+    if (NULL!=provided_host) {
+      host = strdup(provided_host);
+    } else {
+      memset(&recvbuf[0], '\0', DEFAULT_BUFLEN);
+      
+      test_printf(" 0 client mirepoix,\n");
+      test_printf(" 1 client frtldd04365721,\n");
+      test_printf(" autre client local : ");
+      test_scan_1_car(&c);
+    
+      if ('0' == c)
+	{
+	  host = strdup("mirepoix");
+	}
+      if ('1' == c)
+	{
+	  host = strdup("frtldd04365721");
+	}
+    }
+
+    // Initialize Winsock
+#ifdef WIN32
+    iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+    if (iResult != 0) {
+        test_printf("WSAStartup failed: %d\n", iResult);
+        return 1;
+    }
+#endif
+
+    memset(&hints, 0, sizeof(hints));
+
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_protocol = IPPROTO_TCP;
+
+    // Resolve the server address and port
+    iResult = getaddrinfo(host, DEFAULT_PORT, &hints, &result);
+    if ( iResult != 0 ) {
+        test_printf("getaddrinfo failed: %d\n", iResult);
+        WSACleanup();
+        return 1;
+    }
+
+    // Attempt to connect to an address until one succeeds
+    for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) {
+
+        // Create a SOCKET for connecting to server
+        ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype, 
+            ptr->ai_protocol);
+        if (ConnectSocket == INVALID_SOCKET) {
+#ifdef WIN32
+            test_printf("Error at socket(): %ld\n", WSAGetLastError());
+#else
+            perror("Error at socket()");
+#endif
+            freeaddrinfo(result);
+            WSACleanup();
+            return  1;
+        }
+        if (ConnectSocket < 0) {
+            perror("Error at socket()");
+            freeaddrinfo(result);
+            return  1;
+        }
+
+        // Connect to server.
+        iResult = connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
+        if (iResult < 0) {
+            closesocket(ConnectSocket);
+            ConnectSocket = INVALID_SOCKET;
+            continue;
+        }
+        break;
+    }
+
+    freeaddrinfo(result);
+
+    if (ConnectSocket == INVALID_SOCKET) {
+        test_printf("Unable to connect to server!\n");
+        WSACleanup();
+        return 1;
+    }
+
+    // Send an initial buffer
+    iResult = send( ConnectSocket, sendbuf, (int)strlen(sendbuf), 0 );
+    if (iResult == SOCKET_ERROR) {
+#ifdef WIN32
+        test_printf("send failed: %d\n", WSAGetLastError());
+#endif
+        closesocket(ConnectSocket);
+        WSACleanup();
+        return 1;
+    }
+
+    test_printf("Bytes <%s> Sent: %ld\n", sendbuf, iResult);
+
+    // shutdown the connection since no more data will be sent
+#ifdef WIN32
+    iResult = shutdown(ConnectSocket, SD_SEND);
+    if (iResult == SOCKET_ERROR) {
+        test_printf("shutdown failed: %d\n", WSAGetLastError());
+        closesocket(ConnectSocket);
+        WSACleanup();
+        return 1;
+    }
+#endif
+
+    // Receive until the peer closes the connection
+    offset = 0;
+    do {
+        iResult = recv(ConnectSocket, &recvbuf[offset], recvbuflen-offset, 0);        
+        if ( iResult > 0 )
+        {
+            test_printf("Bytes <%s> received: %d\n", &recvbuf[offset], iResult);
+            offset += iResult;
+            if (0 == teststringrecu(recvbuf))
+            {
+                test_printf ("reception finished : %s\n", recvbuf);
+            }
+        }
+        else if ( iResult == 0 )
+        {
+            test_printf("Connection closed\n");
+        }
+        else
+        {
+#ifdef WIN32
+            test_printf("recv failed: %d\n", WSAGetLastError());
+#else
+            perror("recv");
+#endif
+        }
+
+    } while( iResult > 0 );
+    
+    // cleanup
+    closesocket(ConnectSocket);
+    WSACleanup();
+
+    return 0;
+}
+
+void rpc_clnt_main(int argc, char* argv[])
+{
+    /* Main options handling */
+    /*  char*   error_string;*/
+    int     opt_ok  = 1;
+    char    c_opt;
+    int    help     = 0;
+    int    test_api = 0;
+    int    test_rpc = 0;
+    int    test_sock = 0;
+    char*  provided_host = NULL;
+
+#ifdef WIN32
+    rpc_nt_init();
+#endif
+    
+    /* Analyse command line parameters */
+    while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"ht:u:")))) {    
+        switch (c_opt) {
+	case 'u':
+	  provided_host = strdup(optarg);
+	  printf("Using provided host = <%s>\n",provided_host); 
+	  break;
+	case 'h':
+	  opt_ok++;
+	  help = 1;                
+	  break;
+	case 't':
+	  opt_ok+=2;
+	  if (0 == strcmp(optarg, "api")) {
+	    test_api = 1;
+	  }
+	  else if (0 == strcmp(optarg, "socket")) {
+	    test_sock = 1;
+	  }
+	  else if (0 == strcmp(optarg, "rpc")) {
+	    test_rpc = 1;
+                }
+	  else {
+	    fprintf(stderr,"Invalid command line option(s), correct it and rerun\n");
+	    opt_ok = 0;
+	  }
+	  break;
+	case '?':
+	  fprintf(stderr,"Invalid command line option(s), correct it and rerun\n");
+	  opt_ok = 0;
+	  break;
+	default:
+	  opt_ok = 0;
+	  break;
+        } /* end of switch */
+    } /* end of while */
+    
+    /* check if global options are OK */
+    if (opt_ok < 2) {
+        fprintf(stderr,"    -h help\n");
+        fprintf(stderr,"    -t api|socket|rpc launch corresponding test\n");
+        fprintf(stderr,"    -u host (optional)\n");
+    }
+    else
+    {
+        if (help) {
+            fprintf(stderr,"Command line option(s)\n");
+            fprintf(stderr,"    -h help\n");
+            fprintf(stderr,"    -t api|socket|rpc launch corresponding test\n");
+	    fprintf(stderr,"    -u host (optional)\n");
+        }
+        if (test_api) {
+            api_main();
+        }        
+        if (test_rpc) {
+            main_rpc(provided_host);
+        }
+        if (test_sock) {
+            client_socket(provided_host);
+        }
+    }
+
+#ifdef WIN32
+    rpc_nt_exit();
+#endif
+
+    exit(0);
+}
Index: tests/tsp_port/src/tsp_port_rpc.h
===================================================================
--- tests/tsp_port/src/tsp_port_rpc.h	(révision 0)
+++ tests/tsp_port/src/tsp_port_rpc.h	(révision 205)
@@ -0,0 +1 @@
+#include <rpc/types.h>
Index: tests/tsp_port/src/test.h
===================================================================
--- tests/tsp_port/src/test.h	(révision 0)
+++ tests/tsp_port/src/test.h	(révision 205)
@@ -0,0 +1,17 @@
+#ifndef _TEST_H_
+#define _TEST_H_
+
+#include <pthread.h>
+
+typedef struct wrapper_s
+{
+    int id;    
+
+    pthread_mutex_t lock;
+    pthread_cond_t  wait;
+
+} wrapper_t;
+
+static void * wrapper_routine(void *);
+
+#endif
\ Pas de fin de ligne à la fin du fichier.
Index: tests/tsp_port/src/test_rpc_client.h
===================================================================
--- tests/tsp_port/src/test_rpc_client.h	(révision 0)
+++ tests/tsp_port/src/test_rpc_client.h	(révision 205)
@@ -0,0 +1,26 @@
+#ifndef _TEST_RPC_CLNT_H_
+#define _TEST_RPC_CLNT_H_
+
+#if defined (WIN32) && defined (TSP_SHARED_LIBS)
+#  ifdef tsp_port_rpc_clnt_EXPORTS
+#     define _EXPORT_CLIENT __declspec(dllexport) 
+#  else
+#     define _EXPORT_CLIENT __declspec(dllimport) 
+#  endif
+#else
+#   undef _EXPORT_CLIENT
+#  define _EXPORT_CLIENT
+#endif
+
+#ifdef __cplusplus
+extern "C" {  // only need to export C interface if
+              // used by C++ source code
+#endif
+
+_EXPORT_CLIENT void rpc_clnt_main(int argc, char* argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: tests/tsp_port/src/test_rpc.h
===================================================================
--- tests/tsp_port/src/test_rpc.h	(révision 0)
+++ tests/tsp_port/src/test_rpc.h	(révision 205)
@@ -0,0 +1,33 @@
+#ifndef _TEST_RPC_H_
+#define _TEST_RPC_H_
+
+#include <rpc/types.h>
+
+#define COUNTSERV ((u_long)77)
+#define COUNTVERS ((u_long)1)
+#define inc ((u_long)1)
+#ifdef __cplusplus
+extern "C" {
+extern int *inc_1(...);
+}
+#else
+extern int *inc_1();
+#endif /* __cplusplus */
+#define dec ((u_long)2)
+#ifdef __cplusplus
+extern "C" {
+extern int *dec_1(...);
+}
+#else
+extern int *dec_1();
+#endif /* __cplusplus */
+#define set ((u_long)3)
+#ifdef __cplusplus
+extern "C" {
+extern int *set_1(...);
+}
+#else
+extern int *set_1();
+#endif /* __cplusplus */
+
+#endif
\ Pas de fin de ligne à la fin du fichier.
Index: tests/tsp_port/src/tsp_port_rpc_svc.c
===================================================================
--- tests/tsp_port/src/tsp_port_rpc_svc.c	(révision 0)
+++ tests/tsp_port/src/tsp_port_rpc_svc.c	(révision 205)
@@ -0,0 +1,3 @@
+#include <stdio.h>
+#include <rpc/rpc.h>
+#include "tsp_port_rpc.h"
Index: tests/tsp_port/src/tsp_port_rpc_xdr.c
===================================================================
--- tests/tsp_port/src/tsp_port_rpc_xdr.c	(révision 0)
+++ tests/tsp_port/src/tsp_port_rpc_xdr.c	(révision 205)
@@ -0,0 +1,2 @@
+#include <rpc/rpc.h>
+#include "tsp_port_rpc.h"
Index: tests/tsp_port/src/test_port_rpc.h
===================================================================
--- tests/tsp_port/src/test_port_rpc.h	(révision 0)
+++ tests/tsp_port/src/test_port_rpc.h	(révision 205)
@@ -0,0 +1,77 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _TEST_PORT_RPC_H_RPCGEN
+#define _TEST_PORT_RPC_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+enum TSP_port_enum {
+	TSP_port_e0 = 0,
+	TSP_port_e1 = 1,
+	TSP_port_e2 = 2,
+	TSP_port_e3 = 3,
+	TSP_port_e4 = 4,
+};
+typedef enum TSP_port_enum TSP_port_enum;
+
+struct TSP_port_struct {
+	int i;
+	double a;
+	char *status_str;
+};
+typedef struct TSP_port_struct TSP_port_struct;
+
+#define TSP_PORT 77
+#define TSP_PORT_VERS 1
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define get_next 1
+extern  TSP_port_enum * get_next_1(TSP_port_enum *, CLIENT *);
+extern  TSP_port_enum * get_next_1_svc(TSP_port_enum *, struct svc_req *);
+#define get 2
+extern  TSP_port_struct * get_1(void *, CLIENT *);
+extern  TSP_port_struct * get_1_svc(void *, struct svc_req *);
+#define set 3
+extern  int * set_1(TSP_port_struct *, CLIENT *);
+extern  int * set_1_svc(TSP_port_struct *, struct svc_req *);
+extern int tsp_port_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define get_next 1
+extern  TSP_port_enum * get_next_1();
+extern  TSP_port_enum * get_next_1_svc();
+#define get 2
+extern  TSP_port_struct * get_1();
+extern  TSP_port_struct * get_1_svc();
+#define set 3
+extern  int * set_1();
+extern  int * set_1_svc();
+extern int tsp_port_1_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern  bool_t xdr_TSP_port_enum (XDR *, TSP_port_enum*);
+extern  bool_t xdr_TSP_port_struct (XDR *, TSP_port_struct*);
+
+#else /* K&R C */
+extern bool_t xdr_TSP_port_enum ();
+extern bool_t xdr_TSP_port_struct ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_TEST_PORT_RPC_H_RPCGEN */
Index: tests/tsp_port/src/CMakeLists.txt
===================================================================
--- tests/tsp_port/src/CMakeLists.txt	(révision 0)
+++ tests/tsp_port/src/CMakeLists.txt	(révision 205)
@@ -0,0 +1,74 @@
+
+SET(TSP_PORT_SRC test)
+SET(TSP_PORT_SVC_SRC test_server)
+SET(TSP_PORT_API_SRC test_api)
+SET(TSP_PORT_RPC_SVC_SRC test_rpc_server test_port_rpc_xdr test_port_rpc_svc)
+SET(TSP_PORT_RPC_CLNT_SRC test_rpc_client test_port_rpc_xdr test_port_rpc_clnt)
+
+# Exec rpcgen 
+SET(RPCGEN ${RPCGEN_PROGRAM})
+
+MESSAGE(STATUS "rpcgen : - found rpcgen is ${RPCGEN_PROGRAM}")
+
+SET(RPC "test_port_rpc")
+SET(TEST_PORT_SRC ${TEST_PORT_SRC})
+
+###############################
+# RPCGEN ne fonctionne pas actuellement dans Cmake, 
+# il faut le faire dans une "Visual Studio .Net 2003 command prompt"
+###############################
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT	${RPC}_xdr.c
+#	COMMAND ${RPCGEN} -c ${RPC}.x -o ${RPC}_xdr.c
+#	DEPENDS ${RPC}.x
+#	WORKING_DIRECTORY ${CMAKE_CURRENT_DIR})
+	
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT	${RPC}.h
+#	COMMAND ${RPCGEN} -h ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x -o ${RPC}.h
+#	DEPENDS ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x)
+
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT 	${RPC}_clnt.c
+#	COMMAND ${RPCGEN} -l ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x -o ${RPC}_clnt.c
+#	DEPENDS ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x)
+
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT 	${RPC}_scv.c
+#	COMMAND ${RPCGEN} -m ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x -o ${RPC}_svc.c
+#	DEPENDS ${CMAKE_SOURCE_DIR}/tests/tsp_port/src/${RPC}.x)
+
+IF (WIN32)
+	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/external/TspWin32)
+ENDIF (WIN32)
+
+# DLL
+TSP_XINCLUDE(${TSP_PORT_API_SRC})
+ADD_LIBRARY(tsp_port_api ${TSP_PORT_API_SRC})
+IF(PTHREADWIN32_FOUND)
+	TARGET_LINK_LIBRARIES(tsp_port_api ${PTHREAD_LIBRARY_NAME} Ws2_32)
+ENDIF(PTHREADWIN32_FOUND)
+
+TSP_XINCLUDE(test_rpc_server)
+ADD_LIBRARY(tsp_port_rpc_svc ${TSP_PORT_RPC_SVC_SRC})
+IF(ACPLT_ONCRPC_FOUND)
+	TARGET_LINK_LIBRARIES(tsp_port_rpc_svc tsp_port_api oncrpc TspWin32)
+ENDIF(ACPLT_ONCRPC_FOUND)
+
+TSP_XINCLUDE(test_rpc_client)
+ADD_LIBRARY(tsp_port_rpc_clnt ${TSP_PORT_RPC_CLNT_SRC})
+IF(ACPLT_ONCRPC_FOUND)
+	TARGET_LINK_LIBRARIES(tsp_port_rpc_clnt tsp_port_api oncrpc ${TSP_WIN32_LIB})
+ENDIF(ACPLT_ONCRPC_FOUND)
+
+# EXE
+ADD_EXECUTABLE(tsp_port_test ${TSP_PORT_SRC})
+TARGET_LINK_LIBRARIES(tsp_port_test tsp_port_api tsp_port_rpc_clnt ${PTHREAD_LIBRARY_NAME})
+ADD_DEPENDENCIES(tsp_port_test tsp_port_rpc_clnt)
+
+ADD_EXECUTABLE(tsp_port_test_svc ${TSP_PORT_SVC_SRC})
+TARGET_LINK_LIBRARIES(tsp_port_test_svc tsp_port_api tsp_port_rpc_svc ${PTHREAD_LIBRARY_NAME}  ${TSP_WIN32_LIB})
+ADD_DEPENDENCIES(tsp_port_test_svc tsp_port_rpc_svc)
+
+TSP_PROGRAM_INSTALL(tsp_port_test tsp_port_test_svc)
+TSP_LIBRARY_INSTALL(tsp_port_rpc_svc tsp_port_rpc_clnt tsp_port_api)
Index: tests/tsp_port/CMakeLists.txt
===================================================================
--- tests/tsp_port/CMakeLists.txt	(révision 0)
+++ tests/tsp_port/CMakeLists.txt	(révision 205)
@@ -0,0 +1,2 @@
+
+ADD_SUBDIRECTORY(src)
