Search Linux Wireless

Re: [PATCH] Changes for implementing NL80211_CMD_SET_TX_BITRATE_MASK for legacy rates for now.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



any comments?

On Thu, Mar 25, 2010 at 4:52 PM, Rakesh <gopchandani@xxxxxxxxx> wrote:
>
> From: Rakesh <rakesh@pineapple.(none)>
>
> ---
>  mask.c |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 82 insertions(+), 0 deletions(-)
>  create mode 100755 mask.c
>
> diff --git a/mask.c b/mask.c
> new file mode 100755
> index 0000000..a184b67
> --- /dev/null
> +++ b/mask.c
> @@ -0,0 +1,82 @@
> +#include <net/if.h>
> +#include <errno.h>
> +#include <string.h>
> +#include <ctype.h>
> +#include <stdbool.h>
> +
> +#include <netlink/genl/genl.h>
> +#include <netlink/genl/family.h>
> +#include <netlink/genl/ctrl.h>
> +#include <netlink/msg.h>
> +#include <netlink/attr.h>
> +
> +#include "nl80211.h"
> +#include "iw.h"
> +
> +
> +static int handle_mask(struct nl80211_state *state,
> +                      struct nl_cb *cb,
> +                      struct nl_msg *msg,
> +                      int argc, char **argv)
> +{
> +       __u8 input_legacy_rates[32];
> +       struct nlattr *nl_rates, *nl_rate;
> +
> +       char *eptr;
> +       int err = -ENOBUFS;
> +       int i,legacy_rate_counter=0;
> +
> +       enum {
> +               NONE,
> +               LEGACY,
> +               MCS,
> +       } parse = NONE;
> +       bool have_legacy,have_mcs;
> +       for (i = 0; i < argc; i++) {
> +               if (strcmp(argv[i], "legacy") == 0) {
> +                       parse = LEGACY;
> +                       have_legacy = true;
> +                       continue;
> +               }
> +
> +                if (strcmp(argv[i], "mcs") == 0) {
> +                        parse = MCS;
> +                        have_mcs = true;
> +                        continue;
> +                }
> +
> +               switch (parse) {
> +               case NONE:
> +               case LEGACY:
> +                       input_legacy_rates[legacy_rate_counter] = strtoul(argv[i], &eptr, 10);
> +                       legacy_rate_counter++;
> +                       break;
> +               case MCS:
> +                       //NLA_PUT(ssids, i, strlen(argv[i]), argv[i]);
> +                       break;
> +               }
> +       }
> +       err = 0;
> +
> +// Nesting of attribute begins
> +
> +       nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
> +       if (!nl_rates)
> +               goto nla_put_failure;
> +       int band = 0;
> +       nl_rate = nla_nest_start(msg,band);
> +       if (!nl_rate)
> +               goto nla_put_failure;
> +
> +       nla_put(msg, NL80211_TXRATE_LEGACY, legacy_rate_counter, input_legacy_rates);
> +
> +       nla_nest_end(msg,nl_rate);
> +       nla_nest_end(msg,nl_rates);
> +
> +//Nesting of attribute ends.
> + nla_put_failure:
> +       return err;
> +}
> +COMMAND(set, mask, "[legacy <legacy rate in Mbps multiplied by 2, e.g. 11 for 5.5 Mbps>*]",
> +       NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_mask,
> +        "Sets up the specified rate masks for different bands.");
> --
> 1.6.3.3
>
��.n��������+%������w��{.n�����{���zW����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux