netifd [11] - wireless

數據結構

/** 無線驅動對象 */
struct wireless_driver {
    struct avl_node node;

    const char *name;
    const char *script;

    struct {
        char *buf;
        struct uci_blob_param_list *config;
    } device, interface;
};

/** 無線device對象 */
struct wireless_device {
    struct vlist_node node;

    struct wireless_driver *drv; /** wireless drive object */
    struct vlist_tree interfaces;
    char *name;

    struct netifd_process script_task;
    struct uloop_timeout timeout;
    struct uloop_timeout poll;

    struct list_head script_proc;
    struct uloop_fd script_proc_fd;
    struct uloop_timeout script_check;

    struct ubus_request_data *kill_request;

    struct blob_attr *config;
    struct blob_attr *data;

    bool config_autostart;
    bool autostart;
    bool disabled;

    enum interface_state state;
    enum interface_config_state config_state;
    bool cancel;
    int retry;

    int vif_idx;
};

/** 無線interface對象 */
struct wireless_interface {
    struct vlist_node node;
    const char *section;
    char *name;

    struct wireless_device *wdev;

    struct blob_attr *config;
    struct blob_attr *data;

    const char *ifname;
    struct blob_attr *network;
};

struct wireless_process {
    struct list_head list;

    const char *exe;
    int pid;

    bool required;
};

接口說明

/** 
 * 初始化無線模塊 
 */
void wireless_init(void)

/**
 * 啓用全部處於掛起的wireless device對象
 */
void wireless_start_pending(void)
/** 
 * 建立wireless device對象
 */
void wireless_device_create(struct wireless_driver *drv, const char *name, struct blob_attr *data)

/**
 * 建立wireless interface對象
 */
void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section)
/**
 * 啓用wireless device
 */
void wireless_device_set_up(struct wireless_device *wdev)

/**
 * 停用wireless device
 */
void wireless_device_set_down(struct wireless_device *wdev)
/**
 * 獲取wireless device狀態信息
 */
void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b)

/**
 * 獲取wireless device有效信息
 */
void wireless_device_get_validate(struct wireless_device *wdev, struct blob_buf *b)
/**
 * wireless device消息處理
 */
int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
               struct ubus_request_data *req)
相關文章
相關標籤/搜索