Expand PMF_FN_* macros.
[netbsd-mini2440.git] / share / examples / rump / wirelessconf / wirelessconf.c
blobf48d88522ae132ec9323ba40f7f0dd30ecc8f81a
1 /* $NetBSD: wirelessconf.c,v 1.2 2009/10/14 23:51:22 pooka Exp $ */
3 /*
4 * Copyright (c) 2009 Antti Kantee. All Rights Reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
28 #include <sys/types.h>
29 #include <sys/ioctl.h>
30 #include <sys/reboot.h>
31 #include <sys/socket.h>
33 #include <net/if.h>
35 #include <rump/rump.h>
36 #include <rump/rump_syscalls.h>
38 #include <err.h>
39 #include <errno.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
45 * Example program for raising rum0 interface under rump. This
46 * requires a rum-compatible usb device attached as ugen.
49 #define RUMFW "/libdata/firmware/rum/rum-rt2573"
50 int
51 main(void)
53 struct ifreq ifr;
54 int s;
56 rump_boot_sethowto(RUMP_AB_VERBOSE);
57 rump_init();
59 /* rum? shouldn't that be marsala? */
60 s = rump_sys_socket(AF_INET, SOCK_DGRAM, 0);
61 if (s == -1)
62 err(1, "socket");
63 strcpy(ifr.ifr_name, "rum0");
64 if (rump_sys_ioctl(s, SIOCGIFFLAGS, &ifr) == -1) {
65 if (errno == ENXIO) {
66 printf("rum@usb not found!\n");
67 exit(0);
69 err(1, "get if flags");
71 printf("\ndevice autoconfiguration finished\n");
73 printf("tira-if-su ...\n");
74 if (rump_pub_etfs_register(RUMFW, RUMFW, RUMP_ETFS_REG) != 0)
75 errx(1, "firmware etfs registration failed");
77 strcpy(ifr.ifr_name, "rum0");
78 ifr.ifr_flags = IFF_UP;
79 if (rump_sys_ioctl(s, SIOCSIFFLAGS, &ifr) == -1)
80 err(1, "ioctl");
81 printf("... done\n");
83 return 0;