rspro_util: Add header file

Change-Id: I2f66531008943fa6bdc3c286aee2afd254384018
laforge/bankd-fsm-mistake
Harald Welte 5 years ago
parent 371d026c6b
commit 137c4402d9
  1. 2
      src/Makefile.am
  2. 15
      src/rspro_util.c
  3. 29
      src/rspro_util.h

@ -11,7 +11,7 @@ libosmo_rspro_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \
$(ASN1C_LIBS) rspro/libosmo-asn1-rspro.la
libosmo_rspro_la_SOURCES = rspro_util.c rspro_client.c
noinst_HEADERS = bankd.h internal.h
noinst_HEADERS = bankd.h internal.h rspro_util.h
bin_PROGRAMS = pcsc_test remsim-bankd

@ -6,6 +6,8 @@
#include <osmocom/core/msgb.h>
#include <osmocom/rspro/RsproPDU.h>
#include "rspro_util.h"
struct msgb *rspro_msgb_alloc(void)
{
return msgb_alloc_headroom(1024, 8, "RSPRO");
@ -51,20 +53,9 @@ RsproPDU_t *rspro_dec_msg(struct msgb *msg)
return pdu;
}
#define MAX_NAME_LEN 32
struct app_comp_id {
char name[MAX_NAME_LEN+1];
char software[MAX_NAME_LEN+1];
char sw_version[MAX_NAME_LEN+1];
char hw_manufacturer[MAX_NAME_LEN+1];
char hw_model[MAX_NAME_LEN+1];
char hw_serial_nr[MAX_NAME_LEN+1];
char hw_version[MAX_NAME_LEN+1];
char fw_version[MAX_NAME_LEN+1];
};
static void fill_comp_id(ComponentIdentity_t *out, const struct app_comp_id *in)
{
out->type = in->type;
OCTET_STRING_fromString(&out->name, in->name);
OCTET_STRING_fromString(&out->software, in->software);
OCTET_STRING_fromString(&out->swVersion, in->sw_version);

@ -0,0 +1,29 @@
#pragma once
#include <osmocom/core/msgb.h>
#include <osmocom/rspro/RsproPDU.h>
#include <osmocom/rspro/ComponentType.h>
#define MAX_NAME_LEN 32
struct app_comp_id {
enum ComponentType type;
char name[MAX_NAME_LEN+1];
char software[MAX_NAME_LEN+1];
char sw_version[MAX_NAME_LEN+1];
char hw_manufacturer[MAX_NAME_LEN+1];
char hw_model[MAX_NAME_LEN+1];
char hw_serial_nr[MAX_NAME_LEN+1];
char hw_version[MAX_NAME_LEN+1];
char fw_version[MAX_NAME_LEN+1];
};
struct msgb *rspro_msgb_alloc(void);
struct msgb *rspro_enc_msg(RsproPDU_t *pdu);
RsproPDU_t *rspro_dec_msg(struct msgb *msg);
RsproPDU_t *rspro_gen_ConnectBankReq(const struct app_comp_id *a_cid,
uint16_t bank_id, uint16_t num_slots);
RsproPDU_t *rspro_gen_ConnectClientReq(const struct app_comp_id *a_cid);
RsproPDU_t *rspro_gen_CreateMappingReq(const ClientSlot_t *client, const BankSlot_t *bank);
RsproPDU_t *rspro_gen_ConfigClientReq(const ClientSlot_t *client, uint32_t ip, uint16_t port);
RsproPDU_t *rspro_gen_SetAtrReq(uint16_t client_id, uint16_t slot_nr, const uint8_t *atr,
unsigned int atr_len);
Loading…
Cancel
Save