Compare commits
124 Commits
Author | SHA1 | Date |
---|---|---|
Gerolf Ziegenhain | 2c2ff2d2ed | |
Gerolf Ziegenhain | 4c7442e3ea | |
Gerolf Ziegenhain | 2c7de4792d | |
Gerolf Ziegenhain | 496aa90bfe | |
Gerolf Ziegenhain | 827798b86b | |
Gerolf Ziegenhain | 5f9609ce0c | |
Gerolf Ziegenhain | 75c77b0cac | |
Gerolf Ziegenhain | 7bf9183401 | |
Gerolf Ziegenhain | 746b1dcfe5 | |
Gerolf Ziegenhain | 63300fa955 | |
Gerolf Ziegenhain | a43019e565 | |
Gerolf Ziegenhain | 370858ce8e | |
Gerolf Ziegenhain | a62c28dcdf | |
Gerolf Ziegenhain | d8815db878 | |
Gerolf Ziegenhain | d6d0679fb5 | |
Gerolf Ziegenhain | 9d28c29a51 | |
Gerolf Ziegenhain | 5d1ea8138b | |
Gerolf Ziegenhain | af81f9a084 | |
Gerolf Ziegenhain | 1145e2769e | |
Gerolf Ziegenhain | 516c1b4a57 | |
Gerolf Ziegenhain | 1db2782667 | |
Gerolf Ziegenhain | ba6ece9ddd | |
Gerolf Ziegenhain | 4f9169d026 | |
Gerolf Ziegenhain | e36b01ce41 | |
Gerolf Ziegenhain | efeee5b0ee | |
Gerolf Ziegenhain | e01c86a248 | |
Gerolf Ziegenhain | 6163a138ce | |
Gerolf Ziegenhain | 5dad7c3f64 | |
Gerolf Ziegenhain | 8622552f86 | |
Gerolf Ziegenhain | 1d3b674ecc | |
Gerolf Ziegenhain | 81316638fc | |
Gerolf Ziegenhain | 83d152c2bc | |
Gerolf Ziegenhain | fddeaab8ed | |
Gerolf Ziegenhain | 197ac3224e | |
Gerolf Ziegenhain | 7ead5be229 | |
Gerolf Ziegenhain | 46842ab42b | |
Gerolf Ziegenhain | 86e7cc039b | |
Gerolf Ziegenhain | 5e586d03d9 | |
Gerolf Ziegenhain | bf0ebc9f6e | |
Gerolf Ziegenhain | 8da5cc22d6 | |
Gerolf Ziegenhain | ff773f1f4e | |
Gerolf Ziegenhain | 05ad58cb09 | |
Gerolf Ziegenhain | 08423de98c | |
Gerolf Ziegenhain | a9371e16d4 | |
Gerolf Ziegenhain | 57f6c84f88 | |
Gerolf Ziegenhain | 15ab7fbbcc | |
Gerolf Ziegenhain | c60842a89f | |
Gerolf Ziegenhain | a5b7aed310 | |
Gerolf Ziegenhain | 49d87c5cc8 | |
Gerolf Ziegenhain | 1c1ef6ca4d | |
Gerolf Ziegenhain | bd54a9cec4 | |
Gerolf Ziegenhain | 5b51a3459a | |
Gerolf Ziegenhain | ab06957571 | |
Gerolf Ziegenhain | 108d04efd2 | |
Gerolf Ziegenhain | aaf24cf35d | |
Gerolf Ziegenhain | d77de7e47c | |
Gerolf Ziegenhain | b2418e4aa6 | |
Gerolf Ziegenhain | d4531a3f73 | |
Gerolf Ziegenhain | 13a1af9ed4 | |
Gerolf Ziegenhain | 43ac116425 | |
Gerolf Ziegenhain | 08f5c20420 | |
Gerolf Ziegenhain | e78a722025 | |
Gerolf Ziegenhain | 2e975376dc | |
Gerolf Ziegenhain | b227bd5d90 | |
Gerolf Ziegenhain | 5ac4d0f63f | |
Gerolf Ziegenhain | 9be4962d53 | |
Gerolf Ziegenhain | 9fdfc71ab3 | |
Gerolf Ziegenhain | 3c469edf69 | |
Gerolf Ziegenhain | 4a2e3ca88f | |
Gerolf Ziegenhain | 4f08a0c6c7 | |
Gerolf Ziegenhain | eee931feb1 | |
Gerolf Ziegenhain | 96264ece63 | |
Gerolf Ziegenhain | 6e24a9e0ba | |
Gerolf Ziegenhain | 1262a6abfd | |
Gerolf Ziegenhain | 9dd1055495 | |
Gerolf Ziegenhain | 96c1a5c030 | |
Gerolf Ziegenhain | ae5dffa383 | |
Gerolf Ziegenhain | 0d9924f9e6 | |
Gerolf Ziegenhain | b398e6df30 | |
Gerolf Ziegenhain | a56a475361 | |
Gerolf Ziegenhain | b3938f5a5e | |
Gerolf Ziegenhain | 28767e86a6 | |
Gerolf Ziegenhain | 82611ac618 | |
Gerolf Ziegenhain | 2c236c0b25 | |
Gerolf Ziegenhain | 55f4a137b2 | |
Gerolf Ziegenhain | 609a9e2b3c | |
Gerolf Ziegenhain | bc66ce5855 | |
Gerolf Ziegenhain | 592de3d5a9 | |
Gerolf Ziegenhain | 5995b5e619 | |
Gerolf Ziegenhain | d62992fdf1 | |
Gerolf Ziegenhain | 0417c67854 | |
Gerolf Ziegenhain | 6142bab18b | |
Gerolf Ziegenhain | 8142e10343 | |
Gerolf Ziegenhain | fc605357df | |
Gerolf Ziegenhain | a61c528315 | |
Gerolf Ziegenhain | b24c2d5bb3 | |
Gerolf Ziegenhain | 2a72f535a7 | |
Gerolf Ziegenhain | f3b0df241d | |
Gerolf Ziegenhain | 06a2dec810 | |
Gerolf Ziegenhain | 4c62e4f573 | |
Gerolf Ziegenhain | e340b9f9be | |
Gerolf Ziegenhain | 72ab6292fd | |
Gerolf Ziegenhain | 8da3e55d8b | |
Gerolf Ziegenhain | 0dbe192f7a | |
Gerolf Ziegenhain | b3e2c0fa72 | |
Gerolf Ziegenhain | 98ec981c98 | |
Gerolf Ziegenhain | 934b28aa1f | |
Gerolf Ziegenhain | 5d045fa8b4 | |
Gerolf Ziegenhain | e8b8e526f6 | |
Gerolf Ziegenhain | a056678346 | |
Gerolf Ziegenhain | 40853a0d4c | |
Gerolf Ziegenhain | 2cfb08aa18 | |
Gerolf Ziegenhain | ab83ca4738 | |
Gerolf Ziegenhain | 436d30d5e1 | |
Gerolf Ziegenhain | c7e095b145 | |
Gerolf Ziegenhain | c4a2a45805 | |
Gerolf Ziegenhain | a76682e1ab | |
Gerolf Ziegenhain | ef4c54eeb9 | |
Gerolf Ziegenhain | 84691e75bf | |
Gerolf Ziegenhain | f77a4c5821 | |
Gerolf Ziegenhain | 6d5f7173a3 | |
Gerolf Ziegenhain | 736ce016ad | |
Gerolf Ziegenhain | 19842349d9 | |
Gerolf Ziegenhain | a447eed37c |
14
README.md
14
README.md
|
@ -2,6 +2,20 @@ irmc - Internet Relay Morse Code
|
|||
================================
|
||||
IRMC stands for Internet Relay Morse Code and is an implementation of [MOIP](http://8ch9azbsfifz.github.io/moip/).
|
||||
|
||||
# Building
|
||||
## On Linux
|
||||
sudo apt-get install -y alsa-oss oss-compat build-essential autoconf libao-dev libtool libportaudio-dev portaudio19-dev
|
||||
make
|
||||
|
||||
### On Raspi (GPIO Interface)
|
||||
Follow: http://wiringpi.com/download-and-install/
|
||||
make raspi
|
||||
|
||||
|
||||
## On OSX
|
||||
brew install portaudio
|
||||
make
|
||||
|
||||
# Hardware interface options
|
||||
A good description on how to build different interfaces (telegraph key, sounder or both)
|
||||
is given on the [MorseKOB Website](http://kob.sdf.org/morsekob/interface.htm).
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
SRC = irmc.c cwprotocol.c beep.c
|
||||
SRC = irmc.c cwprotocol.c beep.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
LDFLAGS = -lportaudio -lpthread -lm
|
||||
CFLAGS = -Wall
|
||||
CFLAGS = -Wall -Wno-format-zero-length
|
||||
INSTALLDIR = ${HOME}/bin
|
||||
|
||||
all: options irmc
|
||||
|
@ -21,6 +21,10 @@ irmc: ${OBJ}
|
|||
@echo CC -o $@
|
||||
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
raspi:
|
||||
@${CC} -c -DRASPI ${CFLAGS} ${SRC}
|
||||
@${CC} -o irmc ${OBJ} ${LDFLAGS} -lwiringPi
|
||||
|
||||
java:
|
||||
java -jar test/MorseKOB.jar
|
||||
|
||||
|
|
26
src/beep.c
26
src/beep.c
|
@ -3,8 +3,14 @@
|
|||
#include <stdint.h>
|
||||
#include <unistd.h> // for usleep()
|
||||
#include <portaudio.h>
|
||||
|
||||
#include "beep.h"
|
||||
|
||||
#ifdef RASPI
|
||||
#define RASPI_AUDIO_LATENCY_FIX (30./5.) // https://app.assembla.com/spaces/portaudio/tickets/246-paex_sine-choppy-on-raspberry-pi---defaultlowoutputlatency-too-low/details
|
||||
#else
|
||||
#define RASPI_AUDIO_LATENCY_FIX (1.)
|
||||
#endif
|
||||
|
||||
// http://stackoverflow.com/questions/7678470/generating-sound-of-a-particular-frequency-using-gcc-in-ubuntu
|
||||
|
||||
|
@ -88,7 +94,7 @@ int buzzer_start(void)
|
|||
outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
|
||||
outputParameters.channelCount = 1; /* stereo output */
|
||||
outputParameters.sampleFormat = paUInt8; /* 32 bit floating point output */
|
||||
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
|
||||
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency * RASPI_AUDIO_LATENCY_FIX;
|
||||
outputParameters.hostApiSpecificStreamInfo = NULL;
|
||||
|
||||
err = Pa_OpenStream(
|
||||
|
@ -155,28 +161,10 @@ int beep_init()
|
|||
|
||||
int beep_test(void)
|
||||
{
|
||||
|
||||
// notes frequency chart: http://www.phy.mtu.edu/~suits/notefreqs.html
|
||||
|
||||
buzzer_start();
|
||||
buzzer_set_freq(261);
|
||||
msleep(250);
|
||||
buzzer_set_freq(0);
|
||||
msleep(250);
|
||||
buzzer_set_freq(329);
|
||||
msleep(250);
|
||||
buzzer_set_freq(349);
|
||||
msleep(250);
|
||||
buzzer_set_freq(392);
|
||||
msleep(250);
|
||||
buzzer_set_freq(440);
|
||||
msleep(250);
|
||||
buzzer_set_freq(494);
|
||||
msleep(250);
|
||||
buzzer_beep(523, 200);
|
||||
msleep(250);
|
||||
|
||||
buzzer_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "cwprotocol.h"
|
||||
|
||||
/* Global variables */
|
||||
|
@ -41,7 +42,7 @@ int prepare_tx (struct data_packet_format *tx_packet, char *id)
|
|||
tx_packet->a21 = 0; /* These magic numbers was provided by Les Kerr */
|
||||
tx_packet->a22 = 755;
|
||||
tx_packet->a23 = 16777215;
|
||||
snprintf(tx_packet->status, SIZE_STATUS, "?");
|
||||
snprintf(tx_packet->status, SIZE_STATUS, "?"); // this shall include the sent character
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
155
src/irmc.c
155
src/irmc.c
|
@ -15,25 +15,19 @@
|
|||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __MACH__
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#else
|
||||
#include <linux/ioctl.h>
|
||||
#include <asm-generic/ioctl.h>
|
||||
#include <asm-generic/termios.h>
|
||||
#endif
|
||||
|
||||
//#define DEBUG 1
|
||||
|
||||
#define MAXDATASIZE 1024 // max number of bytes we can get at once
|
||||
|
||||
#include "cwprotocol.h"
|
||||
#include "beep.h"
|
||||
#include "util.h"
|
||||
|
||||
// http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/
|
||||
#ifdef RASPI
|
||||
#include <wiringPi.h>
|
||||
#define TX_RASPI_PIN 5
|
||||
#endif
|
||||
|
||||
|
||||
int serial_status = 0, fd_serial, numbytes;
|
||||
|
||||
|
@ -45,8 +39,9 @@ long tx_timer = 0;
|
|||
|
||||
/* TX Methods */
|
||||
#define TX_NONE 0
|
||||
#define TX_SERIAL 1
|
||||
#define TX_KEYBOARD 2
|
||||
//#define TX_SERIAL 1
|
||||
//#define TX_KEYBOARD 2 // not implemented yet
|
||||
#define TX_RASPI 3
|
||||
|
||||
long key_press_t1;
|
||||
long key_release_t1;
|
||||
|
@ -57,67 +52,15 @@ char last_sender[16];
|
|||
int translate = 1;
|
||||
int audio_status = 1;
|
||||
|
||||
/* portable time, as listed in https://gist.github.com/jbenet/1087739 */
|
||||
void current_utc_time(struct timespec *ts) {
|
||||
#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
|
||||
clock_serv_t cclock;
|
||||
mach_timespec_t mts;
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
clock_get_time(cclock, &mts);
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
ts->tv_sec = mts.tv_sec;
|
||||
ts->tv_nsec = mts.tv_nsec;
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, ts);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* a better clock() in milliseconds */
|
||||
long fastclock(void)
|
||||
{
|
||||
struct timespec t;
|
||||
long r;
|
||||
|
||||
current_utc_time (&t);
|
||||
r = t.tv_sec * 1000;
|
||||
r = r + t.tv_nsec / 1000000;
|
||||
return r;
|
||||
}
|
||||
|
||||
int kbhit (void)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set rdfs;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
FD_ZERO(&rdfs);
|
||||
FD_SET (STDIN_FILENO, &rdfs);
|
||||
|
||||
select (STDIN_FILENO+1, &rdfs, NULL, NULL, &tv);
|
||||
return FD_ISSET(STDIN_FILENO, &rdfs);
|
||||
}
|
||||
|
||||
|
||||
/* get sockaddr, IPv4 or IPv6: */
|
||||
void *get_in_addr(struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
return &(((struct sockaddr_in*)sa)->sin_addr);
|
||||
}
|
||||
|
||||
return &(((struct sockaddr_in6*)sa)->sin6_addr);
|
||||
}
|
||||
|
||||
|
||||
// disconnect from the server
|
||||
void inthandler(int sig)
|
||||
{
|
||||
signal(sig, SIG_IGN);
|
||||
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);
|
||||
close(fd_socket);
|
||||
#ifdef TX_SERIAL
|
||||
close(fd_serial);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -130,18 +73,32 @@ void txloop (void)
|
|||
tx_data_packet.code[tx_data_packet.n - 1] =
|
||||
(int) ((key_press_t1 - key_release_t1) * -1);
|
||||
|
||||
//printf("space: %i\n", tx_data_packet.code[tx_data_packet.n -1]);
|
||||
#ifdef DEBUG
|
||||
printf("space: %i\n", tx_data_packet.code[tx_data_packet.n -1]);
|
||||
#endif
|
||||
#ifdef TX_SERIAL
|
||||
while(serial_status & TIOCM_DSR) ioctl(fd_serial, TIOCMGET, &serial_status);
|
||||
#endif
|
||||
#ifdef RASPI
|
||||
while(digitalRead(TX_RASPI_PIN)==1) { }
|
||||
#endif
|
||||
key_release_t1 = fastclock();
|
||||
|
||||
tx_data_packet.n++;
|
||||
tx_data_packet.code[tx_data_packet.n - 1] =
|
||||
(int) ((key_release_t1 - key_press_t1) * 1);
|
||||
|
||||
//printf("mark: %i\n", tx_data_packet.code[tx_data_packet.n -1]);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mark: %i\n", tx_data_packet.code[tx_data_packet.n -1]);
|
||||
#endif
|
||||
while(1){
|
||||
#ifdef TX_SERIAL
|
||||
ioctl(fd_serial, TIOCMGET, &serial_status);
|
||||
if(serial_status & TIOCM_DSR) break;
|
||||
#endif
|
||||
#ifdef RASPI
|
||||
if(digitalRead(TX_RASPI_PIN)==1) break;
|
||||
#endif
|
||||
tx_timeout = fastclock() - key_release_t1;
|
||||
if(tx_timeout > TX_TIMEOUT) return;
|
||||
}
|
||||
|
@ -198,7 +155,6 @@ int main(int argc, char *argv[])
|
|||
int channel;
|
||||
char id[SIZE_ID];
|
||||
char serialport[64];
|
||||
int tx_method = TX_NONE;
|
||||
|
||||
// Set default values
|
||||
snprintf(hostname, 64, "mtc-kob.dyndns.org");
|
||||
|
@ -289,21 +245,30 @@ int main(int argc, char *argv[])
|
|||
inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr),
|
||||
s, sizeof s);
|
||||
fprintf(stderr, "Connected to %s.\n", s);
|
||||
beep_init();
|
||||
if ((strcmp (serialport, "")) != 0)
|
||||
tx_method = TX_SERIAL;
|
||||
|
||||
if (tx_method == TX_SERIAL) {
|
||||
fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if(fd_serial == -1) {
|
||||
fprintf(stderr,"Unable to open serial port %s.\n", serialport);
|
||||
}
|
||||
#ifdef TX_SERIAL
|
||||
fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if(fd_serial == -1) {
|
||||
fprintf(stderr,"Unable to open serial port %s.\n", serialport);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RASPI
|
||||
if (wiringPiSetup() == -1)
|
||||
{
|
||||
fprintf(stderr,"Unable to setup wiringPi for PIN %d\n", TX_RASPI_PIN);
|
||||
exit (1);
|
||||
}
|
||||
pinMode(TX_RASPI_PIN, INPUT);
|
||||
#endif
|
||||
|
||||
freeaddrinfo(servinfo); /* all done with this structure */
|
||||
|
||||
key_release_t1 = fastclock();
|
||||
identifyclient();
|
||||
|
||||
|
||||
beep_init();
|
||||
|
||||
/* Main Loop */
|
||||
for(;;) {
|
||||
if(tx_timer == 0)
|
||||
|
@ -371,14 +336,22 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
tx_data_packet.n = 0;
|
||||
}
|
||||
if (tx_method == TX_SERIAL) {
|
||||
ioctl(fd_serial,TIOCMGET, &serial_status);
|
||||
if(serial_status & TIOCM_DSR){
|
||||
txloop();
|
||||
tx_timer = TX_WAIT;
|
||||
message(1);
|
||||
}
|
||||
#ifdef TX_SERIAL
|
||||
ioctl(fd_serial,TIOCMGET, &serial_status);
|
||||
if(serial_status & TIOCM_DSR){
|
||||
txloop();
|
||||
tx_timer = TX_WAIT;
|
||||
message(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RASPI
|
||||
if(digitalRead(5)==1){
|
||||
txloop();
|
||||
tx_timer = TX_WAIT;
|
||||
message(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(keepalive_t < 0 && tx_timer == 0){
|
||||
#if DEBUG
|
||||
|
@ -399,7 +372,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);
|
||||
close(fd_socket);
|
||||
#ifdef TX_SERIAL
|
||||
close(fd_serial);
|
||||
#endif
|
||||
buzzer_stop();
|
||||
|
||||
exit(0);
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
#include "util.h"
|
||||
|
||||
/* portable time, as listed in https://gist.github.com/jbenet/1087739 */
|
||||
void current_utc_time(struct timespec *ts) {
|
||||
#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
|
||||
clock_serv_t cclock;
|
||||
mach_timespec_t mts;
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
clock_get_time(cclock, &mts);
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
ts->tv_sec = mts.tv_sec;
|
||||
ts->tv_nsec = mts.tv_nsec;
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, ts);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* a better clock() in milliseconds */
|
||||
long fastclock(void)
|
||||
{
|
||||
struct timespec t;
|
||||
long r;
|
||||
|
||||
current_utc_time (&t);
|
||||
r = t.tv_sec * 1000;
|
||||
r = r + t.tv_nsec / 1000000;
|
||||
return r;
|
||||
}
|
||||
|
||||
int kbhit (void)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set rdfs;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
FD_ZERO(&rdfs);
|
||||
FD_SET (STDIN_FILENO, &rdfs);
|
||||
|
||||
select (STDIN_FILENO+1, &rdfs, NULL, NULL, &tv);
|
||||
return FD_ISSET(STDIN_FILENO, &rdfs);
|
||||
}
|
||||
|
||||
/* get sockaddr, IPv4 or IPv6: */
|
||||
void *get_in_addr(struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
return &(((struct sockaddr_in*)sa)->sin_addr);
|
||||
}
|
||||
|
||||
return &(((struct sockaddr_in6*)sa)->sin6_addr);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
#ifdef __MACH__
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
|
||||
|
||||
void current_utc_time(struct timespec *ts);
|
||||
long fastclock(void);
|
||||
int kbhit (void);
|
||||
void *get_in_addr(struct sockaddr *sa);
|
||||
|
Loading…
Reference in New Issue