Update contrib.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Test of the unsupported option values in setsockopt
27 #include <sys/types.h>
28 #include <sys/socket.h>
29 #include <sys/ioctl.h>
30 #include <libc/netinet/in.h>
31 #include <libc/arpa/inet.h>
35 #include "CTEST.H" /* includes C interface to EPOC32 threads, and SpawnPosixServer */
39 struct sockaddr_in testaddr;
41 //The structure _reent contains *all* globals needed by the library.
44 unsigned short int port = 2001;
47 @SYMTestCaseID SYSLIB-STDLIB-CT-1119
48 @SYMTestCaseDesc Tests for the unsupported option values in setsockopt
50 @SYMTestActions Tests for creation of a socket and setting unsupported options on a socket
51 @SYMTestExpectedResults Test must not fail
61 //Creating stream sockets to be used in the test
62 test_Next("Create stream sockets");
63 fd1=socket(AF_INET, SOCK_STREAM, 0);
67 optionsize=sizeof(optionbuf[0]);
69 //valid option e.g SO_SNDBUF(positive value 3)
70 err=setsockopt(fd1,SOL_SOCKET,SO_SNDBUF,optionbuf,optionsize);
72 //No error in setsockopt with returned value in p->_errno=0
77 //invalid(not supported) option e.g IP_ADD_MEMBERSHIP(negative value -8)
78 err=setsockopt(fd1,SOL_SOCKET,IP_ADD_MEMBERSHIP,optionbuf,optionsize);
80 //Error in setsockopt with returned value in p->_errno=ENOSYS(88)
82 test(p->_errno==ENOSYS);
89 test_Title("AF_INET Streams");
91 err=CommInit(0); /* ensure a workable comms environment */
93 IN_SET_LOOPBACK_ADDR(&testaddr);