如何配置DTLS echo服务器和客户端代码?

时间:2017-11-29 09:51:08

标签: openssl sctp dtls

我找到了DTLS SCTP示例代码的Web存档。 http://web.archive.org/web/20150617012520/http://sctp.fh-muenster.de/dtls-samples.html

我想运行DTLS echo服务器和客户端。但是,我无法编译。 这是错误内容:

$gcc dtls-over-sctp-echo.c -o main -I /usr/local/ssl/include -L/usr/local/ssl/lib -lssl -lcrypto -lpthread -Wall
         dtls-over-sctp-echo.c: In function ‘connection_handle’:
        dtls-over-sctp-echo.c:219:32: error: storage size of ‘rinfo’ isn’t known
          struct bio_dgram_sctp_rcvinfo rinfo;
                                        ^
        dtls-over-sctp-echo.c:228:8: warning: implicit declaration of function ‘BIO_new_dgram_sctp’ [-Wimplicit-function-declaration]
          bio = BIO_new_dgram_sctp(pinfo->fd, BIO_NOCLOSE);
                ^
        dtls-over-sctp-echo.c:228:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
          bio = BIO_new_dgram_sctp(pinfo->fd, BIO_NOCLOSE);
              ^
        dtls-over-sctp-echo.c:232:3: warning: implicit declaration of function ‘BIO_dgram_sctp_notification_cb’ [-Wimplicit-function-declaration]
           BIO_dgram_sctp_notification_cb(bio, &handle_notifications, (void*) ssl);
           ^
        dtls-over-sctp-echo.c:291:21: error: ‘BIO_CTRL_DGRAM_SCTP_GET_RCVINFO’ undeclared (first use in this function)
               BIO_ctrl(bio, BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(struct bio_dgram_sctp_rcvinfo), &rinf
                             ^
        dtls-over-sctp-echo.c:291:21: note: each undeclared identifier is reported only once for each function it appears in
        dtls-over-sctp-echo.c:291:61: error: invalid application of ‘sizeof’ to incomplete type ‘struct bio_dgram_sctp_rcvinfo’
               BIO_ctrl(bio, BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(struct bio_dgram_sctp_rcvinfo), &rinf

谢谢!

1 个答案:

答案 0 :(得分:0)

  1. 使用以下命令再次尝试构建openssl源代码:

    ./config --prefix=/usr --openssldir=/usr/lib/ssl --libdir=lib shared sctp

  2. 安装openssl

  3. 使用新的openssl库重建dtls_sctp_echo.c