9 #include <sys/capability.h>
51 cap_value_t capabilies_list[1];
53 capabilities = cap_get_proc();
54 if (NULL == capabilities) {
55 printf(
"Could not get capabilities\n");
59 capabilies_list[0] = CAP_NET_RAW;
61 == cap_set_flag(capabilities, CAP_EFFECTIVE, 1, capabilies_list,
63 cap_free(capabilities);
64 printf(
"Could not set CAP_NET_RAW capability\n");
68 if (-1 == cap_set_proc(capabilities) ) {
69 cap_free(capabilities);
70 printf(
"Could not push CAP_NET_RAW capability to process\n");
74 if (-1 == cap_free(capabilities) ) {
75 printf(
"Could not free capabilites value\n");
80 printf(
"Wrong number of command line parameters!\n");
81 printf(
"The correct command line parameters are:\n");
82 printf(
"./OpENer interfacename\n");
83 printf(
" e.g. ./OpENer eth1\n");
91 printf(
"Network interface %s not found.\n", arg[1]);
120 if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
125 struct sched_param param;
128 CipUint ret = pthread_attr_init(&attr);
135 ret = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
142 ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
147 param.sched_priority = 80;
148 ret = pthread_attr_setschedparam(&attr, ¶m);
154 ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
168 ret = pthread_join(thread, NULL);
void CipConnectionObjectListArrayFree(DoublyLinkedListNode **node)
EipStatus NetworkHandlerProcessOnce(void)
Tracing infrastructure for OpENer.
int main(int argc, char *arg[])
EipStatus NetworkHandlerFinish(void)
void SetDeviceSerialNumber(const EipUint32 serial_number)
Set the serial number of the device's identity object.
void * executeEventLoop()
Signal handler function for ending stack execution.
#define OPENER_TRACE_ERR(...)
void ConfigureMacAddress(const char *network_interface)
Configure the MAC address of the device.
void CipStackInit(const EipUint16 unique_connection_id)
Initialize and setup the CIP-stack.
#define OPENER_TRACE_STATE(...)
DoublyLinkedList connection_list
EipStatus ConfigureNetworkInterface(const char *const network_interface)
Configure the data of the network interface of the device.
int g_end_stack
Flag indicating if the stack should end its execution.
void DoublyLinkedListInitialize(DoublyLinkedList *list, NodeMemoryAllocator allocator, NodeMemoryDeallocator deallocator)
void ShutdownCipStack(void)
Shutdown of the CIP stack.
void ConfigureDomainName(void)
Configure the domain name of the device.
EipStatus NetworkHandlerInitialize(void)
Initializes the network handler, shall be implemented by a port-specific networkhandler.
DoublyLinkedListNode * CipConnectionObjectListArrayAllocator()
void LeaveStack(int pa_nSig)
Signal handler function for ending stack execution.
void ConfigureHostName(void)
Configure the host name of the device.