mirror of git://git.sysmocom.de/ofono
Remove useless pppcp_protocol_data structure
This commit is contained in:
parent
5f0d8493e7
commit
4f99859d37
|
@ -30,6 +30,7 @@
|
||||||
#define PPP_CTRL 0x03
|
#define PPP_CTRL 0x03
|
||||||
#define LCP_PROTOCOL 0xc021
|
#define LCP_PROTOCOL 0xc021
|
||||||
#define CHAP_PROTOCOL 0xc223
|
#define CHAP_PROTOCOL 0xc223
|
||||||
|
#define IPCP_PROTO 0x8021
|
||||||
#define PPP_HEADROOM 2
|
#define PPP_HEADROOM 2
|
||||||
#define HDLC_HEADROOM 3
|
#define HDLC_HEADROOM 3
|
||||||
#define HDLC_TAIL 3
|
#define HDLC_TAIL 3
|
||||||
|
|
|
@ -264,7 +264,7 @@ static void print_option(gpointer data, gpointer user_data)
|
||||||
struct pppcp_data *pppcp = user_data;
|
struct pppcp_data *pppcp = user_data;
|
||||||
|
|
||||||
g_print("%s: option %d len %d (%s)", pppcp->prefix, option->type,
|
g_print("%s: option %d len %d (%s)", pppcp->prefix, option->type,
|
||||||
option->length, pppcp->options[option->type]);
|
option->length, pppcp->option_strings[option->type]);
|
||||||
if (option->length > 2) {
|
if (option->length > 2) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < option->length - 2; i++)
|
for (i = 0; i < option->length - 2; i++)
|
||||||
|
@ -1605,7 +1605,7 @@ void pppcp_free(struct pppcp_data *data)
|
||||||
g_free(data);
|
g_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pppcp_data *pppcp_new(struct pppcp_protocol_data *protocol_data)
|
struct pppcp_data *pppcp_new(GAtPPP *ppp, guint16 proto)
|
||||||
{
|
{
|
||||||
struct pppcp_data *data;
|
struct pppcp_data *data;
|
||||||
|
|
||||||
|
@ -1623,11 +1623,9 @@ struct pppcp_data *pppcp_new(struct pppcp_protocol_data *protocol_data)
|
||||||
data->max_failure = MAX_FAILURE;
|
data->max_failure = MAX_FAILURE;
|
||||||
data->event_queue = g_queue_new();
|
data->event_queue = g_queue_new();
|
||||||
data->identifier = 0;
|
data->identifier = 0;
|
||||||
data->ppp = protocol_data->ppp;
|
|
||||||
data->proto = protocol_data->proto;
|
data->ppp = ppp;
|
||||||
data->priv = protocol_data->priv;
|
data->proto = proto;
|
||||||
data->prefix = protocol_data->prefix;
|
|
||||||
data->options = protocol_data->options;
|
|
||||||
|
|
||||||
/* setup func ptrs for processing packet by pppcp code */
|
/* setup func ptrs for processing packet by pppcp code */
|
||||||
data->packet_ops[CONFIGURE_REQUEST - 1] =
|
data->packet_ops[CONFIGURE_REQUEST - 1] =
|
||||||
|
|
|
@ -106,14 +106,6 @@ struct pppcp_timer_data {
|
||||||
guint restart_timer;
|
guint restart_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pppcp_protocol_data {
|
|
||||||
guint16 proto;
|
|
||||||
const char *prefix;
|
|
||||||
const char **options;
|
|
||||||
gpointer priv;
|
|
||||||
GAtPPP *ppp;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pppcp_data {
|
struct pppcp_data {
|
||||||
enum pppcp_state state;
|
enum pppcp_state state;
|
||||||
struct pppcp_timer_data config_timer_data;
|
struct pppcp_timer_data config_timer_data;
|
||||||
|
@ -140,10 +132,10 @@ struct pppcp_data {
|
||||||
gpointer priv;
|
gpointer priv;
|
||||||
guint16 proto;
|
guint16 proto;
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
const char **options;
|
const char **option_strings;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pppcp_data *pppcp_new(struct pppcp_protocol_data *proto_data);
|
struct pppcp_data *pppcp_new(GAtPPP *ppp, guint16 proto);
|
||||||
void pppcp_free(struct pppcp_data *data);
|
void pppcp_free(struct pppcp_data *data);
|
||||||
void pppcp_add_config_option(struct pppcp_data *data,
|
void pppcp_add_config_option(struct pppcp_data *data,
|
||||||
struct ppp_option *option);
|
struct ppp_option *option);
|
||||||
|
|
|
@ -153,8 +153,6 @@ static void lcp_option_process(gpointer data, gpointer user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char lcp_prefix[] = "lcp";
|
|
||||||
|
|
||||||
static const char *lcp_option_strings[256] = {
|
static const char *lcp_option_strings[256] = {
|
||||||
[0] = "Vendor Specific",
|
[0] = "Vendor Specific",
|
||||||
[1] = "Maximum-Receive-Unit",
|
[1] = "Maximum-Receive-Unit",
|
||||||
|
@ -172,12 +170,6 @@ static const char *lcp_option_strings[256] = {
|
||||||
[13] = "Callback",
|
[13] = "Callback",
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pppcp_protocol_data lcp_protocol_data = {
|
|
||||||
.proto = LCP_PROTOCOL,
|
|
||||||
.prefix = lcp_prefix,
|
|
||||||
.options = lcp_option_strings,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ppp_packet_handler lcp_packet_handler = {
|
struct ppp_packet_handler lcp_packet_handler = {
|
||||||
.proto = LCP_PROTOCOL,
|
.proto = LCP_PROTOCOL,
|
||||||
.handler = pppcp_process_packet,
|
.handler = pppcp_process_packet,
|
||||||
|
@ -249,13 +241,14 @@ struct pppcp_data *lcp_new(GAtPPP *ppp)
|
||||||
struct ppp_option *option;
|
struct ppp_option *option;
|
||||||
guint16 codes = LCP_SUPPORTED_CODES;
|
guint16 codes = LCP_SUPPORTED_CODES;
|
||||||
|
|
||||||
lcp_protocol_data.ppp = ppp;
|
pppcp = pppcp_new(ppp, LCP_PROTOCOL);
|
||||||
pppcp = pppcp_new(&lcp_protocol_data);
|
|
||||||
if (!pppcp) {
|
if (!pppcp) {
|
||||||
g_print("Failed to allocate PPPCP struct\n");
|
g_print("Failed to allocate PPPCP struct\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pppcp_set_valid_codes(pppcp, codes);
|
pppcp_set_valid_codes(pppcp, codes);
|
||||||
|
pppcp->option_strings = lcp_option_strings;
|
||||||
|
pppcp->prefix = "lcp";
|
||||||
pppcp->priv = pppcp;
|
pppcp->priv = pppcp;
|
||||||
|
|
||||||
/* set the actions */
|
/* set the actions */
|
||||||
|
|
|
@ -169,8 +169,6 @@ struct ppp_packet_handler ip_packet_handler = {
|
||||||
(1 << TERMINATE_ACK) | \
|
(1 << TERMINATE_ACK) | \
|
||||||
(1 << CODE_REJECT))
|
(1 << CODE_REJECT))
|
||||||
|
|
||||||
#define IPCP_PROTO 0x8021
|
|
||||||
|
|
||||||
enum ipcp_option_types {
|
enum ipcp_option_types {
|
||||||
IP_ADDRESSES = 1,
|
IP_ADDRESSES = 1,
|
||||||
IP_COMPRESSION_PROTO = 2,
|
IP_COMPRESSION_PROTO = 2,
|
||||||
|
@ -291,8 +289,6 @@ struct pppcp_action ipcp_action = {
|
||||||
.option_process = ipcp_option_process,
|
.option_process = ipcp_option_process,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char ipcp_prefix[] = "ipcp";
|
|
||||||
|
|
||||||
static const char *ipcp_option_strings[256] = {
|
static const char *ipcp_option_strings[256] = {
|
||||||
[IP_ADDRESSES] = "IP-Addresses (deprecated)",
|
[IP_ADDRESSES] = "IP-Addresses (deprecated)",
|
||||||
[IP_COMPRESSION_PROTO] = "IP-Compression-Protocol",
|
[IP_COMPRESSION_PROTO] = "IP-Compression-Protocol",
|
||||||
|
@ -304,12 +300,6 @@ static const char *ipcp_option_strings[256] = {
|
||||||
[SECONDARY_NBNS_SERVER] = "Secondary NBNS Server Address",
|
[SECONDARY_NBNS_SERVER] = "Secondary NBNS Server Address",
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pppcp_protocol_data ipcp_protocol_data = {
|
|
||||||
.proto = IPCP_PROTO,
|
|
||||||
.prefix = ipcp_prefix,
|
|
||||||
.options = ipcp_option_strings,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ppp_packet_handler ipcp_packet_handler = {
|
struct ppp_packet_handler ipcp_packet_handler = {
|
||||||
.proto = IPCP_PROTO,
|
.proto = IPCP_PROTO,
|
||||||
.handler = pppcp_process_packet,
|
.handler = pppcp_process_packet,
|
||||||
|
@ -325,15 +315,16 @@ static struct pppcp_data *ipcp_new(GAtPPP *ppp)
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ipcp_protocol_data.ppp = ppp;
|
pppcp = pppcp_new(ppp, IPCP_PROTO);
|
||||||
ipcp_protocol_data.priv = data;
|
|
||||||
pppcp = pppcp_new(&ipcp_protocol_data);
|
|
||||||
if (!pppcp) {
|
if (!pppcp) {
|
||||||
g_printerr("Failed to allocate PPPCP struct\n");
|
g_printerr("Failed to allocate PPPCP struct\n");
|
||||||
g_free(data);
|
g_free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pppcp_set_valid_codes(pppcp, IPCP_SUPPORTED_CODES);
|
pppcp_set_valid_codes(pppcp, IPCP_SUPPORTED_CODES);
|
||||||
|
pppcp->option_strings = ipcp_option_strings;
|
||||||
|
pppcp->prefix = "ipcp";
|
||||||
|
pppcp->priv = data;
|
||||||
|
|
||||||
/* set the actions */
|
/* set the actions */
|
||||||
pppcp->action = &ipcp_action;
|
pppcp->action = &ipcp_action;
|
||||||
|
|
Loading…
Reference in New Issue