Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
map-controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
map-controller
Commits
aa5a1857
Commit
aa5a1857
authored
3 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
cntlr: fix ieee1905 resubscribe
parent
253cc9dd
No related branches found
No related tags found
No related merge requests found
Pipeline
#39650
failed
3 years ago
Stage: static_code_analysis
Stage: checkpatch
Stage: functional_test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cntlr.c
+61
-1
61 additions, 1 deletion
src/cntlr.c
src/cntlr.h
+1
-2
1 addition, 2 deletions
src/cntlr.h
with
62 additions
and
3 deletions
src/cntlr.c
+
61
−
1
View file @
aa5a1857
...
...
@@ -58,7 +58,7 @@ void stop_cntlr(struct controller *c)
exit
(
0
);
}
ubus_unregister_event_handler
(
c
->
ubus_ctx
,
&
c
->
ieee1905_
evh
);
ubus_unregister_event_handler
(
c
->
ubus_ctx
,
&
c
->
evh
);
cntlr_remove_object
(
c
);
cmdu_ackq_free
(
&
c
->
cmdu_ack_q
);
uloop_done
();
...
...
@@ -2371,6 +2371,63 @@ static void cntlr_ackq_delete_cb(struct cmdu_ackq *q, struct cmdu_ackq_entry *e)
cmdu_free
(
cmdu
);
}
static
void
uobj_add_event_handler
(
void
*
cntlr
,
struct
blob_attr
*
msg
)
{
char
path
[
32
]
=
{
0
};
uint32_t
id
=
0
;
struct
controller
*
c
=
(
struct
controller
*
)
cntlr
;
struct
blob_attr
*
tb
[
2
];
static
const
struct
blobmsg_policy
ev_attr
[
2
]
=
{
[
0
]
=
{
.
name
=
"id"
,
.
type
=
BLOBMSG_TYPE_INT32
},
[
1
]
=
{
.
name
=
"path"
,
.
type
=
BLOBMSG_TYPE_STRING
}
};
blobmsg_parse
(
ev_attr
,
2
,
tb
,
blob_data
(
msg
),
blob_len
(
msg
));
if
(
!
tb
[
0
]
||
!
tb
[
1
])
return
;
strncpy
(
path
,
blobmsg_data
(
tb
[
1
]),
sizeof
(
path
)
-
1
);
id
=
(
uint32_t
)
blobmsg_get_u32
(
tb
[
0
]);
dbg
(
"|%s:%d| path = [%s] id = [%d] [%u]
\n
"
,
__func__
,
__LINE__
,
path
,
id
,
id
);
if
(
!
strncmp
(
path
,
map_plugin
,
strlen
(
map_plugin
)))
{
/* TODO: how to handle failure? */
controller_subscribe_for_cmdus
(
c
);
}
}
static
void
cntlr_event_handler
(
struct
ubus_context
*
ctx
,
struct
ubus_event_handler
*
ev
,
const
char
*
type
,
struct
blob_attr
*
msg
)
{
int
i
;
char
*
str
;
struct
controller
*
c
=
container_of
(
ev
,
struct
controller
,
evh
);
struct
wifi_ev_handler
{
const
char
*
ev_type
;
void
(
*
handler
)(
void
*
ctx
,
struct
blob_attr
*
ev_data
);
}
evs
[]
=
{
{
"ubus.object.add"
,
uobj_add_event_handler
}
};
str
=
blobmsg_format_json
(
msg
,
true
);
if
(
!
str
)
return
;
info
(
"[ &controller = %p ] Received [event = %s] [val = %s]
\n
"
,
c
,
type
,
str
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
evs
);
i
++
)
{
if
(
!
strcmp
(
type
,
evs
[
i
].
ev_type
))
evs
[
i
].
handler
(
c
,
msg
);
}
free
(
str
);
}
int
start_controller
(
void
)
{
struct
controller
*
c
;
...
...
@@ -2448,6 +2505,9 @@ int start_controller(void)
uloop_timeout_set
(
&
c
->
signal_handler
,
5
*
1000
);
uloop_timeout_set
(
&
c
->
query_nodes
,
60
*
1000
);
c
->
evh
.
cb
=
cntlr_event_handler
;
ubus_register_event_handler
(
ctx
,
&
c
->
evh
,
"ubus.object.*"
);
controller_subscribe_for_cmdus
(
c
);
...
...
This diff is collapsed.
Click to expand it.
src/cntlr.h
+
1
−
2
View file @
aa5a1857
...
...
@@ -359,8 +359,7 @@ struct controller {
void
*
comm
;
struct
ubus_object
obj
;
struct
ubus_context
*
ubus_ctx
;
/* struct ubus_event_handler ubus_ev; */
/** for local events */
struct
ubus_event_handler
ieee1905_evh
;
struct
ubus_event_handler
evh
;
struct
uloop_timeout
heartbeat
;
int
num_nodes
;
int
num_tx_links
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment