Implement src/address.c
This commit is contained in:
parent
57e0a2c077
commit
275dec9760
3 changed files with 35 additions and 2 deletions
|
@ -16,4 +16,8 @@ typedef struct _patty_ax25_address {
|
|||
};
|
||||
} patty_ax25_address;
|
||||
|
||||
patty_ax25_address *patty_ax25_address_create(const char *callsign, int ssid);
|
||||
|
||||
void patty_ax25_address_destroy(patty_ax25_address *address);
|
||||
|
||||
#endif /* _PATTY_AX25_ADDRESS_H */
|
||||
|
|
|
@ -8,9 +8,10 @@ CFLAGS = $(CGFLAGS) -fPIC -Wall -O2 -I$(INCLUDE_PATH)
|
|||
LDFLAGS =
|
||||
|
||||
HEADERS = kiss.h ax25.h ax25/if.h ax25/macros.h ax25/proto.h \
|
||||
ax25/frame.h list.h hash.h dict.h
|
||||
ax25/address.h ax25/frame.h list.h hash.h dict.h
|
||||
|
||||
OBJS = kiss.o ax25.o if.o frame.o list.o hash.o dict.o test.o
|
||||
OBJS = kiss.o ax25.o if.o address.o frame.o list.o hash.o dict.o \
|
||||
test.o
|
||||
|
||||
PROGRAM = test
|
||||
|
||||
|
|
28
src/address.c
Normal file
28
src/address.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <patty/ax25/address.h>
|
||||
|
||||
patty_ax25_address *patty_ax25_address_create(const char *callsign, int ssid) {
|
||||
patty_ax25_address *addr;
|
||||
|
||||
if ((addr = malloc(sizeof(*addr))) == NULL) {
|
||||
goto error_malloc_addr;
|
||||
}
|
||||
|
||||
strncpy(addr->callsign, callsign, sizeof(addr->callsign));
|
||||
|
||||
addr->ssid = ssid;
|
||||
addr->last = 0;
|
||||
addr->c = 0;
|
||||
|
||||
return addr;
|
||||
|
||||
error_malloc_addr:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void patty_ax25_address_destroy(patty_ax25_address *address) {
|
||||
free(address);
|
||||
}
|
Loading…
Add table
Reference in a new issue