U23 2007/NULL.0
Gruppe NULL.0
aus Köln
Motto: "Schrauben lieben Dunkelheit."
Contents
Team
- Stefan
- Philipp
- Sebi
- Hanno
- Mikael
Links
- I2C
Projek t
Idee
Haben wir nun schon ein Ziel? Vorschläge bitte :D
Ich finde Server und Netzwerkgeschichten interessant: hier die die schon genannt wurden:
- NAS-Server zu Hause übers www einschalten(evtl. auch per Tel. zu aktivieren?) //dirtyheizer aka Marcus
- Network monitoring // Obstfliege aka Philipp
- Diverse Server: DHCP,DNS,FTP,HTTP... // Obstfliege aka Philipp
Hatten wir uns nicht grob auf folgendes geeinigt?
- Audio Sound Steuerung
- 4 analog Stereo in & 4 Lautsprecher out = front Rear Stero OUT
- Lautstärkeregelung & Wahl des Einganges
- WWW Interface
- Infrarot Fernbedienung zum Ansteuern
Das waren dann 4 Teilprojekte (JavaScript, Infrarot, C-Software, Hardware Löten), das kann man teilweise noch aufteilen. Und beinhaltet so grob jedes Gebiet!
Aber ich weiß nicht, ob so nen Tuner so viel bringt. Mein Interesse ist da eher gering.
Alternativ:
- USB Ansteuerung
@Philipp deine Vorschläge sind aber auch ganz nett, auch wenn sie rein softwaremäßig ablaufen. Network Monitoring würde mich glaub ich am meisten interessieren. --Hanno 23:14, 31 May 2007 (CEST)
@Hanno: Ja Monitoring interessiert mich auch besonders. --Philipp
HTTP-Server
git
Das Git-Repository kann man sich mit folgendem Kommando besorgen:
git clone git://git.haemoglobin.org/etherrape cd etherrape git checkout zerohttp
zerohttp.c
#include <avr/io.h> #include <avr/pgmspace.h> #include <string.h> #include "../uip/uip.h" #include "tokenize.h" #ifndef NULL #define NULL (char *) 0 #endif void zerohttp_invalid() { strcpy_P(uip_appdata, PSTR("HTTP/1.1 400 Invalid request\r\n" "Server: zerohttp\r\n" "Connection: close\r\n" "Content-Type: text/plain\r\n\r\n" "Invalid request!")); uip_send(uip_appdata, strlen(uip_appdata)); } void zerohttp_succeed() { strcpy_P(uip_appdata, PSTR("HTTP/1.1 200 OK\r\n" "Server: zerohttp\r\n" "Connection: close\r\n" "Content-Type: text/plain\r\n\r\n" "Thy wish is my command.")); uip_send(uip_appdata, strlen(uip_appdata)); } void zerohttp_fail() { strcpy_P(uip_appdata, PSTR("HTTP/1.1 404 Command not found\r\n" "Server: zerohttp\r\n" "Connection: close\r\n" "Content-Type: text/plain\r\n\r\n" "I could not fullfill thy humble wish.")); uip_send(uip_appdata, strlen(uip_appdata)); } void zerohttp_main() { register char *garbage; char *uri; if(uip_newdata()) { garbage = strtokz(uip_appdata, ' '); if(garbage) { zerohttp_invalid(); uip_close(); return; } if(strncmp_P(garbage, PSTR("GET"), 4)) { zerohttp_invalid(); uip_close(); return; } uri = strtokz(NULL, ' '); if(uri) { zerohttp_invalid(); uip_close(); return; } garbage = strtokz(NULL, '\r'); if(garbage) { zerohttp_invalid(); uip_close(); return; } if(strncmp_P(garbage, PSTR("HTTP/1.0"), 9) && strncmp(garbage, PSTR("HTTP/1.1"), 9)) { zerohttp_invalid(); uip_close(); return; } if(!strncmp_P(uri, PSTR("http://"), 7)) uri += 7; else uri++; if(!strncmp_P(uri, PSTR("lauter"), 7)) { // Lauter! zerohttp_succeed(); uip_close(); return; } else if(!strncmp_P(uri, PSTR("leiser"), 7)) { // Leiser! zerohttp_succeed(); uip_close(); return; } else { zerohttp_fail(); uip_close(); return; } } }
tokenize.c
/* * Copyright © MMVII * Mikael Voss <ffefd6 at haemoglobin dot org> * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission * is granted to deal in this work without restriction, including un- * limited rights to use, publicly perform, distribute, sell, modify, * merge, give away, or sublicence. * * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to * the utmost extent permitted by applicable law, neither express nor * implied; without malicious intent or gross negligence. In no event * may a licensor, author or contributor be held liable for indirect, * direct, other damage, loss, or other issues arising in any way out * of dealing in the work, even if advised of the possibility of such * damage or existence of a defect, except proven that it results out * of said person's immediate fault when using the work as intended. */ /* * strtokn parses a string of length bytes into a sequence of tokens * separated by delimiter. On the first call the string to be parsed * should be specified in string and its size in length. On each sub- * sequent call that should parse the same string, string should be * (char *) 0 and length will be ignored. * It returns the next token delimited by delimiter or (char *) 0 if * no other token is found. */ char *strtokn(char *string, unsigned int length, char delimiter) { static char *next; static unsigned int rest; register unsigned int iterator; if(string != (char *) 0) { next = string; rest = length; } for(iterator = 0; iterator < rest; iterator++) { if(next[iterator] == delimiter) { next[iterator] = '\0'; string = next; next += iterator + 1; rest -= iterator - 1; return string; } } return (char *) 0; } /* * strtokz does the same as strtokn, but operates on a zero-terminated * string and thus does not take a length argument. Be careful as this * function might lead to buffer overflows if string is not properly * terminated! */ char *strtokz(char *string, char delimiter) { static char *next; if(string != (char *) 0) next = string; else string = next; while(*next++) { if(*next == delimiter) { *next++ = '\0'; return string; } } return (char *) 0; }
tokenize.h
char *strtokn(char *, unsigned int, char); char *strtokz(char *, char);