OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * pkix_pl_socket.c | 5 * pkix_pl_socket.c |
6 * | 6 * |
7 * Socket Function Definitions | 7 * Socket Function Definitions |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 * PARAMETERS: | 55 * PARAMETERS: |
56 * none | 56 * none |
57 * THREAD SAFETY: | 57 * THREAD SAFETY: |
58 * Thread Safe (see Thread Safety definitions in Programmer's Guide) | 58 * Thread Safe (see Thread Safety definitions in Programmer's Guide) |
59 * RETURNS: | 59 * RETURNS: |
60 * none | 60 * none |
61 */ | 61 */ |
62 static void pkix_pl_socket_timestamp() { | 62 static void pkix_pl_socket_timestamp() { |
63 PRInt64 prTime; | 63 PRInt64 prTime; |
64 prTime = PR_Now(); | 64 prTime = PR_Now(); |
| 65 /* We shouldn't use PR_ALTERNATE_INT64_TYPEDEF, but nor can we use PRId64 */ |
| 66 #if PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF) |
| 67 printf("%ld:\n", prTime); |
| 68 #else |
65 printf("%lld:\n", prTime); | 69 printf("%lld:\n", prTime); |
| 70 #endif |
66 } | 71 } |
67 | 72 |
68 /* | 73 /* |
69 * FUNCTION: pkix_pl_socket_hexDigit | 74 * FUNCTION: pkix_pl_socket_hexDigit |
70 * DESCRIPTION: | 75 * DESCRIPTION: |
71 * | 76 * |
72 * This functions prints to stdout the byte "byteVal" as two hex digits. | 77 * This functions prints to stdout the byte "byteVal" as two hex digits. |
73 * | 78 * |
74 * PARAMETERS: | 79 * PARAMETERS: |
75 * "byteVal" | 80 * "byteVal" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * PARAMETERS: | 138 * PARAMETERS: |
134 * "ptr" | 139 * "ptr" |
135 * The address of the first of the bytes to be printed | 140 * The address of the first of the bytes to be printed |
136 * THREAD SAFETY: | 141 * THREAD SAFETY: |
137 * Thread Safe (see Thread Safety definitions in Programmer's Guide) | 142 * Thread Safe (see Thread Safety definitions in Programmer's Guide) |
138 * RETURNS: | 143 * RETURNS: |
139 * none | 144 * none |
140 */ | 145 */ |
141 static void pkix_pl_socket_traceLine(char *ptr) { | 146 static void pkix_pl_socket_traceLine(char *ptr) { |
142 PKIX_UInt32 i = 0; | 147 PKIX_UInt32 i = 0; |
143 pkix_pl_socket_linePrefix((PKIX_UInt32)ptr); | 148 pkix_pl_socket_linePrefix((PKIX_UInt32)((char *)ptr - (char *)NULL)); |
144 for (i = 0; i < 16; i++) { | 149 for (i = 0; i < 16; i++) { |
145 printf(" "); | 150 printf(" "); |
146 pkix_pl_socket_hexDigit(ptr[i]); | 151 pkix_pl_socket_hexDigit(ptr[i]); |
147 if (i == 7) { | 152 if (i == 7) { |
148 printf(" "); | 153 printf(" "); |
149 } | 154 } |
150 } | 155 } |
151 printf(" "); | 156 printf(" "); |
152 for (i = 0; i < 16; i++) { | 157 for (i = 0; i < 16; i++) { |
153 if ((ptr[i] < ' ') || (ptr[i] > '}')) { | 158 if ((ptr[i] < ' ') || (ptr[i] > '}')) { |
(...skipping 23 matching lines...) Expand all Loading... |
177 * is greater than sixteen, the results will be unattractive. | 182 * is greater than sixteen, the results will be unattractive. |
178 * none | 183 * none |
179 * THREAD SAFETY: | 184 * THREAD SAFETY: |
180 * Thread Safe (see Thread Safety definitions in Programmer's Guide) | 185 * Thread Safe (see Thread Safety definitions in Programmer's Guide) |
181 * RETURNS: | 186 * RETURNS: |
182 * none | 187 * none |
183 */ | 188 */ |
184 static void pkix_pl_socket_tracePartialLine(char *ptr, PKIX_UInt32 nBytes) { | 189 static void pkix_pl_socket_tracePartialLine(char *ptr, PKIX_UInt32 nBytes) { |
185 PKIX_UInt32 i = 0; | 190 PKIX_UInt32 i = 0; |
186 if (nBytes > 0) { | 191 if (nBytes > 0) { |
187 pkix_pl_socket_linePrefix((PKIX_UInt32)ptr); | 192 pkix_pl_socket_linePrefix((PKIX_UInt32)((char *)ptr - (char *)NU
LL)); |
188 } | 193 } |
189 for (i = 0; i < nBytes; i++) { | 194 for (i = 0; i < nBytes; i++) { |
190 printf(" "); | 195 printf(" "); |
191 pkix_pl_socket_hexDigit(ptr[i]); | 196 pkix_pl_socket_hexDigit(ptr[i]); |
192 if (i == 7) { | 197 if (i == 7) { |
193 printf(" "); | 198 printf(" "); |
194 } | 199 } |
195 } | 200 } |
196 for (i = nBytes; i < 16; i++) { | 201 for (i = nBytes; i < 16; i++) { |
197 printf(" "); | 202 printf(" "); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 PKIX_UInt32 offset = 0; | 241 PKIX_UInt32 offset = 0; |
237 char *bufptr = (char *)buf; | 242 char *bufptr = (char *)buf; |
238 | 243 |
239 if (socketTraceFlag == PKIX_FALSE) return; | 244 if (socketTraceFlag == PKIX_FALSE) return; |
240 | 245 |
241 pkix_pl_socket_timestamp(); | 246 pkix_pl_socket_timestamp(); |
242 /* | 247 /* |
243 * Special case: if called with length of zero, just do address | 248 * Special case: if called with length of zero, just do address |
244 */ | 249 */ |
245 if (nBytes == 0) { | 250 if (nBytes == 0) { |
246 pkix_pl_socket_linePrefix((PKIX_UInt32)buf); | 251 pkix_pl_socket_linePrefix((PKIX_UInt32)((char *)buf - (char *)NU
LL)); |
247 printf("\n"); | 252 printf("\n"); |
248 } else { | 253 } else { |
249 while (bytesRemaining >= 16) { | 254 while (bytesRemaining >= 16) { |
250 pkix_pl_socket_traceLine(&bufptr[offset]); | 255 pkix_pl_socket_traceLine(&bufptr[offset]); |
251 bytesRemaining -= 16; | 256 bytesRemaining -= 16; |
252 offset += 16; | 257 offset += 16; |
253 } | 258 } |
254 pkix_pl_socket_tracePartialLine | 259 pkix_pl_socket_tracePartialLine |
255 (&bufptr[offset], bytesRemaining); | 260 (&bufptr[offset], bytesRemaining); |
256 } | 261 } |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 PRFileDesc **pDesc, | 1686 PRFileDesc **pDesc, |
1682 void *plContext) | 1687 void *plContext) |
1683 { | 1688 { |
1684 PKIX_ENTER(SOCKET, "pkix_pl_Socket_GetPRFileDesc"); | 1689 PKIX_ENTER(SOCKET, "pkix_pl_Socket_GetPRFileDesc"); |
1685 PKIX_NULLCHECK_TWO(socket, pDesc); | 1690 PKIX_NULLCHECK_TWO(socket, pDesc); |
1686 | 1691 |
1687 *pDesc = socket->clientSock; | 1692 *pDesc = socket->clientSock; |
1688 | 1693 |
1689 PKIX_RETURN(SOCKET); | 1694 PKIX_RETURN(SOCKET); |
1690 } | 1695 } |
OLD | NEW |