wimax-tools 1.4.4
Defines | Typedefs | Functions

/home/users/builder/rpm/BUILD/wimax-tools-1.4.4/include/wimaxll.h File Reference

#include <sys/errno.h>
#include <sys/types.h>
#include <endian.h>
#include <byteswap.h>
#include <stdarg.h>
#include <linux/wimax.h>

Go to the source code of this file.

Defines

#define WIMAX_PIPE_ANY   (NULL-1)
#define wimaxll_array_size(a)   (sizeof(a)/sizeof(a[0]))
#define wimaxll_container_of(pointer, type, member)
#define __WIMAXLL_ALIGN2_MASK(n, m)   (((n) + (m)) & ~(m))
#define WIMAXLL_ALIGN2(n, o2)   __WIMAXLL_ALIGN2_MASK(n, (typeof(n)) (o2) - 1)
 Return the value n aligned to an order-of-two value o2.

Typedefs

typedef int(* wimaxll_msg_to_user_cb_f )(struct wimaxll_handle *wmx, void *priv, const char *pipe_name, const void *data, size_t size)
 Callback for a message to user generic netlink message.
typedef int(* wimaxll_state_change_cb_f )(struct wimaxll_handle *, void *priv, enum wimax_st old_state, enum wimax_st new_state)
 Callback for a state change notification from the WiMAX kernel stack.

Functions

struct wimaxll_handlewimaxll_open (const char *device_name)
 Open a handle to the WiMAX control interface in the kernel.
void * wimaxll_priv_get (struct wimaxll_handle *)
 Return the private data associated to a WiMAX device handle.
void wimaxll_priv_set (struct wimaxll_handle *, void *)
 Set the private data associated to a WiMAX device handle.
void wimaxll_close (struct wimaxll_handle *)
 Close a device handle opened with wimaxll_open()
const char * wimaxll_ifname (const struct wimaxll_handle *)
 Return the name of a the system's WiMAX interface associated to an open handle.
unsigned wimaxll_ifidx (const struct wimaxll_handle *)
 Return the interface index of the system's WiMAX interface associated to an open handle.
int wimaxll_recv_fd (struct wimaxll_handle *)
 Return the file descriptor associated to a WiMAX handle.
ssize_t wimaxll_recv (struct wimaxll_handle *)
 Read notifications from the WiMAX multicast group.
ssize_t wimaxll_msg_write (struct wimaxll_handle *, const char *, const void *, size_t)
 Send a driver-specific message to a WiMAX device.
void wimaxll_get_cb_msg_to_user (struct wimaxll_handle *, wimaxll_msg_to_user_cb_f *, void **)
 Get the callback and priv pointer for a MSG_TO_USER message.
void wimaxll_set_cb_msg_to_user (struct wimaxll_handle *, wimaxll_msg_to_user_cb_f, void *)
 Set the callback and priv pointer for a MSG_TO_USER message.
ssize_t wimaxll_msg_read (struct wimaxll_handle *, const char *pine_name, void **)
 Read a message from any WiMAX kernel-user pipe.
void wimaxll_msg_free (void *)
 Free a message received with wimaxll_msg_read()
int wimaxll_rfkill (struct wimaxll_handle *, enum wimax_rf_state)
 Control the software RF Kill switch and obtain switch status.
int wimaxll_reset (struct wimaxll_handle *)
 Reset a WiMAX device.
int wimaxll_state_get (struct wimaxll_handle *)
 Get Wimax device status from kernel and return it to user space.
void wimaxll_get_cb_state_change (struct wimaxll_handle *, wimaxll_state_change_cb_f *, void **)
 Get the callback and priv pointer for a WIMAX_GNL_RE_STATE_CHANGE message.
void wimaxll_set_cb_state_change (struct wimaxll_handle *, wimaxll_state_change_cb_f, void *)
 Set the callback and priv pointer for a WIMAX_GNL_RE_STATE_CHANGE message.
ssize_t wimaxll_wait_for_state_change (struct wimaxll_handle *wmx, enum wimax_st *old_state, enum wimax_st *new_state)
 Wait for an state change notification from the kernel.
