callback extended

This commit is contained in:
tkarrass 2013-11-02 20:57:08 +01:00
parent fb592b6f13
commit 38ca85a7b3
6 changed files with 10 additions and 8 deletions

6
README
View File

@ -1,8 +1,8 @@
empty hi hi
must read: http://www.beej.us/guide/bgnet/
zu c99: http://www.c-plusplus.de/forum/296310-full
00000000011111111112222222222333333333344444444445555555555666666666677777777778
1234567890 1234567890 1234567890 1234567890
1234567890 1234567890 1234567890 1234567890

View File

@ -43,7 +43,7 @@ static void print_current_image(const struct message* msg, int start, int end) {
}
void callback(const struct message *msg) {
void callback(const struct message *msg, const struct prog_info *pinfo) {
printf("in callback, tst=%d\n", msg->timestamp);
int start;

View File

@ -3,11 +3,12 @@
#include <stdio.h>
#include "msg.h"
#include "misc.h"
void setup_display();
void cleanup_display();
void callback(const struct message *msg);
void callback(const struct message *msg, const struct prog_info *pinfo);
#endif

View File

@ -26,6 +26,7 @@ int parseArgs(struct prog_info *pinfo, int argc, char **argv) {
printf( " -t <fps> when in server mode: update <fps> times\n");
printf( " per second. Valid range: 2 - 99\n");
printf( " no use in client mode\n");
printf( " -v \n");
printf("\n\n");
return -1;
}

View File

@ -109,7 +109,7 @@ int run_server(const struct prog_info *pinfo) {
// lauschangriff:
// einfach mal in den äther horchen und alle messages rausnehmen die wo da gibt.
//
int run_client(const struct prog_info *pinfo, void (*framecallback)(const struct message *) ) {
int run_client(const struct prog_info *pinfo, void (*framecallback)(const struct message *, const struct prog_info *) ) {
struct addrinfo hints, *servinfo;
char portbuf[6];
@ -171,7 +171,7 @@ int run_client(const struct prog_info *pinfo, void (*framecallback)(const struct
struct message *msg = (struct message *)malloc(sizeof(struct message));
deserialize(msg, buf);
framecallback(msg);
framecallback(msg, pinfo);
} while (strncmp(buf, "exit", 10000));

View File

@ -8,6 +8,6 @@
void *get_in_addr(struct sockaddr *sa);
int run_server(const struct prog_info *pinfo);
int run_client(const struct prog_info *pinfo,void(*framecallback)(const struct message *));
int run_client(const struct prog_info *pinfo,void(*framecallback)(const struct message *, const struct prog_info *));
#endif