[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18210 - in libmwmodem/src: include main
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18210 - in libmwmodem/src: include main |
Date: |
Fri, 18 Nov 2011 16:08:47 +0100 |
Author: ruppa
Date: 2011-11-18 16:08:47 +0100 (Fri, 18 Nov 2011)
New Revision: 18210
Modified:
libmwmodem/src/include/libmwmodem.h
libmwmodem/src/main/libmwmodem.c
Log:
Modified: libmwmodem/src/include/libmwmodem.h
===================================================================
--- libmwmodem/src/include/libmwmodem.h 2011-11-18 13:44:23 UTC (rev 18209)
+++ libmwmodem/src/include/libmwmodem.h 2011-11-18 15:08:47 UTC (rev 18210)
@@ -43,6 +43,11 @@
#define MWMODEM_PORT 50243
/**
+ * The max length of a udp message
+ */
+#define MWMODEM_MAXMESSLENGTH 65507
+
+/**
* Definition of all existend Modcodes of DVB-S2 with a Prefix (MOD_).
* Code Rates 1/4 are written 1_4!
* Defined at
http://www.etsi.org/deliver/etsi_en/302300_302399/302307/01.02.01_60/en_302307v010201p.pdf.
Modified: libmwmodem/src/main/libmwmodem.c
===================================================================
--- libmwmodem/src/main/libmwmodem.c 2011-11-18 13:44:23 UTC (rev 18209)
+++ libmwmodem/src/main/libmwmodem.c 2011-11-18 15:08:47 UTC (rev 18210)
@@ -29,11 +29,20 @@
content.cb = cb;
if (af_int==AF_INET||af_int==AF_INET6)content.socket = socket(af_int,
SOCK_DGRAM, IPPROTO_UDP);
- else;//TODO Error Message
+ else
+ {
+ printf("Error no correct AF_INET or AF_INET6 value!");
+ return null;
+ }
- if (content.socket==-1);//TODO Error Message
+ if (content.socket==-1)
+ {
+ printf("Error no socket createt!");
+ return null;
+ }
- struct sockaddr_in adress;
+ if (af_inet==AF_INET) struct sockaddr_in adress;
+ else struct sockaddr_in6 adress;
adress= malloc(sizeof(struct sockaddr_in));
memset( &adress, 0, sizeof (adress));
adress.sin_family = af_int;
@@ -61,11 +70,42 @@
void MWMODEM_run (struct MWMODEM_Content *fc)
{
- MWMODEM_Package package;
- package = malloc(sizeof(struct MWMODEM_Package));
+ struct MWMODEM_Package package;
char *buffer;
- buffer = malloc(65507);
- //TODO
+ buffer = malloc(MWMODEM_MAXMESSLENGTH);
+
+ recvfrom(fc.socket, *buffer, sizeof(buffer), 0, (struct sockaddr
*from), (socklen_t *from_length));
+ if (true)//TODO deklination der Erkennungsmerkmale der Message
+ {
+ char[] byte4;
+ byte4[0]= buffer[0];
+ byte4[1]= buffer[1];
+ byte4[2]= buffer[2];
+ byte4[3]= buffer[3];
+ package.header = ntohl((uint32_t) byte4);
+
+ byte4[0]= buffer[4];
+ byte4[1]= buffer[5];
+ byte4[2]= buffer[6];
+ byte4[3]= buffer[7];
+ //TODO Time
+
+ byte4[0]= buffer[8];
+ byte4[1]= buffer[9];
+ byte4[2]= buffer[10];
+ byte4[3]= buffer[11];
+ package.symbolrate = ntohl((uint32_t) byte4);
+
+ package.num_channels = (uint8_t) buffer[12];
+
+ package.channel = malloc(package.num_channels);
+
+ int i, bufferzelle;
+ for(i=0;i<=package.num_channels; i++)//TODO parse channels
+ {
+ }
+ }
+ else return null;
fc.cb(fc.cls, package);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18210 - in libmwmodem/src: include main,
gnunet <=