callback extended
This commit is contained in:
		
							parent
							
								
									fb592b6f13
								
							
						
					
					
						commit
						38ca85a7b3
					
				
							
								
								
									
										6
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								README
									
									
									
									
									
								
							|  | @ -1,8 +1,8 @@ | ||||||
| empty hi hi |  | ||||||
| 
 | 
 | ||||||
| must read: http://www.beej.us/guide/bgnet/ | must read: http://www.beej.us/guide/bgnet/ | ||||||
| 
 |  | ||||||
| zu c99: http://www.c-plusplus.de/forum/296310-full | zu c99: http://www.c-plusplus.de/forum/296310-full | ||||||
| 
 | 
 | ||||||
| 
 | 00000000011111111112222222222333333333344444444445555555555666666666677777777778 | ||||||
|  | 1234567890          1234567890          1234567890          1234567890            | ||||||
|  |           1234567890          1234567890          1234567890          1234567890 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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); | 	printf("in callback, tst=%d\n", msg->timestamp); | ||||||
| 	 | 	 | ||||||
| 	int start; | 	int start; | ||||||
|  |  | ||||||
|  | @ -3,11 +3,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include "msg.h" | #include "msg.h" | ||||||
|  | #include "misc.h" | ||||||
| 
 | 
 | ||||||
| void setup_display(); | void setup_display(); | ||||||
| void cleanup_display(); | void cleanup_display(); | ||||||
| 
 | 
 | ||||||
| void callback(const struct message *msg); | void callback(const struct message *msg, const struct prog_info *pinfo); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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(        " -t <fps>   when in server mode: update <fps> times\n");  | ||||||
| 		printf(        "            per second. Valid range: 2 - 99\n"); | 		printf(        "            per second. Valid range: 2 - 99\n"); | ||||||
| 		printf(        "            no use in client mode\n"); | 		printf(        "            no use in client mode\n"); | ||||||
|  | 		printf(        " -v          \n"); | ||||||
| 		printf("\n\n"); | 		printf("\n\n"); | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ int run_server(const struct prog_info *pinfo) { | ||||||
| // lauschangriff:
 | // lauschangriff:
 | ||||||
| // einfach mal in den äther horchen und alle messages rausnehmen die wo da gibt.
 | // 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; | 	struct addrinfo hints, *servinfo; | ||||||
| 	char portbuf[6]; | 	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)); | 		struct message *msg = (struct message *)malloc(sizeof(struct message)); | ||||||
| 		deserialize(msg, buf); | 		deserialize(msg, buf); | ||||||
| 
 | 
 | ||||||
| 		framecallback(msg); | 		framecallback(msg, pinfo); | ||||||
| 
 | 
 | ||||||
| 	} while (strncmp(buf, "exit", 10000)); | 	} while (strncmp(buf, "exit", 10000)); | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,6 @@ | ||||||
| 
 | 
 | ||||||
| void *get_in_addr(struct sockaddr *sa); | void *get_in_addr(struct sockaddr *sa); | ||||||
| int run_server(const struct prog_info *pinfo); | 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 | #endif | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 tkarrass
						tkarrass