summaryrefslogtreecommitdiffstats
path: root/tinyBFCP/test/test_session.h
blob: 0ec239c28999b8f2defe55fd348a579608253147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright (C) 2014 Mamadou DIOP.
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TEST_TINYBFCP_SESSION_H
#define TEST_TINYBFCP_SESSION_H

#include "tinybfcp.h"

static void test_session_tcp()
{
}

static void test_session_udp()
{
    struct tbfcp_session_s* p_session = tsk_null;
    tbfcp_pkt_t* p_pkt = tsk_null;

    BAIL_IF_ERR(tbfcp_session_create(tnet_socket_type_udp_ipv4, kLocalIP, &p_session));
    BAIL_IF_ERR(tbfcp_session_set_remote(p_session, kRemoteIP, kRemotePort));
    BAIL_IF_ERR(tbfcp_session_prepare(p_session));
    BAIL_IF_ERR(tbfcp_session_start(p_session));
    TSK_DEBUG_INFO("PRESS ENTER to continue");
    getchar();

    BAIL_IF_ERR(tbfcp_pkt_create_FloorRequest_2(kConfId, kTransacId, kUserId, kFloorId, &p_pkt));
    BAIL_IF_ERR(tbfcp_session_send_pkt(p_session, p_pkt));
    TSK_DEBUG_INFO("PRESS ENTER to continue");
    getchar();

    TSK_OBJECT_SAFE_FREE(p_pkt);
    BAIL_IF_ERR(tbfcp_pkt_create_Hello(kConfId, kTransacId, kUserId, &p_pkt));
    BAIL_IF_ERR(tbfcp_session_send_pkt(p_session, p_pkt));
    TSK_DEBUG_INFO("PRESS ENTER to continue");
    getchar();

bail:
    TSK_OBJECT_SAFE_FREE(p_pkt);
    TSK_OBJECT_SAFE_FREE(p_session);
}

static void test_session()
{
    test_session_tcp();
    test_session_udp();
}

#endif /* TEST_TINYBFCP_SESSION_H */
OpenPOWER on IntegriCloud