Incremental...
This commit is contained in:
		
							parent
							
								
									86f5dd44b9
								
							
						
					
					
						commit
						1bef463d8b
					
				
					 2 changed files with 46 additions and 6 deletions
				
			
		| 
						 | 
					@ -33,12 +33,6 @@ typedef struct _patty_ax25_stats {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _patty_ax25_address patty_ax25_port;
 | 
					typedef struct _patty_ax25_address patty_ax25_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _patty_ax25_link {
 | 
					 | 
				
			||||||
    patty_ax25_port  local;
 | 
					 | 
				
			||||||
    patty_ax25_port  remote;
 | 
					 | 
				
			||||||
    patty_ax25_stats stats;
 | 
					 | 
				
			||||||
} patty_ax25_link;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct _patty_ax25_if {
 | 
					typedef struct _patty_ax25_if {
 | 
				
			||||||
    enum patty_ax25_if_type type;
 | 
					    enum patty_ax25_if_type type;
 | 
				
			||||||
    patty_kiss_tnc *        tnc;
 | 
					    patty_kiss_tnc *        tnc;
 | 
				
			||||||
| 
						 | 
					@ -46,6 +40,13 @@ typedef struct _patty_ax25_if {
 | 
				
			||||||
    patty_dict *            ports;
 | 
					    patty_dict *            ports;
 | 
				
			||||||
} patty_ax25_if;
 | 
					} patty_ax25_if;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct _patty_ax25_link {
 | 
				
			||||||
 | 
					    patty_ax25_if *    iface;
 | 
				
			||||||
 | 
					    patty_ax25_port  * local;
 | 
				
			||||||
 | 
					    patty_ax25_port  * remote;
 | 
				
			||||||
 | 
					    patty_ax25_stats * stats;
 | 
				
			||||||
 | 
					} patty_ax25_link;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _patty_ax25 {
 | 
					typedef struct _patty_ax25 {
 | 
				
			||||||
    patty_dict * ifaces; /* Key: AX.25 interface name */
 | 
					    patty_dict * ifaces; /* Key: AX.25 interface name */
 | 
				
			||||||
    patty_dict * ports;  /* Key: Integer port descriptor */
 | 
					    patty_dict * ports;  /* Key: Integer port descriptor */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										39
									
								
								src/ax25.c
									
										
									
									
									
								
							
							
						
						
									
										39
									
								
								src/ax25.c
									
										
									
									
									
								
							| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
| 
						 | 
					@ -90,3 +91,41 @@ patty_ax25_if *patty_ax25_create_if(patty_ax25 *ax25, int opts, void *info) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					patty_ax25_port *patty_ax25_listen(patty_ax25 *ax25, patty_ax25_if *iface, const char *callsign, int ssid) {
 | 
				
			||||||
 | 
					    patty_ax25_port *port;
 | 
				
			||||||
 | 
					    char key[10];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ((port = malloc(sizeof(*port))) == NULL) {
 | 
				
			||||||
 | 
					        goto error_malloc_port;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (strncpy(port->callsign, callsign, 7) == NULL) {
 | 
				
			||||||
 | 
					        goto error_strncpy_callsign;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    port->ssid     = ssid;
 | 
				
			||||||
 | 
					    port->repeated = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (snprintf(key, sizeof(key), "%s/%d", callsign, ssid) < 0) {
 | 
				
			||||||
 | 
					        goto error_snprintf_key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (patty_dict_set(iface->ports, (void *)key, strlen(key), port) == NULL) {
 | 
				
			||||||
 | 
					        goto error_dict_set_port;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (patty_dict_set(ax25->ports, (void *)key, strlen(key), port) == NULL) {
 | 
				
			||||||
 | 
					        goto error_dict_set_port;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					error_dict_set_port:
 | 
				
			||||||
 | 
					error_strncpy_callsign:
 | 
				
			||||||
 | 
					error_snprintf_key:
 | 
				
			||||||
 | 
					    free(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					error_malloc_port:
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue