blob: 86adf405815f319baf25165e9752687e2edc034e (
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
|
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <dect/libdect.h>
#include "common.h"
const char *cluster;
struct dect_ipui ipui = {
.put = DECT_IPUI_N,
.pun.n.ipei = {
.emc = 0x0ba8,
.psn = 0xa782a,
},
};
int dect_parse_ipui(struct dect_ipui *ipui, const char *optarg)
{
ipui->put = DECT_IPUI_N;
if (sscanf(optarg, "%04hx%05x",
&ipui->pun.n.ipei.emc,
&ipui->pun.n.ipei.psn) != 2) {
fprintf(stderr, "could not parse IPUI '%s'\n", optarg);
return -1;
}
return 0;
}
void pexit(const char *str)
{
perror(str);
exit(1);
}
void dect_common_init(struct dect_ops *ops, const char *cluster)
{
dect_debug_init();
dect_dummy_ops_init(ops);
if (dect_event_ops_init(ops))
pexit("dect_event_ops_init");
dh = dect_open_handle(ops, cluster);
if (dh == NULL)
pexit("dect_init");
}
void dect_common_cleanup(struct dect_handle *dh)
{
dect_close_handle(dh);
dect_event_ops_cleanup();
}
|