1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef OSCLCONFIG_IO_CHECK_H_INCLUDED 19 #define OSCLCONFIG_IO_CHECK_H_INCLUDED 20 21 /** 22 OSCL_HAS_ANSI_FILE_IO_SUPPORT macro should be set to 1 if 23 the target platform supports the ANSI C file I/O functions (fopen, fread, etc). 24 Otherwise it should be set to 0. 25 */ 26 #ifndef OSCL_HAS_ANSI_FILE_IO_SUPPORT 27 #error "ERROR: OSCL_HAS_ANSI_FILE_IO_SUPPORT has to be defined to either 1 or 0" 28 #endif 29 30 /** 31 OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION macro should be set to 1 if 32 the target platform supports the Symbian file I/O functions (RFile, RFs). 33 Otherwise it should be set to 0. 34 */ 35 #ifndef OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION 36 #error "ERROR: OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION has to be defined to either 1 or 0" 37 #endif 38 39 /** 40 On Symbian platforms only: 41 OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE macro should be set to 1 if 42 the target platform supports the Symbian file I/O function RFile::Duplicate. 43 Otherwise it should be set to 0. 44 */ 45 #if (OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION) 46 #ifndef OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE 47 #error "ERROR: OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE has to be defined to either 1 or 0" 48 #endif 49 #endif 50 51 52 /** 53 OSCL_HAS_NATIVE_FILE_CACHE_ENABLE macro should be set to 1 if 54 the target platform includes native file cache capability. 55 Otherwise it should be set to 0. 56 */ 57 #ifndef OSCL_HAS_NATIVE_FILE_CACHE_ENABLE 58 #error "ERROR: OSCL_HAS_NATIVE_FILE_CACHE_ENABLE has to be defined to either 1 or 0" 59 #endif 60 61 62 /** 63 OSCL_HAS_PV_FILE_CACHE macro should be set to 1 if 64 the target platform includes PV file cache capability. 65 Otherwise it should be set to 0. 66 */ 67 #ifndef OSCL_HAS_PV_FILE_CACHE 68 #error "ERROR: OSCL_HAS_PV_FILE_CACHE has to be defined to either 1 or 0" 69 #endif 70 71 /** 72 OSCL_HAS_LARGE_FILE_SUPPORT macro should be set to 1 if 73 the target platform supports more than 32bit file I/O capability. 74 Otherwise it should be set to 0. 75 */ 76 #ifndef OSCL_HAS_LARGE_FILE_SUPPORT 77 #error "ERROR: OSCL_HAS_LARGE_FILE_SUPPORT has to be defined to either 1 or 0" 78 #endif 79 80 /** 81 type TOsclFileOffset should be defined as the type used for file size 82 and offsets on the target platform. 83 Example: 84 typedef size_t TOsclFileOffset; 85 */ 86 typedef TOsclFileOffset __verify__TOsclFileOffset__defined__; 87 88 89 /** 90 OSCL_FILE_BUFFER_MAX_SIZE macro should be set to 91 the desired size of the file I/O cache in bytes. 92 Otherwise it should be set to 0. 93 */ 94 #ifndef OSCL_FILE_BUFFER_MAX_SIZE 95 #error "ERROR: OSCL_FILE_BUFFER_MAX_SIZE has to be defined to a numeric value" 96 #endif 97 98 /** 99 OSCL_HAS_SOCKET_SUPPORT macro should be set to 1 if 100 the target platform supports sockets of any type. 101 Otherwise it should be set to 0. 102 */ 103 #ifndef OSCL_HAS_SOCKET_SUPPORT 104 #error "ERROR: OSCL_HAS_SOCKET_SUPPORT has to be defined to either 1 or 0" 105 #endif 106 107 /** 108 OSCL_HAS_SYMBIAN_SOCKET_SERVER macro should be set to 109 1 if the platform supports Symbian socket API (RSocket, RSocketServ). 110 Otherwise it should be set to 0. 111 */ 112 #ifndef OSCL_HAS_SYMBIAN_SOCKET_SERVER 113 #error "ERROR: OSCL_HAS_SYMBIAN_SOCKET_SERVER has to be defined to either 1 or 0" 114 #endif 115 116 /** 117 OSCL_HAS_SYMBIAN_DNS_SERVER macro should be set to 118 1 if the platform supports Symbian Host Resolver API (RHostResolver). 119 Otherwise it should be set to 0. 120 */ 121 #ifndef OSCL_HAS_SYMBIAN_DNS_SERVER 122 #error "ERROR: OSCL_HAS_SYMBIAN_DNS_SERVER has to be defined to either 1 or 0" 123 #endif 124 125 /** 126 OSCL_HAS_BERKELEY_SOCKETS macro should be set to 127 1 if the platform supports Berkeley style socket API, including 128 non-blocking I/O and a 'select' call. 129 Otherwise it should be set to 0. 130 */ 131 #ifndef OSCL_HAS_BERKELEY_SOCKETS 132 #error "ERROR: OSCL_HAS_BERKELEY_SOCKETS has to be defined to either 1 or 0" 133 #endif 134 135 /** 136 For platforms with Berkeley type sockets, 137 TOsclSocket typedef should be set to platform native socket type. 138 */ 139 #if OSCL_HAS_BERKELEY_SOCKETS 140 typedef TOsclSocket __TOsclSocketCheck___; 141 #endif 142 143 /** 144 For platforms with Berkeley type sockets, 145 TOsclSockAddr typedef should be set to platform native socket address type. 146 */ 147 #if OSCL_HAS_BERKELEY_SOCKETS 148 typedef TOsclSockAddr __TOsclSockAddrCheck___; 149 #endif 150 151 /** 152 For platforms with Berkeley type sockets, 153 TOsclSockAddrLen typedef should be set to platform native socket address 154 length type. 155 */ 156 #if OSCL_HAS_BERKELEY_SOCKETS 157 typedef TOsclSockAddrLen __TOsclSockAddrLenCheck___; 158 #endif 159 160 /** 161 For platforms with Berkeley type sockets, 162 OsclBind(s,addr,ok,err) must be defined to 163 an expression that does a bind call. 164 's' and 'addr' are the socket and address parameters 165 to the bind command. 166 On success, 'ok' must be set to true. 167 On failure, 'ok' must be set to false and 'err' must be set 168 to the bind error. 169 */ 170 #if OSCL_HAS_BERKELEY_SOCKETS 171 #ifndef OsclBind 172 #error "ERROR: OsclBind(s,addr,ok,err) has to be defined" 173 #endif 174 #endif 175 176 /** 177 For platforms with Berkeley type sockets, 178 OsclListen(s,size,ok,err) must be defined to 179 an expression that does a listen call and sets 'ok' and 'err' 180 to indicate the result. 181 's' and 'size' are the socket and queue size args to the listen 182 call. 183 On success, 'ok' must be set to true. 184 On failure, 'ok' must be set to false and 'err' must be set 185 to the listen error. 186 */ 187 #if OSCL_HAS_BERKELEY_SOCKETS 188 #ifndef OsclListen 189 #error "ERROR: OsclListen(s,size,ok,err) has to be defined" 190 #endif 191 #endif 192 193 /** 194 For platforms with Berkeley type sockets, 195 OsclAccept(s,accept_s,ok,err,wouldblock) must be defined to 196 an expression that does an accept call and sets 'ok', 'err', 197 and 'wouldblock' to indicate the result. 198 's' and 'accept_s' are the socket and accept socket args to the 199 accept call. 200 On success, 'ok' must be set to true. 201 On failure, 'ok' must be set to false and 'err' must be set 202 to the accept error. Additionally 'wouldblock' must be set to true 203 if the error code indicates that the socket is non-blocking and 204 would block, or to false otherwise. 205 */ 206 #if OSCL_HAS_BERKELEY_SOCKETS 207 #ifndef OsclAccept 208 #error "ERROR: OsclAccept(s,accept_s,ok,err,wouldblock) has to be defined" 209 #endif 210 #endif 211 212 /** 213 For platforms with Berkeley type sockets, 214 OsclSetNonBlocking(s,ok,err) must be defined to 215 an expression that sets socket 's' to non-blocking I/O mode 216 and sets 'ok' and 'err' to indicate the result. 217 On success, 'ok' must be set to true. 218 On failure, 'ok' must be set to false and 'err' must be set 219 to the error. 220 */ 221 #if OSCL_HAS_BERKELEY_SOCKETS 222 #ifndef OsclSetNonBlocking 223 #error "ERROR: OsclSetNonBlocking(s,ok,err) has to be defined" 224 #endif 225 #endif 226 227 /** 228 For platforms with Berkeley type sockets, 229 OsclShutdown(s,how,ok,err) must be defined to 230 an expression that does a shutdown call and sets 'ok' and 'err' 231 to indicate the result. 232 's' and 'how' are the socket and shutdown type args to the 233 shutdown call. 234 On success, 'ok' must be set to true. 235 On failure, 'ok' must be set to false and 'err' must be set 236 to the shutdown error. 237 */ 238 #if OSCL_HAS_BERKELEY_SOCKETS 239 #ifndef OsclShutdown 240 #error "ERROR: OsclShutdown(s,how,ok,err) has to be defined" 241 #endif 242 #endif 243 244 /** 245 For platforms with Berkeley type sockets, 246 OsclSocket(s,fam,type,prot,ok,err) must be defined to 247 an expression that does a socket creation call and sets 'ok' 248 and 'err' to indicate the result. 249 's', 'fam', 'type', and 'prot' are the socket, family, type, and 250 protocol args to the socket call. 251 On success, 'ok' must be set to true. 252 On failure, 'ok' must be set to false and 'err' must be set 253 to the socket error. 254 */ 255 #if OSCL_HAS_BERKELEY_SOCKETS 256 #ifndef OsclSocket 257 #error "ERROR: OsclSocket(s,fam,type,prot,ok,err) has to be defined" 258 #endif 259 #endif 260 261 /** 262 For platforms with Berkeley type sockets, 263 OsclSendTo(s,buf,len,addr,ok,err,nbytes,wouldblock) must be defined 264 to an expression that does a sendto call and sets 'ok, 'err', 'nbytes', 265 and 'wouldblock' to indicate the result. 266 's', 'buf', 'len', 'flags' and 'addr' are the arguments to the sendto 267 call. 268 On success, 'ok' must be set to true, and 'nbytes' must be set to 269 the number of bytes sent. 270 On failure, 'ok' must be set to false 'err' must be set 271 to the socket error. Additionally 'wouldblock' must be set to true 272 if the error code indicates that the socket is non-blocking and 273 would block, or to false otherwise. 274 */ 275 #if OSCL_HAS_BERKELEY_SOCKETS 276 #ifndef OsclSendTo 277 #error "ERROR: OsclSendTo(s,buf,len,flags,addr,ok,err,nbytes,wouldblock) has to be defined" 278 #endif 279 #endif 280 281 /** 282 For platforms with Berkeley type sockets, 283 OsclSend(s,buf,len,ok,err,nbytes,wouldblock) must be defined to 284 an expression that does a send operation and sets 'ok, 'err', 'nbytes', 285 and 'wouldblock' to indicate the result. 286 's', 'buf', and 'len' are the args to the send call. 287 On success, 'ok' must be set to true, and 'nbytes' must be set to 288 the number of bytes sent. 289 On failure, 'ok' must be set to false 'err' must be set 290 to the socket error. Additionally 'wouldblock' must be set to true 291 if the error code indicates that the socket is non-blocking and 292 would block, or to false otherwise. 293 */ 294 #if OSCL_HAS_BERKELEY_SOCKETS 295 #ifndef OsclSend 296 #error "ERROR: OsclSend(s,buf,len,ok,err,nbytes,wouldblock) has to be defined" 297 #endif 298 #endif 299 300 /** 301 For platforms with Berkeley type sockets, 302 OsclCloseSocket(s,ok,err) must be defined to 303 an expression that closes socket 's' and sets 'ok and 'err' 304 to indicate the result. 305 On success, 'ok' must be set to true. 306 On failure, 'ok' must be set to false and 'err' must be set 307 to the close error. 308 */ 309 #if OSCL_HAS_BERKELEY_SOCKETS 310 #ifndef OsclCloseSocket 311 #error "ERROR: OsclCloseSocket(s,ok,err) has to be defined" 312 #endif 313 #endif 314 315 /** 316 For platforms with Berkeley type sockets, 317 OsclConnect(s,addr,ok,err,wouldblock) must be defined to 318 an expression that does a connect call and sets 'ok', 'err', 319 and 'wouldblock' to indicate the result. 320 's' and 'addr' are the socket and address args to the connect call. 321 On success, 'ok' must be set to true. 322 On failure, 'ok' must be set to false 'err' must be set 323 to the socket error. Additionally 'wouldblock' must be set to true 324 if the error code indicates that the socket is non-blocking and 325 would block, or to false otherwise. 326 */ 327 #if OSCL_HAS_BERKELEY_SOCKETS 328 #ifndef OsclConnect 329 #error "ERROR: OsclConnect(s,addr,ok,err,wouldblock) has to be defined" 330 #endif 331 #endif 332 333 /** 334 For platforms with Berkeley type sockets, 335 OsclConnectComplete(s,wset,eset,success,fail,ok,err) must be set 336 to an expression that checks for completion of a connect operation 337 on a non-blocking socket and sets 'success', 'fail', 'ok', and 'err' 338 to indicate the result. 339 's' is the socket, 'wset' is the write set from the select call, 340 'eset' is the exception set from the select call. 341 If connect is not yet complete, 'success' and 'fail' must be 342 set false. 343 On connect success, 'success' must be set true. 344 On conneect failure, 'success' must be set false, 'fail' must be 345 set true. Additionally, the call attempts to retrieve the connect error. 346 If the connect error is obtained, 'ok' is set true and 'err' contains 347 the error. If the connect error is not obtained, 'ok' is set false 348 and 'err' is the error code from the attempt. 349 */ 350 #if OSCL_HAS_BERKELEY_SOCKETS 351 #ifndef OsclConnectComplete 352 #error "ERROR: OsclConnectComplete(s,wset,eset,success,fail,ok,err) has to be defined" 353 #endif 354 #endif 355 356 /** 357 For platforms with Berkeley type sockets, 358 OsclRecv(s,buf,len,ok,err,nbytes,wouldblock) must be defined to 359 an expression that does a recv call and sets 'ok', 'err', 'nbytes', 360 and 'wouldblock' to indicate the result. 361 's', 'buf', and 'len' are the arguments to the recv call. 362 On success, 'ok' must be set to true, and 'nbytes' must be set to 363 the number of bytes received. 364 On failure, 'ok' must be set to false 'err' must be set 365 to the socket error. Additionally 'wouldblock' must be set to true 366 if the error code indicates that the socket is non-blocking and 367 would block, or to false otherwise. 368 */ 369 #if OSCL_HAS_BERKELEY_SOCKETS 370 #ifndef OsclRecv 371 #error "ERROR: OsclRecv(s,buf,len,ok,err,nbytes,wouldblock) has to be defined" 372 #endif 373 #endif 374 375 /** 376 For platforms with Berkeley type sockets, 377 OsclRecvFrom(s,buf,len,addr,addrlen,ok,err,nbytes,wouldblock) must be defined to 378 an expression that does a recvfrom call and sets 'ok', 'err', 'nbytes', 379 and 'wouldblock' to indicate the result. 380 's', 'buf', 'len', 'paddr', and 'paddrlen' are the arguments to the recvfrom call. 381 On success, 'ok' must be set to true, 'nbytes' must be set to 382 the number of bytes received, and 'paddr' must be set to the source address. 383 On failure, 'ok' must be set to false 'err' must be set 384 to the socket error. Additionally 'wouldblock' must be set to true 385 if the error code indicates that the socket is non-blocking and 386 would block, or to false otherwise. 387 */ 388 #if OSCL_HAS_BERKELEY_SOCKETS 389 #ifndef OsclRecvFrom 390 #error "ERROR: OsclRecvFrom(s,buf,len,paddr,paddrlen,ok,err,nbytes,wouldblock) has to be defined" 391 #endif 392 #endif 393 394 /** 395 For platforms with Berkeley type sockets, 396 OsclSocketSelect(nfds,rd,wr,ex,timeout,ok,err,nhandles) must be defined to 397 an expression that does a select call and sets 'ok', 'err', and 398 'nhandles' to indicate the result. 399 'nfds', 'rd', 'wr', 'ex', and 'timeout' are the arguments to the 400 select call. 401 On success, 'ok' must be set to true, and 'nhandles' must be set to 402 the number of socket handles with activitiy detected. 403 On failure, 'ok' must be set to false 'err' must be set 404 to the select error. 405 */ 406 #if OSCL_HAS_BERKELEY_SOCKETS 407 #ifndef OsclSocketSelect 408 #error "ERROR: OsclSocketSelect(nfds,rd,wr,ex,timeout,ok,err,nhandles) has to be defined" 409 #endif 410 #endif 411 412 /** 413 For platforms with Berkeley type sockets, 414 OsclSocketStartup(ok) must be defined to 415 an expression that does any necessary startup of the socket system 416 and sets 'ok' to indicate the result. 417 On success, 'ok' must be set to true. 418 On failure, 'ok' must be set to false. 419 */ 420 #if OSCL_HAS_BERKELEY_SOCKETS 421 #ifndef OsclSocketStartup 422 #error "ERROR: OsclSocketStartup(ok) has to be defined" 423 #endif 424 #endif 425 426 /** 427 For platforms with Berkeley type sockets, 428 OsclSocketCleanup(ok) must be defined to 429 an expression that does any necessary cleanup of the socket system 430 and sets 'ok' to indicate the result. 431 On success, 'ok' must be set to true. 432 On failure, 'ok' must be set to false. 433 */ 434 #if OSCL_HAS_BERKELEY_SOCKETS 435 #ifndef OsclSocketCleanup 436 #error "ERROR: OsclSocketCleanup(ok) has to be defined" 437 #endif 438 #endif 439 440 /** 441 For platforms with Berkeley type sockets, 442 OsclGetAsyncSockErr(s,ok,err) must be defined to 443 an expression that does a getsockopt call to retrieve a socket error 444 and sets 'ok' and 'err' to indicate the result. 445 's' is the socket argument to the getsockopt call. 446 On success, 'ok' must be set true and 'err' must be set to the 447 error retrieved. 448 On failure, 'ok' must be set false and 'err' must be set to the 449 error from the getsockopt call. 450 */ 451 #if OSCL_HAS_BERKELEY_SOCKETS 452 #ifndef OsclGetAsyncSockErr 453 #error "ERROR: OsclGetAsyncSockErr(s,ok,err) has to be defined" 454 #endif 455 #endif 456 457 /** 458 For platforms with Berkeley type sockets, 459 TOsclHostent typedef should be set to platform native hostent type. 460 */ 461 #if OSCL_HAS_BERKELEY_SOCKETS 462 typedef TOsclHostent __TOsclHostentCheck___; 463 #endif 464 465 /** 466 For platforms with Berkeley type sockets, 467 OsclGethostbyname(name,hostent,ok,err) must be defined to 468 an expression that does a gethostbyname call on host 'name' 469 and sets 'hostent', 'ok' and 'err' to indicate the result. 470 'name' is the name argument to the gethostbyname call. 471 On success, 'ok' must be set true and 'hostent' must be set to 472 the TOsclHostent* retrieved. 473 On failure, 'ok' must be set false and 'err' must be set to the 474 error from the gethostbyname call. 475 */ 476 #if OSCL_HAS_BERKELEY_SOCKETS 477 #ifndef OsclGethostbyname 478 #error "ERROR: OsclGethostbyname(name,hostent,ok,err) has to be defined" 479 #endif 480 #endif 481 482 /** 483 For platforms with Berkeley type sockets, 484 OsclGetDottedAddr(hostent,dottedaddr,ok) must be defined to 485 an expression that does extracts an address in dotted decimal 486 notation from a hostent structure. 487 'hostent' is the TOsclHostent*, 488 'dottedaddr' is a char* output containing the dotted address, 489 and 'ok' is a bool that should be set true on success, false on failure. 490 */ 491 #if OSCL_HAS_BERKELEY_SOCKETS 492 #ifndef OsclGetDottedAddr 493 #error "ERROR: OsclGetDottedAddr(hostent,dottedaddr,ok) has to be defined" 494 #endif 495 #endif 496 497 498 /** 499 For platforms in which file descriptors created with a pipe() command can be 500 used with the select() system call the following 3 macros must be defined 501 */ 502 503 #if OSCL_HAS_SELECTABLE_PIPES 504 #ifndef OsclPipe 505 #error "ERROR: OsclPipe(pipearray) has to be defined" 506 #endif 507 #endif 508 509 #if OSCL_HAS_SELECTABLE_PIPES 510 #ifndef OsclReadFD 511 #error "ERROR: OsclReadFD(fd,buffer,cnt) has to be defined" 512 #endif 513 #endif 514 515 #if OSCL_HAS_SELECTABLE_PIPES 516 #ifndef OsclWriteFD 517 #error "ERROR: OsclWriteFD(fd,buffer,cnt) has to be defined" 518 #endif 519 #endif 520 521 #if OSCL_HAS_SOCKET_SUPPORT 522 /** 523 OsclValidInetAddr must be defined to a boolean expression to 524 evaluate whether an address is proper IP4 format. 525 'addr' is a char* containing the address string. 526 */ 527 #ifndef OsclValidInetAddr 528 #error "ERROR: OsclValidInetAddr(addr) must be defined" 529 #endif 530 #endif 531 532 #if OSCL_HAS_SOCKET_SUPPORT 533 /** 534 OSCL_SD_RECEIVE, OSCL_SD_SEND, and OSCL_SD_BOTH must be defined to 535 the platform-specific socket shutdown codes. 536 */ 537 #ifndef OSCL_SD_RECEIVE 538 #error "ERROR: OSCL_SD_RECEIVE has to be defined" 539 #endif 540 #ifndef OSCL_SD_SEND 541 #error "ERROR: OSCL_SD_SEND has to be defined" 542 #endif 543 #ifndef OSCL_SD_BOTH 544 #error "ERROR: OSCL_SD_BOTH has to be defined" 545 #endif 546 #endif 547 548 #if OSCL_HAS_SOCKET_SUPPORT 549 /** 550 OSCL_AF_INET must be defined to the platform-specific 551 network address family codes for INET. 552 */ 553 #ifndef OSCL_AF_INET 554 #error "ERROR: OSCL_AF_INET has to be defined" 555 #endif 556 #endif 557 558 #if OSCL_HAS_SOCKET_SUPPORT 559 /** 560 OSCL_SOCK_STREAM and OSCL_SOCK_DATAGRAM must be defined to 561 the platform-specific socket type codes. 562 */ 563 #ifndef OSCL_SOCK_STREAM 564 #error "ERROR: OSCL_SOCK_STREAM has to be defined" 565 #endif 566 #ifndef OSCL_SOCK_DATAGRAM 567 #error "ERROR: OSCL_SOCK_DATAGRAM has to be defined" 568 #endif 569 #endif 570 571 #if OSCL_HAS_SOCKET_SUPPORT 572 /** 573 OSCL_IPPROTO_TCP and OSCL_IPPROTO_UDP must be defined to 574 the platform-specific IP protocol codes. 575 */ 576 #ifndef OSCL_IPPROTO_TCP 577 #error "ERROR: OSCL_IPPROTO_TCP has to be defined" 578 #endif 579 #ifndef OSCL_IPPROTO_UDP 580 #error "ERROR: OSCL_IPPROTO_UDP has to be defined" 581 #endif 582 #endif 583 584 585 #endif // OSCLCONFIG_IO_CHECK_H_INCLUDED 586 587 588