llme: add MAC_ME_INFO-ind indication to notify of FP capability changes
Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
c26e9df6e7
commit
e31ee2ae7f
|
@ -1,6 +1,17 @@
|
|||
#include <libdect.h>
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* LLME Ops
|
||||
*/
|
||||
|
||||
static void llme_mac_me_info_ind(struct dect_handle *dh,
|
||||
const struct dect_fp_capabilities *fpc)
|
||||
{
|
||||
}
|
||||
|
||||
static struct dect_llme_ops_ dummy_llme_ops;
|
||||
|
||||
/*
|
||||
* LCE Ops
|
||||
*/
|
||||
|
@ -287,11 +298,19 @@ static struct dect_ss_ops dummy_ss_ops;
|
|||
|
||||
void dect_dummy_ops_init(struct dect_ops *ops)
|
||||
{
|
||||
struct dect_llme_ops_ *llme_ops;
|
||||
struct dect_lce_ops *lce_ops;
|
||||
struct dect_cc_ops *cc_ops;
|
||||
struct dect_mm_ops *mm_ops;
|
||||
struct dect_ss_ops *ss_ops;
|
||||
|
||||
if (!ops->llme_ops)
|
||||
ops->llme_ops = &dummy_llme_ops;
|
||||
llme_ops = (void *)ops->llme_ops;
|
||||
|
||||
if (!llme_ops->mac_me_info_ind)
|
||||
llme_ops->mac_me_info_ind = llme_mac_me_info_ind;
|
||||
|
||||
if (!ops->lce_ops)
|
||||
ops->lce_ops = &dummy_lce_ops;
|
||||
lce_ops = (void *)ops->lce_ops;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <dect/identities.h>
|
||||
#include <dect/auth.h>
|
||||
#include <dect/llme.h>
|
||||
#include <dect/lce.h>
|
||||
#include <dect/cc.h>
|
||||
#include <dect/mm.h>
|
||||
|
@ -130,6 +131,7 @@ struct dect_ops {
|
|||
void (*free)(void *ptr);
|
||||
|
||||
const struct dect_event_ops *event_ops;
|
||||
const struct dect_llme_ops_ *llme_ops;
|
||||
const struct dect_lce_ops *lce_ops;
|
||||
const struct dect_cc_ops *cc_ops;
|
||||
const struct dect_mm_ops *mm_ops;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef _LIBDECT_DECT_LLME_H
|
||||
#define _LIBDECT_DECT_LLME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup llme
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fixed part capabilities
|
||||
*/
|
||||
struct dect_fp_capabilities {
|
||||
uint32_t fpc; /**< fixed part capabilities */
|
||||
uint16_t hlc; /**< higher layer capabilities */
|
||||
uint16_t efpc; /**< extended fixed part capabilities */
|
||||
uint32_t ehlc; /**< extended higher layer capabilities */
|
||||
uint16_t efpc2; /**< extended fixed part capabilities 2 */
|
||||
uint32_t ehlc2; /**< extended higher layer capabilities 2 */
|
||||
};
|
||||
|
||||
|
||||
struct dect_handle;
|
||||
struct dect_llme_ops_ {
|
||||
void (*mac_me_info_ind)(struct dect_handle *dh,
|
||||
const struct dect_fp_capabilities *fpc);
|
||||
};
|
||||
|
||||
extern const struct dect_fp_capabilities *dect_llme_fp_capabilities(const struct dect_handle *dh);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _LIBDECT_DECT_RAW_H */
|
|
@ -5,15 +5,7 @@
|
|||
#include <dect/libdect.h>
|
||||
#include <debug.h>
|
||||
#include <list.h>
|
||||
|
||||
struct dect_fp_capabilities {
|
||||
uint32_t fpc;
|
||||
uint16_t hlc;
|
||||
uint16_t efpc;
|
||||
uint32_t ehlc;
|
||||
uint16_t efpc2;
|
||||
uint32_t ehlc2;
|
||||
};
|
||||
#include <lce.h>
|
||||
|
||||
enum dect_pp_identities {
|
||||
DECT_PP_IPUI = 0x1,
|
||||
|
@ -39,7 +31,6 @@ enum dect_pp_identities {
|
|||
* @links: list of data links
|
||||
* @mme_list: MM endpoint list
|
||||
*/
|
||||
#include <lce.h>
|
||||
struct dect_handle {
|
||||
const struct dect_ops *ops;
|
||||
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup llme Lower Layer Management Entity (LLME)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -32,8 +37,9 @@
|
|||
|
||||
struct dect_netlink_handler {
|
||||
struct dect_handle *dh;
|
||||
void (*rcv)(struct dect_handle *,
|
||||
void (*rcv)(struct dect_handle *, bool,
|
||||
struct nl_object *);
|
||||
bool request;
|
||||
};
|
||||
|
||||
static void __maybe_unused dect_netlink_obj_dump(struct nl_object *obj)
|
||||
|
@ -56,7 +62,7 @@ static void dect_netlink_obj_rcv(struct nl_object *obj, void *arg)
|
|||
{
|
||||
struct dect_netlink_handler *handler = arg;
|
||||
|
||||
handler->rcv(handler->dh, obj);
|
||||
handler->rcv(handler->dh, handler->request, obj);
|
||||
}
|
||||
|
||||
static int dect_netlink_msg_rcv(struct nl_msg *msg, void *arg)
|
||||
|
@ -115,7 +121,8 @@ static void dect_netlink_parse_ari(struct dect_ari *ari, const struct nl_dect_ar
|
|||
}
|
||||
}
|
||||
|
||||
static void dect_netlink_cluster_rcv(struct dect_handle *dh, struct nl_object *obj)
|
||||
static void dect_netlink_cluster_rcv(struct dect_handle *dh, bool request,
|
||||
struct nl_object *obj)
|
||||
{
|
||||
struct nl_dect_cluster *cl = nl_object_priv(obj);
|
||||
|
||||
|
@ -154,6 +161,17 @@ static int dect_netlink_get_cluster(struct dect_handle *dh, const char *name)
|
|||
* LLME
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get FP capabilities
|
||||
*
|
||||
* @param dh libdect DECT handle
|
||||
*/
|
||||
const struct dect_fp_capabilities *dect_llme_fp_capabilities(const struct dect_handle *dh)
|
||||
{
|
||||
return &dh->fpc;
|
||||
}
|
||||
EXPORT_SYMBOL(dect_llme_fp_capabilities);
|
||||
|
||||
static void dect_fp_capabilities_dump(struct dect_fp_capabilities *fpc)
|
||||
{
|
||||
char buf1[256], buf2[256], buf3[256];
|
||||
|
@ -173,7 +191,7 @@ static void dect_fp_capabilities_dump(struct dect_fp_capabilities *fpc)
|
|||
buf2, buf2[0] && buf3[0] ? "," : "", buf3);
|
||||
}
|
||||
|
||||
static void dect_netlink_llme_mac_info_rcv(struct dect_handle *dh,
|
||||
static void dect_netlink_llme_mac_info_rcv(struct dect_handle *dh, bool request,
|
||||
struct nl_dect_llme_msg *lmsg)
|
||||
{
|
||||
struct dect_fp_capabilities *fpc = &dh->fpc;
|
||||
|
@ -186,9 +204,12 @@ static void dect_netlink_llme_mac_info_rcv(struct dect_handle *dh,
|
|||
fpc->ehlc2 = nl_dect_llme_mac_info_get_ehlc2(lmsg);
|
||||
|
||||
dect_fp_capabilities_dump(fpc);
|
||||
if (!request)
|
||||
dh->ops->llme_ops->mac_me_info_ind(dh, fpc);
|
||||
}
|
||||
|
||||
static void dect_netlink_llme_rcv(struct dect_handle *dh, struct nl_object *obj)
|
||||
static void dect_netlink_llme_rcv(struct dect_handle *dh, bool request,
|
||||
struct nl_object *obj)
|
||||
{
|
||||
struct nl_dect_llme_msg *lmsg = nl_object_priv(obj);
|
||||
enum dect_llme_msg_types type;
|
||||
|
@ -200,7 +221,7 @@ static void dect_netlink_llme_rcv(struct dect_handle *dh, struct nl_object *obj)
|
|||
#define LLME_MSG(type, op) (type << 16 | op)
|
||||
switch (LLME_MSG(type, op)) {
|
||||
case LLME_MSG(DECT_LLME_MAC_INFO, DECT_LLME_INDICATE):
|
||||
return dect_netlink_llme_mac_info_rcv(dh, lmsg);
|
||||
return dect_netlink_llme_mac_info_rcv(dh, request, lmsg);
|
||||
default:
|
||||
nl_debug("unknown LLME message: type: %u op: %u\n", type, op);
|
||||
dect_netlink_obj_dump(obj);
|
||||
|
@ -210,8 +231,9 @@ static void dect_netlink_llme_rcv(struct dect_handle *dh, struct nl_object *obj)
|
|||
static int dect_netlink_mac_info_req(struct dect_handle *dh)
|
||||
{
|
||||
struct dect_netlink_handler handler = {
|
||||
.dh = dh,
|
||||
.rcv = dect_netlink_llme_rcv,
|
||||
.dh = dh,
|
||||
.rcv = dect_netlink_llme_rcv,
|
||||
.request = true,
|
||||
};
|
||||
struct nl_dect_llme_msg *lmsg;
|
||||
int err;
|
||||
|
@ -318,3 +340,5 @@ void dect_netlink_exit(struct dect_handle *dh)
|
|||
nl_socket_free(dh->nlsock);
|
||||
dect_free(dh, dh->nlfd);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
Reference in New Issue