Merge pull request #2519 from haukepetersen/ng_netapi_fixes
net/ng_netapi: fixed implementation
This commit is contained in:
commit
714c912a88
@ -39,15 +39,15 @@ static inline int _get_set(kernel_pid_t pid, uint16_t type,
|
|||||||
{
|
{
|
||||||
msg_t cmd;
|
msg_t cmd;
|
||||||
msg_t ack;
|
msg_t ack;
|
||||||
ng_netapi_opt_t opt;
|
ng_netapi_opt_t o;
|
||||||
/* set ńetapi's option struct */
|
/* set ńetapi's option struct */
|
||||||
opt.type = opt;
|
o.opt = opt;
|
||||||
opt.context = context;
|
o.context = context;
|
||||||
opt.data = data;
|
o.data = data;
|
||||||
opt.data_len = data_len;
|
o.data_len = data_len;
|
||||||
/* set outgoing message's fields */
|
/* set outgoing message's fields */
|
||||||
cmd.type = type;
|
cmd.type = type;
|
||||||
cmd.content.ptr = (void *)&opt;
|
cmd.content.ptr = (void *)&o;
|
||||||
/* trigger the netapi */
|
/* trigger the netapi */
|
||||||
msg_send_receive(&cmd, &ack, pid);
|
msg_send_receive(&cmd, &ack, pid);
|
||||||
/* return the ACK message's value */
|
/* return the ACK message's value */
|
||||||
@ -58,7 +58,7 @@ int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt)
|
|||||||
{
|
{
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
/* set the outgoing message's fields */
|
/* set the outgoing message's fields */
|
||||||
msg.type = NETAPI_MSG_TYPE_SND;
|
msg.type = NG_NETAPI_MSG_TYPE_SND;
|
||||||
msg.content.ptr = (void *)pkt;
|
msg.content.ptr = (void *)pkt;
|
||||||
/* send data using netapi */
|
/* send data using netapi */
|
||||||
return msg_send(&msg, pid);
|
return msg_send(&msg, pid);
|
||||||
@ -67,13 +67,13 @@ int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt)
|
|||||||
int ng_netapi_get(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
|
int ng_netapi_get(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
|
||||||
void *data, size_t data_len)
|
void *data, size_t data_len)
|
||||||
{
|
{
|
||||||
return _get_set(pid, NG_NETAPI_MSG_TYPE_GETOPT, opt, context,
|
return _get_set(pid, NG_NETAPI_MSG_TYPE_GET, opt, context,
|
||||||
data, data_len);
|
data, data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ng_netapi_set(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
|
int ng_netapi_set(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
|
||||||
void *data, size_t data_len)
|
void *data, size_t data_len)
|
||||||
{
|
{
|
||||||
return _get_set(pid, NG_NETAPI_MSG_TYPE_SETOPT, opt, context,
|
return _get_set(pid, NG_NETAPI_MSG_TYPE_SET, opt, context,
|
||||||
data, data_len);
|
data, data_len);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user