#include "osclconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <signal.h>
#include <netdb.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/vfs.h>
#include <dirent.h>
#include <sys/stat.h>
#include "osclconfig_io_check.h"
Go to the source code of this file.
Defines | |
| #define | OSCL_HAS_GLOB 0 |
| #define | OSCL_HAS_ANSI_FILE_IO_SUPPORT 1 |
| #define | OSCL_HAS_ANSI_64BIT_FILE_IO_SUPPORT 0 |
| #define | OSCL_HAS_MSWIN_FILE_IO_SUPPORT 0 |
| #define | OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION 0 |
| #define | OSCL_HAS_NATIVE_FILE_CACHE_ENABLE 1 |
| #define | OSCL_FILE_BUFFER_MAX_SIZE 32768 |
| #define | OSCL_HAS_PV_FILE_CACHE 0 |
| #define | OSCL_HAS_LARGE_FILE_SUPPORT 1 |
| #define | OSCL_HAS_SYMBIAN_SOCKET_SERVER 0 |
| #define | OSCL_HAS_SYMBIAN_DNS_SERVER 0 |
| #define | OSCL_HAS_BERKELEY_SOCKETS 1 |
| #define | OSCL_HAS_SOCKET_SUPPORT 1 |
| #define | OsclValidInetAddr(addr) (inet_addr(addr)!=INADDR_NONE) |
| #define | OsclMakeSockAddr(sockaddr, port, addrstr, ok) |
| #define | OsclUnMakeSockAddr(sockaddr, addrstr) addrstr=inet_ntoa(sockaddr.sin_addr); |
| #define | OsclMakeInAddr(in_addr, addrstr, ok) |
| #define | OsclUnMakeInAddr(in_addr, addrstr) addrstr=inet_ntoa(in_addr); |
| #define | OsclSetRecvBufferSize(s, val, ok, err) |
| #define | OsclBind(s, addr, ok, err) |
| #define | OsclSetSockOpt(s, optLevel, optName, optVal, optLen, ok, err) |
| #define | OsclJoin(s, addr, ok, err) |
| #define | OsclListen(s, size, ok, err) |
| #define | OsclAccept(s, accept_s, ok, err, wouldblock) |
| #define | OsclSetNonBlocking(s, ok, err) |
| #define | OsclShutdown(s, how, ok, err) |
| #define | OsclSocket(s, fam, type, prot, ok, err) |
| #define | OsclSendTo(s, buf, len, addr, ok, err, nbytes, wouldblock) |
| #define | OsclSend(s, buf, len, ok, err, nbytes, wouldblock) |
| #define | OsclCloseSocket(s, ok, err) |
| #define | OsclConnect(s, addr, ok, err, wouldblock) |
| #define | OsclGetPeerName(s, name, namelen, ok, err) |
| #define | OsclGetAsyncSockErr(s, ok, err) |
| #define | OsclPipe(x) pipe(x) |
| #define | OsclReadFD(fd, buf, cnt) read(fd,buf,cnt) |
| #define | OsclWriteFD(fd, buf, cnt) write(fd,buf,cnt) |
| #define | OsclConnectComplete(s, wset, eset, success, fail, ok, err) |
| #define | OsclRecv(s, buf, len, ok, err, nbytes, wouldblock) |
| #define | OsclRecvFrom(s, buf, len, paddr, paddrlen, ok, err, nbytes, wouldblock) |
| #define | OsclSocketSelect(nfds, rd, wr, ex, timeout, ok, err, nhandles) |
| #define | OsclSocketStartup(ok) |
| #define | OsclSocketCleanup(ok) |
| #define | OsclGethostbyname(name, hostent, ok, err) |
| #define | OsclGetDottedAddr(hostent, dottedaddr, ok) |
| #define | OsclGetDottedAddrVector(hostent, dottedaddr, dottedaddrvect, ok) |
| #define | OSCL_SD_RECEIVE SHUT_RD |
| #define | OSCL_SD_SEND SHUT_WR |
| #define | OSCL_SD_BOTH SHUT_RDWR |
| #define | OSCL_AF_INET AF_INET |
| #define | OSCL_SOCK_STREAM SOCK_STREAM |
| #define | OSCL_SOCK_DATAGRAM SOCK_DGRAM |
| #define | OSCL_IPPROTO_IP IPPROTO_IP |
| #define | OSCL_IPPROTO_TCP IPPROTO_TCP |
| #define | OSCL_IPPROTO_UDP IPPROTO_UDP |
| #define | OSCL_SOL_SOCKET SOL_SOCKET |
| #define | OSCL_SOL_IP IPPROTO_IP |
| #define | OSCL_SOL_TCP IPPROTO_TCP |
| #define | OSCL_SOL_UDP IPPROTO_UDP |
| #define | OSCL_SOCKOPT_IP_MULTICAST_TTL IP_MULTICAST_TTL |
| #define | OSCL_SOCKOPT_IP_ADDMEMBERSHIP IP_ADD_MEMBERSHIP |
| #define | OSCL_SOCKOPT_IP_TOS IP_TOS |
| #define | OSCL_SOCKOPT_SOL_REUSEADDR SO_REUSEADDR |
Typedefs | |
| typedef int | TOsclSocket |
| typedef sockaddr_in | TOsclSockAddr |
| typedef socklen_t | TOsclSockAddrLen |
| typedef ip_mreq | TIpMReq |
| typedef hostent | TOsclHostent |
| typedef off64_t | TOsclFileOffset |
This header file should work for any ANSI C compiler to determine the proper native C types to use for OSCL integer types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Value: |
|
|
Value: TOsclSockAddr* tmpadr = &addr;\ sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\ ok=(bind(s,sadr,sizeof(addr))!=(-1));\ if (!ok)err=errno |
|
|
Value: ok=(close(s)!=(-1));\
if (!ok)err=errno |
|
|
Value: TOsclSockAddr* tmpadr = &addr;\ sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\ ok=(connect(s,sadr,sizeof(addr))!=(-1));\ if (!ok){err=errno;wouldblock=(err==EINPROGRESS);} |
|
|
Value: success=fail=false;\ if (FD_ISSET(s,&eset))\ {fail=true;OsclGetAsyncSockErr(s,ok,err);}\ else if (FD_ISSET(s,&wset))\ {OsclGetAsyncSockErr(s,ok,err);if (ok && err==0)success=true;else fail=true;} |
|
|
Value: int opterr;socklen_t optlen=sizeof(opterr);\ ok=(getsockopt(s,SOL_SOCKET,SO_ERROR,(void *)&opterr,&optlen)!=(-1));\ if(ok)err=opterr;else err=errno; |
|
|
Value: long *_hostaddr=(long*)hostent->h_addr_list[0];\ struct in_addr _inaddr;\ _inaddr.s_addr=*_hostaddr;\ dottedaddr=inet_ntoa(_inaddr);\ ok=(dottedaddr!=NULL); |
|
|
Value: if(dottedaddrvect)\ {\ long **_addrlist=(long**)hostent->h_addr_list;\ for(int i = 0; _addrlist[i] != NULL; i++){\ struct in_addr _inaddr;\ _inaddr.s_addr=*_addrlist[i];\ OsclNetworkAddress addr(inet_ntoa(_inaddr), 0);\ dottedaddrvect->push_back(addr);\ }\ if (!dottedaddrvect->empty())\ {dottedaddr->port = dottedaddrvect->front().port; dottedaddr->ipAddr.Set(dottedaddrvect->front().ipAddr.Str());}\ ok=(!dottedaddrvect->empty() && (((*dottedaddrvect)[0]).ipAddr.Str() != NULL));\ }\ else\ {\ char *add;\ OsclGetDottedAddr(hostent,add,ok);\ if(ok) dottedaddr->ipAddr.Set(add);\ } |
|
|
Value: hostent=gethostbyname((const char*)name);\ ok=(hostent!=NULL);\ if (!ok)err=errno; |
|
|
Value: ok=(getpeername(s,(sockaddr*)&name,(socklen_t*)&namelen) != (-1) );\
if (!ok)err=errno |
|
|
Value: {\
struct ip_mreq mreq; \
void* p = &addr; \
ok=(bind(s,(sockaddr*)p,sizeof(addr))!=(-1));\
mreq.imr_multiaddr.s_addr = addr.sin_addr.s_addr ; \
mreq.imr_interface.s_addr = htonl(INADDR_ANY); \
ok=(setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(struct ip_mreq))!=(-1)); \
if (!ok)err=errno;\
} |
|
|
Value: ok=(listen(iSocket,qSize)!=(-1));\
if (!ok)err=errno |
|
|
Value: int32 result = inet_aton((const char*)addrstr, &in_addr);\ ok=(result!=0); |
|
|
Value: sockaddr.sin_family=OSCL_AF_INET;\ sockaddr.sin_port=htons(port);\ int32 result=inet_aton((const char*)addrstr,&sockaddr.sin_addr);\ ok=(result!=0); |
|
|
|
|
|
|
|
|
Value: nbytes=recv(s,(void *)(buf),(size_t)(len),0);\ ok=(nbytes!=(-1));\ if (!ok){err=errno;wouldblock=(err==EAGAIN);} |
|
|
Value: {\
void* p=paddr;\
nbytes=recvfrom(s,(void*)(buf),(size_t)(len),0,(struct sockaddr*)p,paddrlen);\
ok=(nbytes!=(-1));\
if (!ok){err=errno;wouldblock=(err==EAGAIN);}\
} |
|
|
Value: nbytes=send(s,(const void*)(buf),(size_t)(len),0);\ ok=(nbytes!=(-1));\ if (!ok){err=errno;wouldblock=(err==EAGAIN||err==EWOULDBLOCK);} |
|
|
Value: TOsclSockAddr* tmpadr = &addr;\ sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\ nbytes=sendto(s,(const void*)(buf),(size_t)(len),0,sadr,(socklen_t)sizeof(addr));\ ok=(nbytes!=(-1));\ if (!ok){err=errno;wouldblock=(err==EAGAIN||err==EWOULDBLOCK);} |
|
|
Value: ok=(fcntl(s,F_SETFL,O_NONBLOCK)!=(-1));\
if (!ok)err=errno |
|
|
Value: ok=(setsockopt(s,SOL_SOCKET,SO_RCVBUF,(char*)&val, sizeof(int)) !=-1);\ if (!ok)err=errno |
|
|
Value: ok=(setsockopt(s,optLevel,optName,OSCL_STATIC_CAST(const char*,optVal),optLen) != (-1));\ if (!ok)err=errno |
|
|
Value: ok=(shutdown(iSocket,how)!=(-1));\
if (!ok)err=errno |
|
|
Value: s=socket(fam,type,prot);\
ok=(s!=(-1));\
if (!ok)err=errno |
|
|
Value: signal(SIGPIPE,SIG_DFL);\
ok=true |
|
|
Value: nhandles=select(nfds,&rd,&wr,&ex,&timeout);\
ok=(nhandles!=(-1));\
if (!ok)err=errno |
|
|
Value: signal(SIGPIPE,SIG_IGN);\
ok=true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OSCL API
Posting Version: CORE_8.508.1.1