~ubuntu-branches/ubuntu/saucy/nspr/saucy-updates

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/tests/sockopt.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-08-10 11:34:26 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810113426-3uv4diflrkcbdimm
Tags: 4.8-0ubuntu1
* New upstream release: 4.8 (LP: #387812)
* adjust patches to changed upstreanm codebase
  - update debian/patches/99_configure.patch
* update shlibs symbols to include new API elements
  - update debian/libnspr4-0d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "prio.h"
40
40
#include "prinit.h"
41
41
#include "prprf.h"
42
 
#ifdef XP_MAC
43
 
#include "probslet.h"
44
 
#else
45
42
#include "obsolete/probslet.h"
46
 
#endif
47
43
 
48
44
#include "plerror.h"
49
45
 
50
46
static PRFileDesc *err = NULL;
51
47
static PRBool failed = PR_FALSE;
52
48
 
53
 
#ifndef XP_MAC
54
49
static void Failed(const char *msg1, const char *msg2)
55
50
{
56
51
    if (NULL != msg1) PR_fprintf(err, "%s ", msg1);
58
53
    failed = PR_TRUE;
59
54
}  /* Failed */
60
55
 
61
 
#else
62
 
#include "prlog.h"
63
 
#define printf PR_LogPrint
64
 
extern void SetupMacPrintfLog(char *logFile);
65
 
static void Failed(const char *msg1, const char *msg2)
66
 
{
67
 
    if (NULL != msg1) printf("%s ", msg1);
68
 
    printf (msg2);
69
 
    failed |= PR_TRUE;
70
 
}  /* Failed */
71
 
 
72
 
#endif
73
 
 
74
56
static PRSockOption Incr(PRSockOption *option)
75
57
{
76
58
    PRIntn val = ((PRIntn)*option) + 1;
78
60
    return (PRSockOption)val;
79
61
}  /* Incr */
80
62
 
81
 
PRIntn main(PRIntn argc, char *argv)
 
63
int main(int argc, char **argv)
82
64
{
83
65
    PRStatus rv;
84
66
    PRFileDesc *udp = PR_NewUDPSocket();
110
92
    err = PR_GetSpecialFD(PR_StandardError);
111
93
    PR_STDIO_INIT();
112
94
 
113
 
#ifdef XP_MAC
114
 
        SetupMacPrintfLog("sockopt.log");
115
 
#endif
116
 
 
117
95
    if (NULL == udp) Failed("PR_NewUDPSocket()", NULL);
118
96
    else if (NULL == tcp) Failed("PR_NewTCPSocket()", NULL);
119
97
    else
136
114
                case PR_SockOpt_Nonblocking:
137
115
                    data.value.non_blocking = PR_TRUE;
138
116
                    break;    
 
117
#ifndef SYMBIAN
139
118
                case PR_SockOpt_Linger:
140
119
                    data.value.linger.polarity = PR_TRUE;
141
120
                    data.value.linger.linger = PR_SecondsToInterval(2);          
142
121
                    break;    
 
122
#endif
143
123
                case PR_SockOpt_Reuseaddr:
144
124
                    data.value.reuse_addr = PR_TRUE;      
145
125
                    break;    
152
132
                case PR_SockOpt_SendBufferSize:  
153
133
                    data.value.send_buffer_size = segment;  
154
134
                    break;    
 
135
#ifndef SYMBIAN
155
136
                case PR_SockOpt_IpTimeToLive:
156
137
                    data.value.ip_ttl = 64;  
157
138
                    break;    
166
147
                    fd = udp; 
167
148
                    data.value.mcast_loopback = PR_TRUE; 
168
149
                    break;    
 
150
#endif
169
151
                case PR_SockOpt_NoDelay:
170
152
                    data.value.no_delay = PR_TRUE;         
171
153
                    break;    
174
156
                    data.value.max_segment = segment;      
175
157
                    break;    
176
158
#endif
 
159
#ifndef SYMBIAN
177
160
                case PR_SockOpt_Broadcast:
178
161
                    fd = udp; 
179
162
                    data.value.broadcast = PR_TRUE;         
180
163
                    break;    
 
164
#endif
181
165
                default: continue;
182
166
            }
183
167
 
201
185
        PR_Close(udp);
202
186
        PR_Close(tcp);
203
187
    }
204
 
#ifndef XP_MAC
205
188
    PR_fprintf(err, "%s\n", (failed) ? "FAILED" : "PASSED");
206
 
#else
207
 
   printf("%s\n", (failed) ? "FAILED" : "PASSED");
208
 
#endif
209
189
    return (failed) ? 1 : 0;
210
190
}  /* main */
211
191