/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  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 BroadOn Communications Corp.
 *
 */

#ifndef __IOP_NET_H__
#define __IOP_NET_H__

/* private APIs for network socket RM */

#ifdef __cplusplus
extern "C" {
#endif

int   soInetAtoN     ( const char* cp, SOInAddr* inp );
char* soInetNtoA     ( SOInAddr in );

int   soInetPtoN     ( int af, const char* src, void* dst );
const
char* soInetNtoP     ( int af, const void* src, char* dst, unsigned len );

int   soSocket       ( int af, int type, int protocol );
int   soClose        ( int s );
int   soShutdown     ( int s, int how );

int   soBind         ( int s, const void* sockAddr );
int   soConnect      ( int s, const void* sockAddr );
int   soGetPeerName  ( int s, void* sockAddr );
int   soGetSockName  ( int s, void* sockAddr );

int   soRecvFrom     ( int s, void* buf, int len, int flags,
                       void* sockFrom );

int   soSendTo       ( int s, const void* buf, int len, int flags,
                       const void* sockTo );

int   soAccept       ( int s, void* sockAddr );
int   soListen       ( int s, int backlog );

int   soSockAtMark   ( int s );

int   soGetSockOpt   ( int s, int level, int optname, void* optval, int* optlen );
int   soSetSockOpt   ( int s, int level, int optname,
                       const void* optval, int optlen );

int   soFcntl        ( int s, int cmd, ... );

int   soPoll         ( SOPollFD fds[], unsigned nfds, OSTime timeout );

SOHostEnt*
      soGetHostByAddr( const void* addr, int len, int type );
SOHostEnt*
      soGetHostByName( const char* name );

void  soFreeAddrInfo ( SOAddrInfo* ai );
int   soGetAddrInfo  ( const char* nodeName, const char* servName,
                       const SOAddrInfo* hints, SOAddrInfo** res );
int   soGetNameInfo  ( const void* sockAddr,
                       char* node, unsigned nodeLen,
                       char* service, unsigned serviceLen,
                       int flags );

long  soGetHostID    ( void );
int   soGetLastError ( void );

void  soInitInterface( void );
int   soiStartup     ( const SOConfig* config );
int   soiCleanup     ( void );

int   soSetResolver  ( const SOInAddr* dns1, const SOInAddr* dns2 );
int   soGetResolver  ( SOInAddr* dns1, SOInAddr* dns2 );
int   soSetSuffix    ( const char* domainSuffix );
int   soGetSuffix    ( char* domainSuffix );

int   soSetInterface(int interfaceId);

#endif // __IOP_NET_H__
