Overview
Comment: | OFSCTPSocket: Don't require -lsctp |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
abe832b03d7c3d6f2145e9337275775e |
User & Date: | js on 2024-10-25 22:38:31 |
Other Links: | manifest | tags |
Context
2024-10-26
| ||
11:29 | Make SCTP work on Solaris check-in: a65e33b00a user: js tags: trunk | |
2024-10-25
| ||
22:38 | OFSCTPSocket: Don't require -lsctp check-in: abe832b03d user: js tags: trunk | |
2024-10-22
| ||
22:29 | -[OHGameController {retrieve -> update}State] check-in: 23e3ffff7a user: js tags: trunk | |
Changes
Modified configure.ac from [6e067ef893] to [7abd4315da].
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | [Whether we have netinet/in.h]) ]) AC_CHECK_HEADER(netinet/tcp.h, [ AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1, [Whether we have netinet/tcp.h]) ]) AC_CHECK_HEADER(netinet/sctp.h, [ | < | | | | < < < < < | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | [Whether we have netinet/in.h]) ]) AC_CHECK_HEADER(netinet/tcp.h, [ AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1, [Whether we have netinet/tcp.h]) ]) AC_CHECK_HEADER(netinet/sctp.h, [ AC_DEFINE(OF_HAVE_SCTP, 1, [Whether we have SCTP]) AC_DEFINE(OF_HAVE_NETINET_SCTP_H, 1, [Whether we have netinet/sctp.h]) AC_SUBST(USE_SRCS_SCTP, '${SRCS_SCTP}') ]) AC_CHECK_HEADERS([arpa/inet.h netdb.h sys/sockio.h]) AC_CHECK_HEADERS([net/if.h], [], [], [ #ifdef OF_HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif ]) |
︙ | ︙ |
Modified src/OFSCTPSocket.m from [9e13ccf40f] to [c5135980c9].
︙ | ︙ | |||
359 360 361 362 363 364 365 | info: (OFSCTPMessageInfo *)info { ssize_t ret; struct iovec iov = { .iov_base = buffer, .iov_len = length }; | | | | | > > > > | < | > > > > > > > > > | > | | | > | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | info: (OFSCTPMessageInfo *)info { ssize_t ret; struct iovec iov = { .iov_base = buffer, .iov_len = length }; char cmsgBuffer[CMSG_SPACE(sizeof(struct sctp_rcvinfo))]; struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1, .msg_control = cmsgBuffer, .msg_controllen = sizeof(cmsgBuffer) }; struct cmsghdr *cmsg; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if ((ret = recvmsg(_socket, &msg, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; if (info == NULL) return ret; *info = nil; for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if (cmsg->cmsg_level != IPPROTO_SCTP) continue; if (cmsg->cmsg_type == SCTP_RCVINFO) { struct sctp_rcvinfo rcvinfo; memcpy(&rcvinfo, CMSG_DATA(cmsg), sizeof(rcvinfo)); OFNumber *streamID = [OFNumber numberWithUnsignedShort: rcvinfo.rcv_sid]; OFNumber *PPID = [OFNumber numberWithUnsignedLong: rcvinfo.rcv_ppid]; OFNumber *unordered = [OFNumber numberWithBool: (rcvinfo.rcv_flags & SCTP_UNORDERED)]; *info = [OFDictionary dictionaryWithKeysAndObjects: OFSCTPStreamID, streamID, OFSCTPPPID, PPID, OFSCTPUnordered, unordered, nil]; break; } } return ret; } - (void)asyncReceiveWithInfoIntoBuffer: (void *)buffer length: (size_t)length |
︙ | ︙ | |||
465 466 467 468 469 470 471 472 473 474 475 476 477 478 | .snd_sid = (uint16_t) [[info objectForKey: OFSCTPStreamID] unsignedShortValue], .snd_ppid = (uint32_t) [[info objectForKey: OFSCTPPPID] unsignedLongValue], .snd_flags = ([[info objectForKey: OFSCTPUnordered] boolValue] ? SCTP_UNORDERED : 0) }; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; | > > > > > > > > > > > | | > | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | .snd_sid = (uint16_t) [[info objectForKey: OFSCTPStreamID] unsignedShortValue], .snd_ppid = (uint32_t) [[info objectForKey: OFSCTPPPID] unsignedLongValue], .snd_flags = ([[info objectForKey: OFSCTPUnordered] boolValue] ? SCTP_UNORDERED : 0) }; char cmsgBuffer[CMSG_SPACE(sizeof(sndinfo))]; struct cmsghdr *cmsg = (struct cmsghdr *)(void *)&cmsgBuffer; struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1, .msg_control = &cmsgBuffer, .msg_controllen = sizeof(cmsgBuffer) }; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDINFO; cmsg->cmsg_len = CMSG_LEN(sizeof(sndinfo)); memcpy(CMSG_DATA(cmsg), &sndinfo, sizeof(sndinfo)); if ((bytesWritten = sendmsg(_socket, &msg, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #ifndef OF_SOLARIS |
︙ | ︙ |