Good stuff
This commit is contained in:
		
							parent
							
								
									d7e40110a5
								
							
						
					
					
						commit
						04cd913840
					
				
					 3 changed files with 14 additions and 5 deletions
				
			
		|  | @ -38,7 +38,7 @@ typedef struct _patty_ax25_sock { | |||
| 
 | ||||
|     int n_maxlen; | ||||
|     int n_retry; | ||||
|     int n_outstanding; | ||||
|     int n_window; | ||||
| 
 | ||||
|     int seq_send; | ||||
|     int seq_recv; | ||||
|  |  | |||
|  | @ -4,6 +4,9 @@ | |||
| #include <stdint.h> | ||||
| #include <sys/types.h> | ||||
| 
 | ||||
| #define PATTY_AX25_FRAME_DEFAULT_MAXLEN 256 | ||||
| #define PATTY_AX25_FRAME_DEFAULT_WINDOW   8 | ||||
| 
 | ||||
| enum patty_ax25_frame_type { | ||||
|     PATTY_AX25_FRAME_UNKNOWN, | ||||
|     PATTY_AX25_FRAME_INFO, | ||||
|  |  | |||
							
								
								
									
										14
									
								
								src/ax25.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								src/ax25.c
									
										
									
									
									
								
							|  | @ -73,6 +73,14 @@ error_dict_set: | |||
|     return -1; | ||||
| } | ||||
| 
 | ||||
| static void sock_init(patty_ax25_sock *sock) { | ||||
|     memset(sock, '\0', sizeof(*sock)); | ||||
| 
 | ||||
|     sock->status   = PATTY_AX25_SOCK_OPEN; | ||||
|     sock->n_maxlen = PATTY_AX25_FRAME_DEFAULT_MAXLEN; | ||||
|     sock->n_window = PATTY_AX25_FRAME_DEFAULT_WINDOW; | ||||
| } | ||||
| 
 | ||||
| int patty_ax25_socket(patty_ax25 *ax25) { | ||||
|     patty_ax25_sock *sock; | ||||
|     int fd; | ||||
|  | @ -81,9 +89,7 @@ int patty_ax25_socket(patty_ax25 *ax25) { | |||
|         goto error_malloc_sock; | ||||
|     } | ||||
| 
 | ||||
|     memset(sock, '\0', sizeof(*sock)); | ||||
| 
 | ||||
|     sock->status = PATTY_AX25_SOCK_OPEN; | ||||
|     sock_init(sock); | ||||
| 
 | ||||
|     if ((fd = fd_store(ax25, sock)) < 0) { | ||||
|         goto error_fd_store; | ||||
|  | @ -105,7 +111,7 @@ int patty_ax25_open(patty_ax25 *ax25, const char *ifname) { | |||
|         goto error_malloc_sock; | ||||
|     } | ||||
| 
 | ||||
|     memset(sock, '\0', sizeof(*sock)); | ||||
|     sock_init(sock); | ||||
| 
 | ||||
|     if ((sock->iface = patty_ax25_get_if(ax25, ifname)) == NULL) { | ||||
|         goto error_get_if; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue