File size: 2,845 Bytes
258fb37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
 *
 * This file is part of Open5GS.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(OGS_DIAMETER_INSIDE) && !defined(OGS_DIAMETER_COMPILATION)
#error "This header cannot be included directly."
#endif

#ifndef OGS_DIAM_BASE_H
#define OGS_DIAM_BASE_H

#ifdef __cplusplus
extern "C" {
#endif

/* This is default diameter configuration if there is no config file
 * The Configuration : No TLS, Only TCP */
typedef struct ogs_diam_config_s {
    /* Diameter Identity of the local peer (FQDN -- ASCII) */
    const char *cnf_diamid;
    /* Diameter realm of the local peer, default to realm part of cnf_diamid */
    const char *cnf_diamrlm;
    /* IP address of the local peer */
    const char *cnf_addr;

    /* the local port for legacy Diameter (default: 3868) in host byte order */
    uint16_t cnf_port;
    /* the local port for Diameter/TLS (default: 5658) in host byte order */
    uint16_t cnf_port_tls;

    /* default TC timer */
    int cnf_timer_tc;

    struct {
        /* the peer does not relay messages (0xffffff app id) */
        unsigned no_fwd: 1;
        /* disable the use of SCTP */
        unsigned no_sctp: 1;
    } cnf_flags;

#define MAX_NUM_OF_FD_EXTENSION 32
    struct {
        const char *module;
        const char *conf;
    } ext[MAX_NUM_OF_FD_EXTENSION];
    int num_of_ext;

#define MAX_NUM_OF_FD_CONN 16
    /* (supposedly) UTF-8, \0 terminated.
     * The Diameter Identity of the remote peer. */
    struct {
        const char *identity;
        const char *addr; /* IP address of the remote peer */
        uint16_t port; /* port to connect to. 0: default. */
        int tc_timer; /* TcTimer value to use for this peer, use default if 0 */
    } conn[MAX_NUM_OF_FD_CONN];
    int num_of_conn;
} ogs_diam_config_t;

int ogs_diam_init(int mode, const char *conffile, ogs_diam_config_t *fd_config);
int ogs_diam_start(void);
void ogs_diam_final(void);

int ogs_diam_config_init(ogs_diam_config_t *fd_config);
bool ogs_diam_app_connected(uint32_t app_id);

int fd_avp_search_avp ( struct avp * groupedavp,
        struct dict_object * what, struct avp ** avp );

#ifdef __cplusplus
}
#endif

#endif /* OGS_DIAM_BASE_H */