/*------------------------------------------------------------------------------ * * File: so_init.h * Description: socket api public header file * * Copyright (C) 2010 Nintendo. All rights reserved. * These coded instructions, statements, and computer programs contain * proprietary information of Nintendo of America Inc. and/or Nintendo * Company Ltd., and are protected by Federal copyright law. They may * not be disclosed to third parties or copied or duplicated in any form, * in whole or in part, without the prior written consent of Nintendo. * *------------------------------------------------------------------------------ */ #ifndef __SOCKET_INIT_H__ #define __SOCKET_INIT_H__ #ifdef __cplusplus extern "C" { #endif #include #include #define SOCKET_ERROR (-1) /* * "how" parameter to shutdown() call */ #define SHUT_RD 0 /* No more read, but can write */ #define SHUT_WR 1 /* No more write but can read */ #define SHUT_RDWR 2 /* No more read or write */ /* * Generic structure used by kernel to store most * addresses. */ struct sockaddr { unsigned short sa_family; /* address family */ #ifdef IP_V6 /* V6 only or dual stacks */ char sa_data[32]; /* big enough for extracted sockaddr_in6 */ #else /* Ancient IPv4 only version */ char sa_data[14]; /* up to 14 bytes of direct address */ #endif }; #define INADDR_ANY 0L /* * IPv4 Internet Address */ struct in_addr { unsigned long s_addr; }; /* * IPv4 socket address */ struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; typedef int socklen_t; #ifndef NPTYPES_H typedef unsigned long ip_addr; #endif /* * Socket API */ #define SOInit socket_lib_init #define SOFinish socket_lib_finish #define SOLastError socketlasterr #define SOInetNtoA inet_ntoa #define SOResolverRegisterAllocator set_resolver_allocator /* * Socket API (BSD-style) */ extern int socket_lib_init(void); extern int socket_lib_finish(void); extern char *inet_ntoa(struct in_addr in); extern int socketlasterr(void); int set_resolver_allocator(void * (*new_alloc) (u32), void (*new_free) (void *)); #ifdef __cplusplus } #endif #endif /* __SOCKET_PUB_H__ */