enum wimax_st wimaxll_state_by_name (const char *)
size_t wimaxll_states_snprintf (char *, size_t)
const char * wimaxll_state_to_name (enum wimax_st)
unsigned short wimaxll_swap_16 (unsigned short x)
 Swap the nibbles in a 16 bit number.
unsigned long wimaxll_swap_32 (unsigned long x)
 Swap the nibbles in a 32 bit number.
unsigned short wimaxll_cpu_to_le16 (unsigned short x)
 Convert a cpu-order 16 bits to little endian.
unsigned short wimaxll_le16_to_cpu (unsigned short le16)
 Convert a little-endian 16 bits to cpu order.
unsigned long wimaxll_cpu_to_le32 (unsigned long x)
 Convert a cpu-order 32 bits to little endian.
unsigned long wimaxll_le32_to_cpu (unsigned long le32)
 Convert a little-endian 32 bits to cpu order.
unsigned short wimaxll_cpu_to_be16 (unsigned short x)
 Convert a cpu-order 16 bits to big endian.
unsigned short wimaxll_be16_to_cpu (unsigned short be16)
 Convert a big-endian 16 bits to cpu order.
unsigned long wimaxll_cpu_to_be32 (unsigned long x)
 Convert a cpu-order 32 bits to big endian.
unsigned long wimaxll_be32_to_cpu (unsigned long be32)
 Convert a big-endian 32 bits to cpu order.

Define Documentation

#define __WIMAXLL_ALIGN2_MASK (   n,
 
)    (((n) + (m)) & ~(m))
#define WIMAX_PIPE_ANY   (NULL-1)
#define WIMAXLL_ALIGN2 (   n,
  o2 
)    __WIMAXLL_ALIGN2_MASK(n, (typeof(n)) (o2) - 1)

Return the value n aligned to an order-of-two value o2.

#define wimaxll_array_size (   a)    (sizeof(a)/sizeof(a[0]))
#define wimaxll_container_of (   pointer,
  type,
  member 
)
Value:
({                                                                      \
        type *object = NULL;                                            \
        size_t offset = (void *) &object->member - (void *) object;     \
        (type *) ((void *) pointer - offset);                           \
})

Function Documentation

void wimaxll_get_cb_msg_to_user ( struct wimaxll_handle wmx,
wimaxll_msg_to_user_cb_f cb,
void **  priv 
)

Get the callback and priv pointer for a MSG_TO_USER message.

Get the callback and private pointer that will be called by wimaxll_recv() when a MSG_TO_USER is received over generic netlink.

Parameters:
wmxWiMAX handle.
cbWhere to store the current callback function.
privWhere to store the private data pointer passed to the callback.

Referenced by wimaxll_msg_read().

ssize_t wimaxll_recv ( struct wimaxll_handle wmx)

Read notifications from the WiMAX multicast group.

Parameters:
wmxWiMAX device handle
Returns:
Value returned by the callback functions (depending on the implementation of the callback). On error, a negative errno code:

-EBUSY: callback instructed to stop processing messages

Read one or more messages from a multicast group and for each valid one, execute the callbacks set in the multi cast handle.

The callbacks are expected to handle the messages and set information in the context specific to the mc handle (mch->cb_ctx). In case of any type of errors (cb_ctx.result < 0), it is expected that no resources will be tied to the context.

Remarks:
This is a blocking call.

Referenced by wimaxll_msg_read(), and wimaxll_wait_for_state_change().

void wimaxll_set_cb_msg_to_user ( struct wimaxll_handle wmx,
wimaxll_msg_to_user_cb_f  cb,
void *  priv 
)

Set the callback and priv pointer for a MSG_TO_USER message.

Set the callback and private pointer that will be called by wimaxll_recv() when a MSG_TO_USER is received over generic netlink.

Parameters:
wmxWiMAX handle.
cbCallback function to set
privPrivate data pointer to pass to the callback function (wrap a struct wimaxll_cb_ctx in your context struct and pass a pointer to it; then use wimaxll_container_of() to extract it back).

Referenced by wimaxll_msg_read().

enum wimax_st wimaxll_state_by_name ( const char *  )
const char* wimaxll_state_to_name ( enum  wimax_st)
size_t wimaxll_states_snprintf ( char *  ,
size_t   
)