Exemplo n.º 1
0
	int DeviceProxy_dot11::connect(int timeout) {
		if ( interface == ""  ) { 
			fprintf(stderr, "ERROR: 802.11 interface not set\n");
			return 1;
		}
		fprintf(stderr, "802.11: Using interface %s\n", interface.c_str());
		if ( (driver = lorcon_auto_driver(interface.c_str())) == NULL) {
			fprintf(stderr, "ERROR: 802.11: Could not determine the driver for %s\n",interface.c_str());
			return 1;
		} else {
			fprintf(stderr, "802.11:  Driver: %s\n",driver->name);
		}
	
		// Create LORCON context
		if ((context = lorcon_create(interface.c_str(), driver)) == nullptr) {
				fprintf(stderr, "Error: 802.11:  Failed to create context");
				return 1; 
		}
		int rv = lorcon_open_monitor(context);
		if (rv < 0) {
			fprintf(stderr, "Error: 802.11: Could not create Monitor Mode interface!\n");
			return 1;
		} else {
			fprintf(stderr, "802.11: Monitor Mode VAP: %s, (%d)\n",
					lorcon_get_vap(context), rv);
			monitor = true;
		}
		lorcon_free_driver_list(driver);
		
		p_is_connected = true;
		return 0;
	}
Exemplo n.º 2
0
static VALUE Lorcon_open_monitor(VALUE self) {
	struct rldev *rld;

	Data_Get_Struct(self, struct rldev, rld);

	if (lorcon_open_monitor(rld->context) < 0)
		return Qfalse;

	return Qtrue;
}
Exemplo n.º 3
0
static PyObject*
PyLorcon2_Context_open_monitor(PyLorcon2_Context *self)
{
    if (lorcon_open_monitor(self->context) < 0) {
        PyErr_SetString(Lorcon2Exception, lorcon_get_error(self->context));
        return NULL;
    }
    
    self->monitored = 1;

    Py_INCREF(Py_None);
    return Py_None;
}