blob: 5073f49d6a9c8e24d46d3ca5ad02518bcaab8adf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*
* Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LOADER_H_
#define _LOADER_H_
#include "ndiswrapper.h"
#ifndef __KERNEL__
#define __user
#endif
struct load_driver_file {
char driver_name[MAX_DRIVER_NAME_LEN];
char name[MAX_DRIVER_NAME_LEN];
size_t size;
void __user *data;
};
struct load_device_setting {
char name[MAX_SETTING_NAME_LEN];
char value[MAX_SETTING_VALUE_LEN];
};
struct load_device {
int bus;
int vendor;
int device;
int subvendor;
int subdevice;
char conf_file_name[MAX_DRIVER_NAME_LEN];
char driver_name[MAX_DRIVER_NAME_LEN];
};
struct load_devices {
int count;
struct load_device *devices;
};
struct load_driver {
char name[MAX_DRIVER_NAME_LEN];
char conf_file_name[MAX_DRIVER_NAME_LEN];
unsigned int num_sys_files;
struct load_driver_file sys_files[MAX_DRIVER_PE_IMAGES];
unsigned int num_settings;
struct load_device_setting settings[MAX_DEVICE_SETTINGS];
unsigned int num_bin_files;
struct load_driver_file bin_files[MAX_DRIVER_BIN_FILES];
};
#define WRAP_IOCTL_LOAD_DEVICE _IOW(('N' + 'd' + 'i' + 'S'), 0, \
struct load_device *)
#define WRAP_IOCTL_LOAD_DRIVER _IOW(('N' + 'd' + 'i' + 'S'), 1, \
struct load_driver *)
#define WRAP_IOCTL_LOAD_BIN_FILE _IOW(('N' + 'd' + 'i' + 'S'), 2, \
struct load_driver_file *)
#define WRAP_CMD_LOAD_DEVICE "load_device"
#define WRAP_CMD_LOAD_DRIVER "load_driver"
#define WRAP_CMD_LOAD_BIN_FILE "load_bin_file"
int loader_init(void);
void loader_exit(void);
#ifdef __KERNEL__
struct wrap_device *load_wrap_device(struct load_device *load_device);
struct wrap_driver *load_wrap_driver(struct wrap_device *device);
struct wrap_bin_file *get_bin_file(char *bin_file_name);
void free_bin_file(struct wrap_bin_file *bin_file);
void unload_wrap_driver(struct wrap_driver *driver);
void unload_wrap_device(struct wrap_device *wd);
struct wrap_device *get_wrap_device(void *dev, int bus_type);
extern struct semaphore loader_mutex;
#endif
#endif /* LOADER_H */
|