/*
 * Copyright (C) 2008 The Trustees of Columbia University in the City of New York. 
 * All rights reserved.
 *
 * See the file LICENSE included in this distribution for details.
 */

#ifndef _SOCKETI_H
#define _SOCKETI_H

#ifndef _WENGO
#include "types.h"
#endif

#ifdef _WENGO
#include "p2pp/common/types.h"
#endif 

#ifdef _LINUX_
#include <sys/types.h>  //socket
#include <sys/socket.h> //socket
#include <netinet/in.h> //hton, ntoh
#include <arpa/inet.h>  //inet_addr
#endif


#ifdef WIN32
#include <windows.h>
#include <winsock.h>

typedef int socklen_t;

int close(int s);
unsigned long inet_aton(const char* cp, struct in_addr* pin);
#endif


int32 bindi(int32 sockid, uint16 port);
int32 sendtoi(int32 sockfd, char* data, int32 size, char* ip, int32 port);
int32 setBlocking(int32 sockid, int32 mode);
int32 setNonblocking(int32 sockid, int32 mode);

int32 selectforsocket(int32 sockfd, int32 timeoutval);
int32 getSockAddr_in(char *pchIP, int port, struct sockaddr_in *pstaddr);


#endif


