test_fd.c 2.45 KB
Newer Older
Lionel Gauthier's avatar
GPLv3  
Lionel Gauthier committed
1 2 3
/*******************************************************************************
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom
winckel's avatar
 
winckel committed
4

Lionel Gauthier's avatar
GPLv3  
Lionel Gauthier committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
    OpenAirInterface 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.


    OpenAirInterface 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
   see <http://www.gnu.org/licenses/>.

  Contact Information
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
  OpenAirInterface Dev  : openair4g-devel@eurecom.fr

  Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.

 *******************************************************************************/
winckel's avatar
 
winckel committed
29 30 31 32 33 34 35 36 37 38 39 40
#include "config.h"

#include <freeDiameter/freeDiameter-host.h>
#include <freeDiameter/libfdcore.h>

#include "test_utils.h"
#include "test_fd.h"

extern int fd_ext_add( char * filename, char * conffile );

void s6a_fd_init(void)
{
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
  struct peer_info peer;

  fd_g_debug_lvl = NONE;

  memset(&peer, 0, sizeof(struct peer_info));

  peer.pi_diamid = "hss.test.fr";
  peer.pi_diamidlen = strlen(peer.pi_diamid);

  /* Only SCTP */
  peer.config.pic_flags.pro4 = PI_P4_SCTP;
  peer.config.pic_flags.sec  = PI_SEC_NONE;
  peer.config.pic_flags.exp  = PI_EXP_NONE;

  peer.config.pic_port = 18678;

  if (fd_core_initialize() != 0) {
    fail("fd_core_initialize failed");
  }

  if (fd_core_start() != 0) {
    fail("fd_core_start failed");
  }

  if (fd_core_parseconf("../../conf/hss_fd.conf") != 0) {
    fail("fd_core_waitstartcomplete failed");
  }

  if (fd_core_waitstartcomplete() != 0) {
    fail("fd_core_waitstartcomplete failed");
  }

  //     if (fd_peer_add(&peer, NULL, NULL, NULL) != 0) {
  //         fail("fd_peer_add failed");
  //     }
winckel's avatar
 
winckel committed
76 77 78 79
}

void s6a_fd_stop(void)
{
80 81 82 83 84 85 86
  if (fd_core_shutdown() != 0) {
    fail("fd_core_shutdown failed");
  }

  if (fd_core_wait_shutdown_complete() != 0) {
    fail("fd_core_shutdown failed");
  }
winckel's avatar
 
winckel committed
87
}