#include "core/interface/wmp_interface.h"#include <stdio.h>#include <netinet/in.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <linux/if.h>#include <netpacket/packet.h>#include <net/ethernet.h>#include <linux/fs.h>#include "../include/cross_space.h"#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include "../include/ioctl_interface.h"
Go to the source code of this file.
Functions | |
| char | lqm_get_val (int i, int j) |
| int | wmp_queue_tx_get_room (void) |
| int | wmp_queue_tx_remove_head (void) |
| void | wmpClose () |
| int | wmpGetActiveSearch (void) |
| int | wmpGetCpuDelay () |
| int | wmpGetFlowControl () |
| short | wmpGetInstanceId () |
| int | wmpGetLatestDistances (char *lqm) |
| int | wmpGetLatestLQM (char *lqm) |
| unsigned int | wmpGetLoopId (void) |
| int | wmpGetMessageReschedule () |
| unsigned int | wmpGetMTU (void) |
| int | wmpGetNetIT (void) |
| char | wmpGetNodeId (void) |
| int | wmpGetNumOfElementsInRXQueue (int port) |
| int | wmpGetNumOfElementsInTXQueue (void) |
| char | wmpGetNumOfNodes (void) |
| int | wmpGetPrimBasedRouting () |
| int | wmpGetRate () |
| unsigned int | wmpGetSerial (void) |
| int | wmpGetTimeout () |
| int | wmpGetWCMult () |
| int | wmpInit (char *ifname) |
| int | wmpIsKernelSpace () |
| int | wmpIsNetworkConnected (void) |
| int | wmpIsNetworkConnectedBlocking (int timeout_ms) |
| int | wmpNonBlockingPop (Msg *p) |
| unsigned int | wmpPop (Msg *p) |
| int | wmpPopData (unsigned int port, char **p, unsigned int *size, unsigned char *src, signed char *priority) |
| int | wmpPopDataCopy (unsigned int port, char *p, unsigned int *size, unsigned char *src, signed char *priority) |
| void | wmpPopDataDone (int id) |
| int | wmpPopDataTimeout (unsigned int port, char **p, unsigned int *size, unsigned char *src, signed char *priority, int to) |
| int | wmpPopDataTimeoutCopy (unsigned int port, char *p, unsigned int *size, unsigned char *src, signed char *priority, int to) |
| int | wmpPush (Msg *p) |
| int | wmpPushData (unsigned int port, char *p, unsigned int size, unsigned int dest, signed char priority) |
| void | wmpRun () |
| void | wmpRunBG () |
| void | wmpSetActiveSearch (int val) |
| void | wmpSetCpuDelay (int val) |
| void | wmpSetFlowControl (int val) |
| void | wmpSetInstanceId (short iid) |
| void | wmpSetMessageReschedule (int val) |
| void | wmpSetPrimBasedRouting (int val) |
| void | wmpSetRate (int val) |
| void | wmpSetTimeout (int val) |
| int | wmpSetup (char p1, char p2) |
| void | wmpSetWCMult (int val) |
| int | wmpTimedPop (Msg *p, int timeout_ms) |
Variables | |
| static int | fp |
| static struct ifreq | ifr |
| static int | ioctl_sock |
| char lqm_get_val | ( | int | i, |
| int | j | ||
| ) |
Definition at line 615 of file wmp_interface.c.
| int wmp_queue_tx_get_room | ( | void | ) |
Returns the number of free posiitons in the TX queue
Definition at line 393 of file wmp_interface.c.
| int wmp_queue_tx_remove_head | ( | void | ) |
Remove the less priority message from the TX queue
| p | the removed message |
Definition at line 285 of file wmp_interface.c.
| void wmpClose | ( | ) |
Definition at line 64 of file wmp_interface.c.
| int wmpGetActiveSearch | ( | void | ) |
Returns the status of the active search capability
Definition at line 465 of file wmp_interface.c.
| int wmpGetCpuDelay | ( | void | ) |
Returns the delay that RT-WMP process waits before transmitting (to leave the processor to other tasks)
Definition at line 309 of file wmp_interface.c.
| int wmpGetFlowControl | ( | void | ) |
Definition at line 561 of file wmp_interface.c.
| short wmpGetInstanceId | ( | void | ) |
Definition at line 489 of file wmp_interface.c.
| int wmpGetLatestDistances | ( | char * | lqm | ) |
Definition at line 247 of file wmp_interface.c.
| int wmpGetLatestLQM | ( | char * | lqm | ) |
Returns latest lqm in a buffer. The Matrix should be scanned with a innested for loop:
char lqm[wmpGetNumOfNodes()*wmpGetNumOfNodes()],p;
wmpGetLatestLQM(lqm);
p = lqm;
for (i = 0; i<wmpGetNumOfNodes() ; i++){
for (j = 0; j<wmpGetNumOfNodes() ; j++){
element_ij = *p;
p++;
};
};
| lqm | an (at least) n x n char buffer (output parameter) |
Definition at line 235 of file wmp_interface.c.
| unsigned int wmpGetLoopId | ( | void | ) |
Definition at line 585 of file wmp_interface.c.
| int wmpGetMessageReschedule | ( | void | ) |
Definition at line 537 of file wmp_interface.c.
| unsigned int wmpGetMTU | ( | void | ) |
Returns the Maximum Transmission Unit for USER data
Definition at line 441 of file wmp_interface.c.
| int wmpGetNetIT | ( | void | ) |
Returns the network inactivity timeout
Definition at line 429 of file wmp_interface.c.
| char wmpGetNodeId | ( | void | ) |
Returns the WMP address of the local node
Definition at line 211 of file wmp_interface.c.
| int wmpGetNumOfElementsInRXQueue | ( | int | port | ) |
Returns the number of elements in the RX queue
Definition at line 417 of file wmp_interface.c.
| int wmpGetNumOfElementsInTXQueue | ( | void | ) |
Returns the number of elements in the TX queue
Definition at line 405 of file wmp_interface.c.
| char wmpGetNumOfNodes | ( | void | ) |
Returns the total number of nodes of the network
Definition at line 223 of file wmp_interface.c.
| int wmpGetPrimBasedRouting | ( | void | ) |
Definition at line 513 of file wmp_interface.c.
| int wmpGetRate | ( | void | ) |
Returns the network rate (used to calculate delays in frame-hops)
Definition at line 381 of file wmp_interface.c.
| unsigned int wmpGetSerial | ( | void | ) |
Definition at line 573 of file wmp_interface.c.
| int wmpGetTimeout | ( | void | ) |
Returns the reception timeout
Definition at line 333 of file wmp_interface.c.
| int wmpGetWCMult | ( | void | ) |
Returns multiplier for the worst-case loop of the protocol (used to force worse worst-cases and increase QoS performances)
Definition at line 357 of file wmp_interface.c.
| int wmpInit | ( | char * | ifname | ) |
Definition at line 48 of file wmp_interface.c.
| int wmpIsKernelSpace | ( | void | ) |
Definition at line 611 of file wmp_interface.c.
| int wmpIsNetworkConnected | ( | void | ) |
Allows knowing if the network is connected (i.e. all the nodes are up and working and connected among them)
Definition at line 260 of file wmp_interface.c.
| int wmpIsNetworkConnectedBlocking | ( | int | timeout_ms | ) |
Allows knowing if the network is connected (i.e. all the nodes are up and working and connected among them and if not, blocks the caller thread until connected
| timeout_ms | specify the maximum wait for connection (if timeout_ms = 0 wait forever) |
Definition at line 272 of file wmp_interface.c.
| int wmpNonBlockingPop | ( | Msg * | p | ) |
Dequeue a message from the RX Queue if present. If there are not message to dequeue, returns a negative value
| p | the message to pop |
Definition at line 80 of file wmp_interface.c.
Dequeue a message from the RX Queue
| p | the message to pop |
Definition at line 72 of file wmp_interface.c.
| int wmpPopData | ( | unsigned int | port, |
| char ** | p, | ||
| unsigned int * | size, | ||
| unsigned char * | src, | ||
| signed char * | priority | ||
| ) |
Definition at line 170 of file wmp_interface.c.
| int wmpPopDataCopy | ( | unsigned int | port, |
| char * | p, | ||
| unsigned int * | size, | ||
| unsigned char * | src, | ||
| signed char * | priority | ||
| ) |
Definition at line 84 of file wmp_interface.c.
| void wmpPopDataDone | ( | int | id | ) |
Definition at line 204 of file wmp_interface.c.
| int wmpPopDataTimeout | ( | unsigned int | port, |
| char ** | p, | ||
| unsigned int * | size, | ||
| unsigned char * | src, | ||
| signed char * | priority, | ||
| int | to | ||
| ) |
Definition at line 174 of file wmp_interface.c.
| int wmpPopDataTimeoutCopy | ( | unsigned int | port, |
| char * | p, | ||
| unsigned int * | size, | ||
| unsigned char * | src, | ||
| signed char * | priority, | ||
| int | to | ||
| ) |
Definition at line 144 of file wmp_interface.c.
Enqueue a message in the TX Queue
| p | the message to push |
Definition at line 68 of file wmp_interface.c.
| int wmpPushData | ( | unsigned int | port, |
| char * | p, | ||
| unsigned int | size, | ||
| unsigned int | dest, | ||
| signed char | priority | ||
| ) |
Definition at line 133 of file wmp_interface.c.
| void wmpRun | ( | void | ) |
Starts the process in foreground (blocking)
Definition at line 601 of file wmp_interface.c.
| void wmpRunBG | ( | void | ) |
Starts the process in background (separate thread)
Definition at line 607 of file wmp_interface.c.
| void wmpSetActiveSearch | ( | int | val | ) |
Set / Unset the active search capability (default:on)
Definition at line 453 of file wmp_interface.c.
| void wmpSetCpuDelay | ( | int | val | ) |
Sets the delay that RT-WMP process waits before transmitting (to leave the processor to other tasks)
| val | time in milliseconds |
Definition at line 297 of file wmp_interface.c.
| void wmpSetFlowControl | ( | int | val | ) |
Definition at line 549 of file wmp_interface.c.
| void wmpSetInstanceId | ( | short | iid | ) |
Definition at line 477 of file wmp_interface.c.
| void wmpSetMessageReschedule | ( | int | val | ) |
Definition at line 525 of file wmp_interface.c.
| void wmpSetPrimBasedRouting | ( | int | val | ) |
Definition at line 501 of file wmp_interface.c.
| void wmpSetRate | ( | int | val | ) |
Sets network rate (used to calculate delays in frame-hops)
| val | rate in Mbps |
Definition at line 369 of file wmp_interface.c.
| void wmpSetTimeout | ( | int | val | ) |
Sets the reception timeout
| val | time in milliseconds |
Definition at line 321 of file wmp_interface.c.
| int wmpSetup | ( | char | node_id, |
| char | active_nodes | ||
| ) |
Sets up the network
| node_id | specify the WMP address of the local node |
| active_nodes | specify the number of nodes in the network |
Definition at line 597 of file wmp_interface.c.
| void wmpSetWCMult | ( | int | val | ) |
Sets multiplier for the worst-case loop of the protocol (used to force worse worst-cases and increase QoS performances)
| val | multiplier |
Definition at line 345 of file wmp_interface.c.
| int wmpTimedPop | ( | Msg * | p, |
| int | timeout_ms | ||
| ) |
Dequeue a message from the RX Queue if already in the queue or enqueued within timeous_ms milliseconds. If there are not message to dequeue, returns a negative value
| p | the message to pop |
| timeout_ms | pop timeout in milliseconds |
Definition at line 76 of file wmp_interface.c.
int fp [static] |
Definition at line 45 of file wmp_interface.c.
struct ifreq ifr [static] |
Definition at line 46 of file wmp_interface.c.
int ioctl_sock [static] |
Definition at line 45 of file wmp_interface.c.