Free (GPLv2) TCP/IP stack developed by TASS Belgium

Dependents:   lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_device.h Source File

pico_device.h

00001 /*********************************************************************
00002    PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
00003    See LICENSE and COPYING for usage.
00004 
00005  *********************************************************************/
00006 #ifndef INCLUDE_PICO_DEVICE
00007 #define INCLUDE_PICO_DEVICE
00008 #include "pico_queue.h"
00009 #include "pico_frame.h"
00010 #include "pico_addressing.h"
00011 #include "pico_tree.h"
00012 extern struct pico_tree Device_tree;
00013 #include "pico_ipv6_nd.h"
00014 #define MAX_DEVICE_NAME 16
00015 
00016 
00017 struct pico_ethdev {
00018     struct pico_eth mac;
00019 };
00020 
00021 struct pico_device {
00022     char name[MAX_DEVICE_NAME];
00023     uint32_t hash;
00024     uint32_t overhead;
00025     uint32_t mtu;
00026     struct pico_ethdev *eth; /* Null if non-ethernet */
00027     struct pico_queue *q_in;
00028     struct pico_queue *q_out;
00029     int (*link_state)(struct pico_device *self);
00030     int (*send)(struct pico_device *self, void *buf, int len); /* Send function. Return 0 if busy */
00031     int (*poll)(struct pico_device *self, int loop_score);
00032     void (*destroy)(struct pico_device *self);
00033     int (*dsr)(struct pico_device *self, int loop_score);
00034     int __serving_interrupt;
00035     /* used to signal the upper layer the number of events arrived since the last processing */
00036     volatile int eventCnt;
00037   #ifdef PICO_SUPPORT_IPV6
00038     struct pico_nd_hostvars hostvars;
00039   #endif
00040 };
00041 
00042 
00043 int pico_device_init(struct pico_device *dev, const char *name, uint8_t *mac);
00044 void pico_device_destroy(struct pico_device *dev);
00045 int pico_devices_loop(int loop_score, int direction);
00046 struct pico_device*pico_get_device(const char*name);
00047 int32_t pico_device_broadcast(struct pico_frame *f);
00048 int pico_device_link_state(struct pico_device *dev);
00049 int pico_device_ipv6_random_ll(struct pico_device *dev);
00050 #ifdef PICO_SUPPORT_IPV6
00051 struct pico_ipv6_link *pico_ipv6_link_add_local(struct pico_device *dev, const struct pico_ip6 *prefix);
00052 #endif
00053 
00054 #endif