type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
structs | struct descriptor {
struct characteristic *ch;
uint16_t handle;
bt_uuid_t uuid;
}; |
structs | struct watcher {
struct thermometer *t;
guint id;
gchar *srv;
gchar *path;
}; |
structs | struct measurement {
gint16 exp;
gint32 mant;
guint64 time;
gboolean suptime;
gchar *unit;
gchar *type;
gchar *value;
}; |
functions | void destroy_watcher(gpointer user_data)
{
struct watcher *watcher = user_data;
if (watcher->id > 0)
g_dbus_remove_watch(watcher->t->conn, watcher->id);
g_free(watcher->path);
g_free(watcher->srv);
g_free(watcher);
} |
functions | void destroy_char(gpointer user_data)
{
struct characteristic *c = user_data;
g_slist_free_full(c->desc, g_free);
g_free(c);
} |
functions | void destroy_thermometer(gpointer user_data)
{
struct thermometer *t = user_data;
if (t->attioid > 0)
btd_device_remove_attio_callback(t->dev, t->attioid);
if (t->attindid > 0)
g_attrib_unregister(t->attrib, t->attindid);
if (t->attnotid > 0)
g_attrib_unregister(t->attrib, t->attnotid);
if (t->attrib != ... |
functions | gint cmp_device(gconstpointer a, gconstpointer b)
{
const struct thermometer *t = a;
const struct btd_device *dev = b;
if (dev == t->dev)
return 0;
return -1;
} |
functions | gint cmp_watcher(gconstpointer a, gconstpointer b)
{
const struct watcher *watcher = a;
const struct watcher *match = b;
int ret;
ret = g_strcmp0(watcher->srv, match->srv);
if (ret != 0)
return ret;
return g_strcmp0(watcher->path, match->path);
} |
functions | gint cmp_char_uuid(gconstpointer a, gconstpointer b)
{
const struct characteristic *ch = a;
const gchar *uuid = b;
return g_strcmp0(ch->attr.uuid, uuid);
} |
functions | gint cmp_char_val_handle(gconstpointer a, gconstpointer b)
{
const struct characteristic *ch = a;
const uint16_t *handle = b;
return ch->attr.value_handle - *handle;
} |
functions | gint cmp_descriptor(gconstpointer a, gconstpointer b)
{
const struct descriptor *desc = a;
const bt_uuid_t *uuid = b;
return bt_uuid_cmp(&desc->uuid, uuid);
} |
functions | void change_property(struct thermometer *t, const gchar *name,
gpointer value) {
if (g_strcmp0(name, "Intermediate") == 0) {
gboolean *intermediate = value;
if (t->intermediate == *intermediate)
return;
t->intermediate = *intermediate;
emit_property_changed(t->conn, device_get_path(t->dev),
THE... |
functions | void valid_range_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
struct descriptor *desc = user_data;
uint8_t value[ATT_MAX_MTU];
uint16_t max, min;
int vlen;
if (status != 0) {
DBG("Valid Range descriptor read failed: %s",
att_ecode2str(status));
return;
} |
functions | void process_thermometer_desc(struct descriptor *desc)
{
struct characteristic *ch = desc->ch;
char uuidstr[MAX_LEN_UUID_STR];
bt_uuid_t btuuid;
bt_uuid16_create(&btuuid, GATT_CLIENT_CHARAC_CFG_UUID);
if (bt_uuid_cmp(&desc->uuid, &btuuid) == 0) {
if (g_strcmp0(ch->attr.uuid,
TEMPERATURE_MEASUREMENT_UUID) ... |
functions | void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
struct characteristic *ch = user_data;
struct att_data_list *list;
guint8 format;
int i;
if (status != 0) {
error("Discover all characteristic descriptors failed [%s]: %s",
ch->attr.uuid, att_ecode2str(status)... |
functions | void read_temp_type_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
struct characteristic *ch = user_data;
struct thermometer *t = ch->t;
uint8_t value[ATT_MAX_MTU];
int vlen;
if (status != 0) {
DBG("Temperature Type value read failed: %s",
att_ecode2str(status));
return;... |
functions | void read_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
gpointer user_data)
{
struct characteristic *ch = user_data;
uint8_t value[ATT_MAX_MTU];
uint16_t interval;
int vlen;
if (status != 0) {
DBG("Measurement Interval value read failed: %s",
att_ecode2str(status));
return;
} |
functions | void process_thermometer_char(struct characteristic *ch)
{
if (g_strcmp0(ch->attr.uuid, INTERMEDIATE_TEMPERATURE_UUID) == 0) {
gboolean intermediate = TRUE;
change_property(ch->t, "Intermediate", &intermediate);
return;
} |
functions | void configure_thermometer_cb(GSList *characteristics, guint8 status,
gpointer user_data)
{
struct thermometer *t = user_data;
GSList *l;
if (status != 0) {
error("Discover thermometer characteristics: %s",
att_ecode2str(status));
return;
} |
functions | void measurement_cb(guint8 status, const guint8 *pdu,
guint16 len, gpointer user_data)
{
gchar *msg = user_data;
if (status != 0)
error("%s failed", msg);
g_free(msg);
} |
functions | void enable_final_measurement(struct thermometer *t)
{
struct characteristic *ch;
struct descriptor *desc;
bt_uuid_t btuuid;
uint8_t atval[2];
gchar *msg;
ch = get_characteristic(t, TEMPERATURE_MEASUREMENT_UUID);
if (ch == NULL) {
DBG("Temperature measurement characteristic not found");
return;
} |
functions | void enable_intermediate_measurement(struct thermometer *t)
{
struct characteristic *ch;
struct descriptor *desc;
bt_uuid_t btuuid;
uint8_t atval[2];
gchar *msg;
ch = get_characteristic(t, INTERMEDIATE_TEMPERATURE_UUID);
if (ch == NULL) {
DBG("Intermediate measurement characteristic not found");
return;
} |
functions | void disable_final_measurement(struct thermometer *t)
{
struct characteristic *ch;
struct descriptor *desc;
bt_uuid_t btuuid;
uint8_t atval[2];
gchar *msg;
ch = get_characteristic(t, TEMPERATURE_MEASUREMENT_UUID);
if (ch == NULL) {
DBG("Temperature measurement characteristic not found");
return;
} |
functions | void disable_intermediate_measurement(struct thermometer *t)
{
struct characteristic *ch;
struct descriptor *desc;
bt_uuid_t btuuid;
uint8_t atval[2];
gchar *msg;
ch = get_characteristic(t, INTERMEDIATE_TEMPERATURE_UUID);
if (ch == NULL) {
DBG("Intermediate measurement characteristic not found");
return;
} |
functions | void remove_int_watcher(struct thermometer *t, struct watcher *w)
{
if (!g_slist_find(t->iwatchers, w))
return;
t->iwatchers = g_slist_remove(t->iwatchers, w);
if (g_slist_length(t->iwatchers) == 0)
disable_intermediate_measurement(t);
} |
functions | void watcher_exit(DBusConnection *conn, void *user_data)
{
struct watcher *watcher = user_data;
struct thermometer *t = watcher->t;
DBG("Thermometer watcher %s disconnected", watcher->path);
remove_int_watcher(t, watcher);
t->fwatchers = g_slist_remove(t->fwatchers, watcher);
watcher->id = 0;
if (g_slist_len... |
functions | void update_watcher(gpointer data, gpointer user_data)
{
struct watcher *w = data;
struct measurement *m = user_data;
DBusConnection *conn = w->t->conn;
DBusMessageIter iter;
DBusMessageIter dict;
DBusMessage *msg;
msg = dbus_message_new_method_call(w->srv, w->path,
"org.bluez.ThermometerWatcher",
"Meas... |
functions | void recv_measurement(struct thermometer *t, struct measurement *m)
{
GSList *wlist;
if (g_strcmp0(m->value, "Intermediate") == 0)
wlist = t->iwatchers;
else
wlist = t->fwatchers;
g_slist_foreach(wlist, update_watcher, m);
} |
functions | void proc_measurement(struct thermometer *t, const uint8_t *pdu,
uint16_t len, gboolean final)
{
struct measurement m;
const gchar *type;
uint8_t flags;
uint32_t raw;
if (len < 4) {
DBG("Mandatory flags are not provided");
return;
} |
functions | void proc_measurement_interval(struct thermometer *t, const uint8_t *pdu,
uint16_t len)
{
DBG("TODO: Process measurements interval indication");
} |
functions | void ind_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
{
struct thermometer *t = user_data;
const struct characteristic *ch;
uint8_t opdu[ATT_MAX_MTU];
uint16_t handle, olen;
GSList *l;
if (len < 3) {
DBG("Bad pdu received");
return;
} |
functions | void notif_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
{
struct thermometer *t = user_data;
const struct characteristic *ch;
uint16_t handle;
GSList *l;
if (len < 3) {
DBG("Bad pdu received");
return;
} |
functions | void attio_connected_cb(GAttrib *attrib, gpointer user_data)
{
struct thermometer *t = user_data;
t->attrib = g_attrib_ref(attrib);
t->attindid = g_attrib_register(t->attrib, ATT_OP_HANDLE_IND,
ind_handler, t, NULL);
t->attnotid = g_attrib_register(t->attrib, ATT_OP_HANDLE_NOTIFY,
notif_handler, t, ... |
functions | void attio_disconnected_cb(gpointer user_data)
{
struct thermometer *t = user_data;
DBG("GATT Disconnected");
if (t->attindid > 0) {
g_attrib_unregister(t->attrib, t->attindid);
t->attindid = 0;
} |
functions | int thermometer_register(DBusConnection *connection, struct btd_device *device,
struct att_primary *tattr)
{
const gchar *path = device_get_path(device);
struct thermometer *t;
t = g_new0(struct thermometer, 1);
t->conn = dbus_connection_ref(connection);
t->dev = btd_device_ref(device);
t->svc_range = g_ne... |
functions | void thermometer_unregister(struct btd_device *device)
{
struct thermometer *t;
GSList *l;
l = g_slist_find_custom(thermometers, device, cmp_device);
if (l == NULL)
return;
t = l->data;
thermometers = g_slist_remove(thermometers, t);
g_dbus_unregister_interface(t->conn, device_get_path(t->dev),
THERMO... |
includes | #include <sys/ioctl.h> |
includes | #include <sys/types.h> |
includes | #include <sys/stat.h> |
includes | #include <fcntl.h> |
includes | #include <net/if.h> |
includes | #include <netlink/genl/genl.h> |
includes | #include <netlink/genl/family.h> |
includes | #include <netlink/genl/ctrl.h> |
includes | #include <linux/rtnetlink.h> |
includes | #include <netpacket/packet.h> |
includes | #include <linux/filter.h> |
includes | #include <linux/errqueue.h> |
defines | #define SO_EE_ORIGIN_TXSTATUS 4 |
defines | #define PACKET_TX_TIMESTAMP 16 |
defines | #define nl_handle nl_sock |
defines | #define nl80211_handle_alloc nl_socket_alloc_cb |
defines | #define nl80211_handle_destroy nl_socket_free |
defines | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ |
defines | #define IFF_DORMANT 0x20000 /* driver signals dormant */ |
defines | #define IF_OPER_DORMANT 5 |
defines | #define IF_OPER_UP 6 |
defines | #define MAX_REPORT_FREQS 50 |
defines | #define genl_ctrl_resolve android_genl_ctrl_resolve |
defines | #define PASS 0xFF |
defines | #define FAIL 0xFE |
defines |
#define WPA_PS_ENABLED 0 |
defines | #define WPA_PS_DISABLED 1 |
defines |
#define MAX_WPSP2PIE_CMD_SIZE 512 |
structs | struct nl80211_global {
struct dl_list interfaces;
int if_add_ifindex;
struct netlink_data *netlink;
struct nl_cb *nl_cb;
struct nl_handle *nl;
int nl80211_id;
int ioctl_sock; /* socket for ioctl() use */
struct nl_handle *nl_event;
}; |
structs | struct nl80211_wiphy_data {
struct dl_list list;
struct dl_list bsss;
struct dl_list drvs;
struct nl_handle *nl_beacons;
struct nl_cb *nl_cb;
int wiphy_idx;
}; |
structs | struct i802_bss {
struct wpa_driver_nl80211_data *drv;
struct i802_bss *next;
int ifindex;
char ifname[IFNAMSIZ + 1];
char brname[IFNAMSIZ];
unsigned int beacon_set:1;
unsigned int added_if_into_bridge:1;
unsigned int added_bridge:1;
unsigned int in_deinit:1;
u8 addr[ETH_ALEN];
int freq;
struct nl_handle... |
structs | struct wpa_driver_nl80211_data {
struct nl80211_global *global;
struct dl_list list;
struct dl_list wiphy_list;
char phyname[32];
void *ctx;
int ifindex;
int if_removed;
int if_disabled;
int ignore_if_down_event;
struct rfkill_data *rfkill;
struct wpa_driver_capa capa;
int has_capability;
int operstate;
... |
structs | struct nl80211_bss_info_arg {
struct wpa_driver_nl80211_data *drv;
struct wpa_scan_results *res;
unsigned int assoc_freq;
u8 assoc_bssid[ETH_ALEN];
}; |
structs | struct family_data {
const char *group;
int id;
}; |
structs | struct wiphy_idx_data {
int wiphy_idx;
}; |
structs | struct wiphy_info_data {
struct wpa_driver_capa *capa;
unsigned int error:1;
unsigned int device_ap_sme:1;
unsigned int poll_command_supported:1;
unsigned int data_tx_status:1;
unsigned int monitor_supported:1;
}; |
structs | struct phy_info_arg {
u16 *num_modes;
struct hostapd_hw_modes *modes;
}; |
functions | void nl80211_handle_destroy(struct nl_handle *handle)
{
uint32_t port = nl_socket_get_local_port(handle);
port >>= 22;
port_bitmap[port / 32] &= ~(1 << (port % 32));
nl_handle_destroy(handle);
} |
functions | void nl_destroy_handles(struct nl_handle **handle)
{
if (*handle == NULL)
return;
nl80211_handle_destroy(*handle);
*handle = NULL;
} |
functions | void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
{
} |
functions | void del_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
{
} |
functions | int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
{
return 0;
} |
functions | int is_ap_interface(enum nl80211_iftype nlmode)
{
return (nlmode == NL80211_IFTYPE_AP ||
nlmode == NL80211_IFTYPE_P2P_GO);
} |
functions | int is_sta_interface(enum nl80211_iftype nlmode)
{
return (nlmode == NL80211_IFTYPE_STATION ||
nlmode == NL80211_IFTYPE_P2P_CLIENT);
} |
functions | int is_p2p_interface(enum nl80211_iftype nlmode)
{
return (nlmode == NL80211_IFTYPE_P2P_CLIENT ||
nlmode == NL80211_IFTYPE_P2P_GO);
} |
functions | int ack_handler(struct nl_msg *msg, void *arg)
{
int *err = arg;
*err = 0;
return NL_STOP;
} |
functions | int finish_handler(struct nl_msg *msg, void *arg)
{
int *ret = arg;
*ret = 0;
return NL_SKIP;
} |
functions | int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
void *arg)
{
int *ret = arg;
*ret = err->error;
return NL_SKIP;
} |
functions | int no_seq_check(struct nl_msg *msg, void *arg)
{
return NL_OK;
} |
functions | int family_handler(struct nl_msg *msg, void *arg)
{
struct family_data *res = arg;
struct nlattr *tb[CTRL_ATTR_MAX + 1];
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *mcgrp;
int i;
nla_parse(tb, CTRL_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
if (!tb[CTRL_AT... |
functions | int nl_get_multicast_id(struct nl80211_global *global,
const char *family, const char *group)
{
struct nl_msg *msg;
int ret = -1;
struct family_data res = { group, -ENOENT } |
functions | int netdev_info_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct wiphy_idx_data *info = arg;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
if (tb[NL80211_ATTR_WIPHY])
... |
functions | int nl80211_get_wiphy_index(struct i802_bss *bss)
{
struct nl_msg *msg;
struct wiphy_idx_data data = {
.wiphy_idx = -1,
} |
functions | int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
struct nl80211_wiphy_data *w)
{
struct nl_msg *msg;
int ret = -1;
msg = nlmsg_alloc();
if (!msg)
return -1;
nl80211_cmd(drv, msg, 0, NL80211_CMD_REGISTER_BEACONS);
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, w->wiphy_idx);
ret = send_and_re... |
functions | void nl80211_recv_beacons(int sock, void *eloop_ctx, void *handle)
{
struct nl80211_wiphy_data *w = eloop_ctx;
wpa_printf(MSG_EXCESSIVE, "nl80211: Beacon event message available");
nl_recvmsgs(handle, w->nl_cb);
} |
functions | int process_beacon_event(struct nl_msg *msg, void *arg)
{
struct nl80211_wiphy_data *w = arg;
struct wpa_driver_nl80211_data *drv;
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *tb[NL80211_ATTR_MAX + 1];
union wpa_event_data event;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
... |
functions | void nl80211_put_wiphy_data_ap(struct i802_bss *bss)
{
struct nl80211_wiphy_data *w = bss->wiphy_data;
struct i802_bss *tmp_bss;
int found = 0;
if (w == NULL)
return;
bss->wiphy_data = NULL;
dl_list_del(&bss->wiphy_list);
/* still any for this drv present? */
dl_list_for_each(tmp_bss, &w->bsss, struct i802_... |
functions | int wpa_driver_nl80211_get_bssid(void *priv, u8 *bssid)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!drv->associated)
return -1;
os_memcpy(bssid, drv->bssid, ETH_ALEN);
return 0;
} |
functions | int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!drv->associated)
return -1;
os_memcpy(ssid, drv->ssid, drv->ssid_len);
return drv->ssid_len;
} |
functions | void wpa_driver_nl80211_event_link(struct wpa_driver_nl80211_data *drv,
char *buf, size_t len, int del)
{
union wpa_event_data event;
os_memset(&event, 0, sizeof(event));
if (len > sizeof(event.interface_status.ifname))
len = sizeof(event.interface_status.ifname) - 1;
os_memcpy(event.interface_status.ifna... |
functions | int wpa_driver_nl80211_own_ifname(struct wpa_driver_nl80211_data *drv,
u8 *buf, size_t len)
{
int attrlen, rta_len;
struct rtattr *attr;
attrlen = len;
attr = (struct rtattr *) buf;
rta_len = RTA_ALIGN(sizeof(struct rtattr));
while (RTA_OK(attr, attrlen)) {
if (attr->rta_type == IFLA_IFNAME) {
if (os... |
functions | int wpa_driver_nl80211_own_ifindex(struct wpa_driver_nl80211_data *drv,
int ifindex, u8 *buf, size_t len)
{
if (drv->ifindex == ifindex)
return 1;
if (drv->if_removed && wpa_driver_nl80211_own_ifname(drv, buf, len)) {
drv->first_bss.ifindex = if_nametoindex(drv->first_bss.ifname);
wpa_printf(MSG_DEBUG, ... |
functions | void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
struct ifinfomsg *ifi,
u8 *buf, size_t len)
{
struct nl80211_global *global = ctx;
struct wpa_driver_nl80211_data *drv;
int attrlen, rta_len;
struct rtattr *attr;
u32 brid = 0;
char namebuf[IFNAMSIZ];
drv = nl80211_find_drv(global, ifi->ifi_inde... |
functions | else if (drv->if_removed) {
wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
"event since interface %s is marked "
"removed", drv->first_bss.ifname);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.