mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
add hook for transmitting packet via packet radio interface.
make serial port non-blocking (which for some reason has also killed our ability to read from it :/).
This commit is contained in:
parent
0268ccd21a
commit
7287a2d599
@ -670,7 +670,9 @@ overlay_broadcast_ensemble(int interface_number,
|
||||
return WHYF("Cannot send to interface %s as it is down", interface->name);
|
||||
}
|
||||
|
||||
if (interface->fileP)
|
||||
if (interface->type==OVERLAY_INTERFACE_PACKETRADIO) {
|
||||
return overlay_packetradio_tx_packet(interface_number,recipientaddr,bytes,len);
|
||||
} else if (interface->fileP)
|
||||
{
|
||||
|
||||
struct dummy_packet packet={
|
||||
|
@ -16,6 +16,9 @@
|
||||
int overlay_packetradio_setup_port(overlay_interface *interface)
|
||||
{
|
||||
struct termios t;
|
||||
|
||||
set_nonblock(interface->alarm.poll.fd);
|
||||
|
||||
tcgetattr(interface->alarm.poll.fd, &t);
|
||||
// XXX Speed and options should be configurable
|
||||
cfsetispeed(&t, B57600);
|
||||
@ -40,6 +43,7 @@ int overlay_packetradio_setup_port(overlay_interface *interface)
|
||||
t.c_oflag &= ~OPOST;
|
||||
|
||||
tcsetattr(interface->alarm.poll.fd, TCSANOW, &t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -166,3 +170,11 @@ void overlay_packetradio_poll(struct sched_ent *alarm)
|
||||
return ;
|
||||
}
|
||||
|
||||
int overlay_packetradio_tx_packet(int interface_number,
|
||||
struct sockaddr_in *recipientaddr,
|
||||
unsigned char *bytes,int len)
|
||||
{
|
||||
if (config.debug.packetradio) DEBUGF("Sending packet of %d bytes",len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
3
serval.h
3
serval.h
@ -753,6 +753,9 @@ int fd_poll();
|
||||
void overlay_interface_discover(struct sched_ent *alarm);
|
||||
void overlay_packetradio_poll(struct sched_ent *alarm);
|
||||
int overlay_packetradio_setup_port(overlay_interface *interface);
|
||||
int overlay_packetradio_tx_packet(int interface_number,
|
||||
struct sockaddr_in *recipientaddr,
|
||||
unsigned char *bytes,int len);
|
||||
void overlay_dummy_poll(struct sched_ent *alarm);
|
||||
void overlay_route_tick(struct sched_ent *alarm);
|
||||
void server_config_reload(struct sched_ent *alarm);
|
||||
|
Loading…
Reference in New Issue
Block a user