| 1 | /* Does this host have SCTP? |
| 2 | * |
| 3 | * Copyright 2003 La Monte HP Yarroll <[email protected]> |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. Redistributions in binary form must reproduce the above |
| 12 | * copyright notice, this list of conditions and the following |
| 13 | * disclaimer in the documentation and/or other materials provided with |
| 14 | * the distribution. |
| 15 | * 3. The name of the author may not be used to endorse or promote |
| 16 | * products derived from this software without specific prior written |
| 17 | * permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 23 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 25 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 27 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 28 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 29 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> |
| 33 | #include <unistd.h> |
| 34 | #include <sys/socket.h> |
| 35 | #include <netinet/in.h> |
| 36 | |
| 37 | /* IPPROTO_SCTP SHOULD be defined in |
| 38 | * /usr/include/linux/in.h but probably isn't. |
| 39 | * It is an enum element, not a #define, so we can't easily check. |
| 40 | */ |
| 41 | #define SHOULD_IPPROTO_SCTP 132 |
| 42 | |
| 43 | int main(void) |
| 44 | { |
| 45 | int fd; |
| 46 | |
| 47 | fd = socket(PF_INET, SOCK_STREAM, SHOULD_IPPROTO_SCTP); |
| 48 | |
| 49 | if (fd <= 0) { |
| 50 | perror("checksctp"); |
| 51 | exit(1); |
| 52 | } else { |
| 53 | fprintf(stderr, "SCTP supported\n"); |
| 54 | } |
| 55 | |
| 56 | close(fd); |
| 57 | return 0; |
| 58 | } |