INET Framework for OMNeT++/OMNEST
inet::tcp Namespace Reference

Classes

class  DumbTCP
 A very-very basic TCPAlgorithm implementation, with hardcoded retransmission timeout and no other sophistication. More...
 
class  DumbTCPStateVariables
 State variables for DumbTCP. More...
 
struct  icmp_echo_hdr
 This is the standard ICMP header only that the u32_t data is splitted to two u16_t like ICMP echo needs it. More...
 
struct  in_addr
 
struct  ip_addr
 
struct  ip_addr2
 
struct  ip_hdr
 
struct  ip_pcb
 
class  LwipTcpStackIf
 Interface class between TCP_lwIP and LwipTcpLayer. More...
 
struct  memp
 
struct  netbuf
 
struct  netif
 Generic data structure used for all lwIP network interfaces. More...
 
struct  nsc_iphdr
 
struct  nsc_ipv6hdr
 
struct  pbuf
 
class  Sack
 
class  Sack_Base
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:122 by nedtool. More...
 
class  SackItem
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:116 by nedtool. More...
 
struct  sys_timeo
 
struct  sys_timeouts
 
class  TCP
 Implements the TCP protocol. More...
 
class  TCP_lwIP
 Encapsulates a Network Simulation Cradle (NSC) instance. More...
 
class  TCP_NSC
 Encapsulates a Network Simulation Cradle (NSC) instance. More...
 
class  TCP_NSC_ByteStreamReceiveQueue
 Receive queue that manages actual bytes. More...
 
class  TCP_NSC_ByteStreamSendQueue
 Send queue that manages actual bytes. More...
 
class  TCP_NSC_Connection
 Encapsulates a Network Simulation Cradle (NSC) instance. More...
 
class  TCP_NSC_ReceiveQueue
 
class  TCP_NSC_SendQueue
 Abstract base class for TCP_NSC send queues. More...
 
class  TCP_NSC_VirtualDataReceiveQueue
 Send/Receive queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TCP_NSC_VirtualDataSendQueue
 Send queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TCPAlgorithm
 Abstract base class for TCP algorithms which encapsulate all behaviour during data transfer state: flavour of congestion control, fast retransmit/recovery, selective acknowledgement etc. More...
 
class  TCPBaseAlg
 Includes basic TCP algorithms: adaptive retransmission, PERSIST timer, keep-alive, delayed acks – EXCLUDING congestion control. More...
 
class  TCPBaseAlgStateVariables
 State variables for TCPBaseAlg. More...
 
class  TCPByteStreamRcvQueue
 TCP send queue that stores actual bytes. More...
 
class  TCPByteStreamSendQueue
 Send queue that manages messages. More...
 
class  TCPConnection
 Manages a TCP connection. More...
 
struct  tcpip_msg
 
class  TcpLwipByteStreamReceiveQueue
 Receive queue that manages "data stream", that is, actual bytes. More...
 
class  TcpLwipByteStreamSendQueue
 Send queue that manages "data stream", that is, actual bytes. More...
 
class  TcpLwipConnection
 
class  TcpLwipMsgBasedReceiveQueue
 Receive queue that manages "objects". More...
 
class  TcpLwipMsgBasedSendQueue
 Send queue that manages "objects". More...
 
class  TcpLwipReceiveQueue
 
class  TcpLwipSendQueue
 Abstract base class for TCP_LWIP send queues. More...
 
class  TcpLwipVirtualDataReceiveQueue
 Receive queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TcpLwipVirtualDataSendQueue
 Send queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TCPMsgBasedRcvQueue
 
class  TCPMsgBasedSendQueue
 Send queue that manages messages. More...
 
class  TCPNewReno
 Implements TCP NewReno. More...
 
class  TCPNoCongestionControl
 TCP with no congestion control (i.e. More...
 
class  TCPOption
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:129 by nedtool. More...
 
class  TCPOptionEnd
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:135 by nedtool. More...
 
class  TCPOptionMaxSegmentSize
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:147 by nedtool. More...
 
class  TCPOptionNop
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:141 by nedtool. More...
 
class  TCPOptionSack
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:167 by nedtool. More...
 
class  TCPOptionSackPermitted
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:161 by nedtool. More...
 
class  TCPOptionTimestamp
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:174 by nedtool. More...
 
class  TCPOptionUnknown
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:182 by nedtool. More...
 
class  TCPOptionWindowScale
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:154 by nedtool. More...
 
struct  TCPPayloadMessage
 Struct generated from inet/transportlayer/tcp_common/TCPSegment.msg:63 by nedtool. More...
 
class  TCPReceiveQueue
 Abstract base class for TCP receive queues. More...
 
class  TCPReno
 Implements TCP Reno. More...
 
class  TCPSACKRexmitQueue
 Retransmission data for SACK. More...
 
class  TCPSegment
 Represents a TCP segment. More...
 
class  TCPSegment_Base
 Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:202 by nedtool. More...
 
class  TCPSegmentTransmitInfoList
 
class  TCPSendQueue
 Abstract base class for TCP send queues. More...
 
class  TCPSpoof
 Sends fabricated TCP packets. More...
 
class  TCPStateVariables
 Contains state variables ("TCB") for TCP. More...
 
class  TCPTahoe
 Implements Tahoe. More...
 
class  TCPTahoeRenoFamily
 Provides utility functions to implement TCPTahoe, TCPReno and TCPNewReno. More...
 
class  TCPTahoeRenoFamilyStateVariables
 State variables for TCPTahoeRenoFamily. More...
 
class  TCPVegas
 
class  TCPVegasStateVariables
 State variables for TCPVegas. More...
 
class  TCPVirtualDataRcvQueue
 Receive queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TCPVirtualDataSendQueue
 Send queue that manages "virtual bytes", that is, byte counts only. More...
 
class  TCPWestwood
 
class  TCPWestwoodStateVariables
 State variables for TCPWestwood. More...
 

Typedefs

typedef TCPTahoeRenoFamilyStateVariables TCPNewRenoStateVariables
 State variables for TCPNewReno. More...
 
typedef TCPBaseAlgStateVariables TCPNoCongestionControlStateVariables
 State variables for TCPNoCongestionControl. More...
 
typedef TCPTahoeRenoFamilyStateVariables TCPRenoStateVariables
 State variables for TCPReno. More...
 
typedef TCPTahoeRenoFamilyStateVariables TCPTahoeStateVariables
 State variables for TCPTahoe. More...
 
typedef std::list< SackSackList
 
typedef TCPOptionTCPOptionPtr
 
typedef cPacket * cPacketPtr
 
typedef intptr_t mem_ptr_t
 
typedef uint8_t u8_t
 
typedef uint16_t u16_t
 
typedef uint32_t u32_t
 
typedef int8_t s8_t
 
typedef int16_t s16_t
 
typedef int32_t s32_t
 
typedef void * sys_sem_t
 
typedef void * sys_mbox_t
 
typedef void * sys_thread_t
 
typedef s8_t err_t
 Define LWIP_ERR_T in cc.h if you want to use a different type for your platform (must be signed). More...
 
typedef void(* sys_timeout_handler) (void *arg)
 

Enumerations

enum  TcpState {
  TCP_S_INIT = 0, TCP_S_CLOSED = FSM_Steady(1), TCP_S_LISTEN = FSM_Steady(2), TCP_S_SYN_SENT = FSM_Steady(3),
  TCP_S_SYN_RCVD = FSM_Steady(4), TCP_S_ESTABLISHED = FSM_Steady(5), TCP_S_CLOSE_WAIT = FSM_Steady(6), TCP_S_LAST_ACK = FSM_Steady(7),
  TCP_S_FIN_WAIT_1 = FSM_Steady(8), TCP_S_FIN_WAIT_2 = FSM_Steady(9), TCP_S_CLOSING = FSM_Steady(10), TCP_S_TIME_WAIT = FSM_Steady(11)
}
 
enum  TCPEventCode {
  TCP_E_IGNORE, TCP_E_OPEN_ACTIVE, TCP_E_OPEN_PASSIVE, TCP_E_SEND,
  TCP_E_CLOSE, TCP_E_ABORT, TCP_E_STATUS, TCP_E_QUEUE_BYTES_LIMIT,
  TCP_E_READ, TCP_E_RCV_DATA, TCP_E_RCV_ACK, TCP_E_RCV_SYN,
  TCP_E_RCV_SYN_ACK, TCP_E_RCV_FIN, TCP_E_RCV_FIN_ACK, TCP_E_RCV_RST,
  TCP_E_RCV_UNEXP_SYN, TCP_E_TIMEOUT_2MSL, TCP_E_TIMEOUT_CONN_ESTAB, TCP_E_TIMEOUT_FIN_WAIT_2
}
 
enum  TCPOptionNumbers {
  TCPOPTION_END_OF_OPTION_LIST = 0, TCPOPTION_NO_OPERATION = 1, TCPOPTION_MAXIMUM_SEGMENT_SIZE = 2, TCPOPTION_WINDOW_SCALE = 3,
  TCPOPTION_SACK_PERMITTED = 4, TCPOPTION_SACK = 5, TCPOPTION_TIMESTAMP = 8
}
 Enum generated from inet/transportlayer/tcp_common/TCPSegment.msg:76 by nedtool. More...
 
enum  icmp_dur_type {
  ICMP_DUR_NET = 0, ICMP_DUR_HOST = 1, ICMP_DUR_PROTO = 2, ICMP_DUR_PORT = 3,
  ICMP_DUR_FRAG = 4, ICMP_DUR_SR = 5
}
 
enum  icmp_te_type { ICMP_TE_TTL = 0, ICMP_TE_FRAG = 1 }
 
enum  memp_t { MEMP_MAX }
 
enum  pbuf_layer { PBUF_TRANSPORT, PBUF_IP, PBUF_LINK, PBUF_RAW }
 
enum  pbuf_type { PBUF_RAM, PBUF_ROM, PBUF_REF, PBUF_POOL }
 
enum  snmp_ifType {
  snmp_ifType_other =1, snmp_ifType_regular1822, snmp_ifType_hdh1822, snmp_ifType_ddn_x25,
  snmp_ifType_rfc877_x25, snmp_ifType_ethernet_csmacd, snmp_ifType_iso88023_csmacd, snmp_ifType_iso88024_tokenBus,
  snmp_ifType_iso88025_tokenRing, snmp_ifType_iso88026_man, snmp_ifType_starLan, snmp_ifType_proteon_10Mbit,
  snmp_ifType_proteon_80Mbit, snmp_ifType_hyperchannel, snmp_ifType_fddi, snmp_ifType_lapb,
  snmp_ifType_sdlc, snmp_ifType_ds1, snmp_ifType_e1, snmp_ifType_basicISDN,
  snmp_ifType_primaryISDN, snmp_ifType_propPointToPointSerial, snmp_ifType_ppp, snmp_ifType_softwareLoopback,
  snmp_ifType_eon, snmp_ifType_ethernet_3Mbit, snmp_ifType_nsip, snmp_ifType_slip,
  snmp_ifType_ultra, snmp_ifType_ds3, snmp_ifType_sip, snmp_ifType_frame_relay
}
 
enum  tcpip_msg_type { TCPIP_MSG_INPKT, TCPIP_MSG_CALLBACK, TCPIP_MSG_TIMEOUT, TCPIP_MSG_UNTIMEOUT }
 

Functions

 Register_Class (DumbTCP)
 
 Register_Class (TCPNewReno)
 
 Register_Class (TCPNoCongestionControl)
 
 Register_Class (TCPReno)
 
 Register_Class (TCPTahoe)
 
 Register_Class (TCPVegas)
 
 Register_Class (TCPWestwood)
 
 Register_Class (TCPByteStreamRcvQueue)
 
 Register_Class (TCPByteStreamSendQueue)
 
 Register_Class (TCPMsgBasedRcvQueue)
 
 Register_Class (TCPMsgBasedSendQueue)
 
 Register_Class (TCPVirtualDataRcvQueue)
 
 Register_Class (TCPVirtualDataSendQueue)
 
 Define_Module (TCP)
 
 Register_Class (Sack)
 
 Register_Class (TCPSegment)
 
std::ostream & operator<< (std::ostream &os, cPacketPtr msg)
 
void doPacking (cCommBuffer *b, cPacketPtr &msg)
 
void doUnpacking (cCommBuffer *b, cPacketPtr &msg)
 
void INET_API __doPacking (omnetpp::cCommBuffer *b, const TCPPayloadMessage &a)
 
void INET_API __doUnpacking (omnetpp::cCommBuffer *b, TCPPayloadMessage &a)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPPayloadMessage &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPPayloadMessage &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const SackItem &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, SackItem &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOption &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOption &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionEnd &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionEnd &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionNop &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionNop &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionMaxSegmentSize &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionMaxSegmentSize &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionWindowScale &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionWindowScale &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionSackPermitted &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionSackPermitted &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionSack &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionSack &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionTimestamp &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionTimestamp &obj)
 
void doParsimPacking (omnetpp::cCommBuffer *b, const TCPOptionUnknown &obj)
 
void doParsimUnpacking (omnetpp::cCommBuffer *b, TCPOptionUnknown &obj)
 
 Define_Module (TCPSpoof)
 
void memp_init (void)
 Initialize this module. More...
 
void * memp_malloc (memp_t type)
 Get an element from a specific pool. More...
 
void memp_free (memp_t type, void *mem)
 Put an element back into its pool. More...
 
struct pbufpbuf_alloc (pbuf_layer layer, u16_t length, pbuf_type type)
 Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type). More...
 
void pbuf_realloc (struct pbuf *p, u16_t new_len)
 Shrink a pbuf chain to a desired length. More...
 
u8_t pbuf_header (struct pbuf *p, s16_t header_size_increment)
 Adjusts the payload pointer to hide or reveal headers in the payload. More...
 
u8_t pbuf_free (struct pbuf *p)
 Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain or queue. More...
 
u8_t pbuf_clen (struct pbuf *p)
 Count number of pbufs in a chain. More...
 
void pbuf_ref (struct pbuf *p)
 Increment the reference count of the pbuf. More...
 
void pbuf_cat (struct pbuf *h, struct pbuf *t)
 Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. More...
 
void pbuf_chain (struct pbuf *h, struct pbuf *t)
 Chain two pbufs (or pbuf chains) together. More...
 
struct pbufpbuf_dechain (struct pbuf *p)
 Dechains the first pbuf from its succeeding pbufs in the chain. More...
 
err_t pbuf_copy (struct pbuf *p_to, struct pbuf *p_from)
 Create PBUF_RAM copies of pbufs. More...
 
u16_t pbuf_copy_partial (struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
 Copy (part of) the contents of a packet buffer to an application supplied buffer. More...
 
err_t pbuf_take (struct pbuf *buf, const void *dataptr, u16_t len)
 Copy application supplied data into a pbuf. More...
 
struct pbufpbuf_coalesce (struct pbuf *p, pbuf_layer layer)
 Creates a single pbuf out of a queue of pbufs. More...
 
u32_t inet_addr (const char *cp)
 
int inet_aton (const char *cp, struct in_addr *addr)
 
char * inet_ntoa (struct in_addr addr)
 
u16_t inet_chksum (void *dataptr, u16_t len)
 
u16_t inet_chksum_pbuf (struct pbuf *p)
 
u16_t inet_chksum_pseudo (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t proto, u16_t proto_len)
 
u8_t ip_addr_isbroadcast (struct ip_addr *, struct netif *)
 
struct netifip_route (struct ip_addr *dest)
 
err_t ip_input (struct pbuf *p, struct netif *inp)
 
err_t ip_output (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto)
 
err_t ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif)
 
struct netbufnetbuf_new (void)
 
void netbuf_delete (struct netbuf *buf)
 
void * netbuf_alloc (struct netbuf *buf, u16_t size)
 
void netbuf_free (struct netbuf *buf)
 
err_t netbuf_ref (struct netbuf *buf, const void *dataptr, u16_t size)
 
void netbuf_chain (struct netbuf *head, struct netbuf *tail)
 
u16_t netbuf_len (struct netbuf *buf)
 
err_t netbuf_data (struct netbuf *buf, void **dataptr, u16_t *len)
 
s8_t netbuf_next (struct netbuf *buf)
 
void netbuf_first (struct netbuf *buf)
 
struct netifnetif_add (struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw, void *state, err_t(*init)(struct netif *netif), err_t(*input)(struct pbuf *p, struct netif *netif))
 
void netif_set_addr (struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw)
 
void netif_remove (struct netif *netif)
 
struct netifnetif_find (char *name)
 
void netif_set_default (struct netif *netif)
 
void netif_set_ipaddr (struct netif *netif, struct ip_addr *ipaddr)
 
void netif_set_netmask (struct netif *netif, struct ip_addr *netmask)
 
void netif_set_gw (struct netif *netif, struct ip_addr *gw)
 
void netif_set_up (struct netif *netif)
 
void netif_set_down (struct netif *netif)
 
u8_t netif_is_up (struct netif *netif)
 
void pbuf_ref_chain (struct pbuf *p)
 
void sys_init (void)
 
void sys_timeout (u32_t msecs, sys_timeout_handler h, void *arg)
 
void sys_untimeout (sys_timeout_handler h, void *arg)
 
struct sys_timeoutssys_arch_timeouts (void)
 
sys_sem_t sys_sem_new (u8_t count)
 
void sys_sem_signal (sys_sem_t sem)
 
u32_t sys_arch_sem_wait (sys_sem_t sem, u32_t timeout)
 
void sys_sem_free (sys_sem_t sem)
 
void sys_sem_wait (sys_sem_t sem)
 
int sys_sem_wait_timeout (sys_sem_t sem, u32_t timeout)
 
void sys_msleep (u32_t ms)
 
u32_t sys_jiffies (void)
 
sys_mbox_t sys_mbox_new (int size)
 
void sys_mbox_post (sys_mbox_t mbox, void *msg)
 
err_t sys_mbox_trypost (sys_mbox_t mbox, void *msg)
 
u32_t sys_arch_mbox_fetch (sys_mbox_t mbox, void **msg, u32_t timeout)
 
u32_t sys_arch_mbox_tryfetch (sys_mbox_t mbox, void **msg)
 
void sys_mbox_free (sys_mbox_t mbox)
 
void sys_mbox_fetch (sys_mbox_t mbox, void **msg)
 
sys_thread_t sys_thread_new (char *name, void(*thread)(void *arg), void *arg, int stacksize, int prio)
 
u32_t sys_now (void)
 Returns the current time in milliseconds. More...
 
void tcpip_init (void(*tcpip_init_done)(void *), void *arg)
 
err_t tcpip_input (struct pbuf *p, struct netif *inp)
 
err_t tcpip_callback_with_block (void(*f)(void *ctx), void *ctx, u8_t block)
 
err_t pbuf_free_callback (struct pbuf *p)
 
err_t mem_free_callback (void *m)
 
err_t tcpip_timeout (u32_t msecs, sys_timeout_handler h, void *arg)
 
err_t tcpip_untimeout (sys_timeout_handler h, void *arg)
 
err_t loopif_init (struct netif *netif)
 
err_t slipif_init (struct netif *netif)
 
void slipif_poll (struct netif *netif)
 
 Register_Class (TcpLwipByteStreamSendQueue)
 
 Register_Class (TcpLwipByteStreamReceiveQueue)
 
 Register_Class (TcpLwipMsgBasedSendQueue)
 
 Register_Class (TcpLwipMsgBasedReceiveQueue)
 
 Register_Class (TcpLwipVirtualDataSendQueue)
 
 Register_Class (TcpLwipVirtualDataReceiveQueue)
 
 Define_Module (TCP_lwIP)
 
simtime_t roundTime (const simtime_t &timeP, int secSlicesP)
 
 Register_Class (TCP_NSC_ByteStreamSendQueue)
 
 Register_Class (TCP_NSC_ByteStreamReceiveQueue)
 
 Register_Class (TCP_NSC_VirtualDataSendQueue)
 
 Register_Class (TCP_NSC_VirtualDataReceiveQueue)
 
 Define_Module (TCP_NSC)
 
struct inet::tcp::nsc_iphdr __attribute__ ((packed))
 
Comparing sequence numbers
bool seqLess (uint32 a, uint32 b)
 
bool seqLE (uint32 a, uint32 b)
 
bool seqGreater (uint32 a, uint32 b)
 
bool seqGE (uint32 a, uint32 b)
 
uint32 seqMin (uint32 a, uint32 b)
 
uint32 seqMax (uint32 a, uint32 b)
 

Variables

const unsigned int TCP_MAX_HEADER_OCTETS = 60
 
const unsigned int MAX_SACK_ENTRIES = 4
 
PACK_STRUCT_BEGIN struct inet::tcp::ip_addr PACK_STRUCT_STRUCT
 
const struct ip_addr ip_addr_any
 
const struct ip_addr ip_addr_broadcast
 
struct netifcurrent_netif
 The interface that provided the packet for the current callback invocation. More...
 
const struct ip_hdrcurrent_header
 Header of the input packet currently being processed. More...
 
struct netifnetif_list
 The list of network interfaces. More...
 
struct netifnetif_default
 The default network interface. More...
 
inet::tcp::TCP_NSC __attribute__
 

Typedef Documentation

typedef cPacket* inet::tcp::cPacketPtr

Define LWIP_ERR_T in cc.h if you want to use a different type for your platform (must be signed).

typedef intptr_t inet::tcp::mem_ptr_t
typedef int16_t inet::tcp::s16_t
typedef int32_t inet::tcp::s32_t
typedef int8_t inet::tcp::s8_t
typedef std::list<Sack> inet::tcp::SackList
typedef void* inet::tcp::sys_mbox_t
typedef void* inet::tcp::sys_sem_t
typedef void* inet::tcp::sys_thread_t
typedef void(* inet::tcp::sys_timeout_handler) (void *arg)
typedef uint16_t inet::tcp::u16_t
typedef uint32_t inet::tcp::u32_t
typedef uint8_t inet::tcp::u8_t

Enumeration Type Documentation

Enumerator
ICMP_DUR_NET 
ICMP_DUR_HOST 
ICMP_DUR_PROTO 
ICMP_DUR_PORT 
ICMP_DUR_FRAG 
ICMP_DUR_SR 
60  {
61  ICMP_DUR_NET = 0, /* net unreachable */
62  ICMP_DUR_HOST = 1, /* host unreachable */
63  ICMP_DUR_PROTO = 2, /* protocol unreachable */
64  ICMP_DUR_PORT = 3, /* port unreachable */
65  ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
66  ICMP_DUR_SR = 5 /* source route failed */
67 };
Definition: lwip_icmp.h:65
Definition: lwip_icmp.h:66
Definition: lwip_icmp.h:62
Definition: lwip_icmp.h:61
Definition: lwip_icmp.h:64
Definition: lwip_icmp.h:63
Enumerator
ICMP_TE_TTL 
ICMP_TE_FRAG 
69  {
70  ICMP_TE_TTL = 0, /* time to live exceeded in transit */
71  ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
72 };
Definition: lwip_icmp.h:70
Definition: lwip_icmp.h:71
Enumerator
MEMP_MAX 
56  {
57 #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
58 #include "lwip/memp_std.h"
59  MEMP_MAX
60 } memp_t;
Definition: memp.h:59
memp_t
Definition: memp.h:56
Enumerator
PBUF_TRANSPORT 
PBUF_IP 
PBUF_LINK 
PBUF_RAW 
50  {
52  PBUF_IP,
53  PBUF_LINK,
54  PBUF_RAW
55 } pbuf_layer;
pbuf_layer
Definition: pbuf.h:50
Definition: pbuf.h:53
Definition: pbuf.h:51
Definition: pbuf.h:52
Definition: pbuf.h:54
Enumerator
PBUF_RAM 
PBUF_ROM 
PBUF_REF 
PBUF_POOL 
57  {
58  PBUF_RAM, /* pbuf data is stored in RAM */
59  PBUF_ROM, /* pbuf data is stored in ROM */
60  PBUF_REF, /* pbuf comes from the pbuf pool */
61  PBUF_POOL /* pbuf payload refers to RAM */
62 } pbuf_type;
pbuf_type
Definition: pbuf.h:57
Definition: pbuf.h:59
Definition: pbuf.h:61
Definition: pbuf.h:60
Definition: pbuf.h:58
See also
RFC1213, "MIB-II, 6. Definitions"
Enumerator
snmp_ifType_other 
snmp_ifType_regular1822 
snmp_ifType_hdh1822 
snmp_ifType_ddn_x25 
snmp_ifType_rfc877_x25 
snmp_ifType_ethernet_csmacd 
snmp_ifType_iso88023_csmacd 
snmp_ifType_iso88024_tokenBus 
snmp_ifType_iso88025_tokenRing 
snmp_ifType_iso88026_man 
snmp_ifType_starLan 
snmp_ifType_proteon_10Mbit 
snmp_ifType_proteon_80Mbit 
snmp_ifType_hyperchannel 
snmp_ifType_fddi 
snmp_ifType_lapb 
snmp_ifType_sdlc 
snmp_ifType_ds1 
snmp_ifType_e1 
snmp_ifType_basicISDN 
snmp_ifType_primaryISDN 
snmp_ifType_propPointToPointSerial 
snmp_ifType_ppp 
snmp_ifType_softwareLoopback 
snmp_ifType_eon 
snmp_ifType_ethernet_3Mbit 
snmp_ifType_nsip 
snmp_ifType_slip 
snmp_ifType_ultra 
snmp_ifType_ds3 
snmp_ifType_sip 
snmp_ifType_frame_relay 
51  {
52  snmp_ifType_other=1, /* none of the following */
69  snmp_ifType_ds1, /* T-1 */
70  snmp_ifType_e1, /* european equiv. of T-1 */
72  snmp_ifType_primaryISDN, /* proprietary serial */
76  snmp_ifType_eon, /* CLNP over IP [11] */
78  snmp_ifType_nsip, /* XNS over IP */
79  snmp_ifType_slip, /* generic SLIP */
80  snmp_ifType_ultra, /* ULTRA technologies */
81  snmp_ifType_ds3, /* T-3 */
82  snmp_ifType_sip, /* SMDS */
84 };
Definition: snmp.h:82
Definition: snmp.h:81
Definition: snmp.h:80
Definition: snmp.h:78
Definition: snmp.h:67
Definition: snmp.h:62
Definition: snmp.h:76
Definition: snmp.h:54
Definition: snmp.h:68
Definition: snmp.h:69
Definition: snmp.h:66
Definition: snmp.h:74
Definition: snmp.h:79
Definition: snmp.h:70
Definition: snmp.h:55
Definition: snmp.h:52
Enumerator
TCP_E_IGNORE 
TCP_E_OPEN_ACTIVE 
TCP_E_OPEN_PASSIVE 
TCP_E_SEND 
TCP_E_CLOSE 
TCP_E_ABORT 
TCP_E_STATUS 
TCP_E_QUEUE_BYTES_LIMIT 
TCP_E_READ 
TCP_E_RCV_DATA 
TCP_E_RCV_ACK 
TCP_E_RCV_SYN 
TCP_E_RCV_SYN_ACK 
TCP_E_RCV_FIN 
TCP_E_RCV_FIN_ACK 
TCP_E_RCV_RST 
TCP_E_RCV_UNEXP_SYN 
TCP_E_TIMEOUT_2MSL 
TCP_E_TIMEOUT_CONN_ESTAB 
TCP_E_TIMEOUT_FIN_WAIT_2 
81  {
83 
84  // app commands
85  // (Note: no RECEIVE command, data are automatically passed up)
88  TCP_E_SEND,
93  TCP_E_READ,
94 
95  // TPDU types
102  TCP_E_RCV_RST, // covers RST+ACK too
103 
104  TCP_E_RCV_UNEXP_SYN, // unexpected SYN
105 
106  // timers
107  TCP_E_TIMEOUT_2MSL, // RFC 793, a.k.a. TIME-WAIT timer
110 
111  // All other timers (REXMT, PERSIST, DELAYED-ACK, KEEP-ALIVE, etc.),
112  // are handled in TCPAlgorithm.
113 };
Definition: TCPConnection.h:96
Definition: TCPConnection.h:99
Definition: TCPConnection.h:88
Definition: TCPConnection.h:107
Definition: TCPConnection.h:90
Definition: TCPConnection.h:86
Definition: TCPConnection.h:97
Definition: TCPConnection.h:87
Definition: TCPConnection.h:100
Definition: TCPConnection.h:102
Definition: TCPConnection.h:109
Definition: TCPConnection.h:89
Definition: TCPConnection.h:91
Definition: TCPConnection.h:104
Definition: TCPConnection.h:93
Definition: TCPConnection.h:101
Definition: TCPConnection.h:108
Definition: TCPConnection.h:92
Definition: TCPConnection.h:98
Definition: TCPConnection.h:82
Enumerator
TCPIP_MSG_INPKT 
TCPIP_MSG_CALLBACK 
TCPIP_MSG_TIMEOUT 
TCPIP_MSG_UNTIMEOUT 
100  {
101 #if LWIP_NETCONN
102  TCPIP_MSG_API,
103 #endif /* LWIP_NETCONN */
105 #if LWIP_NETIF_API
106  TCPIP_MSG_NETIFAPI,
107 #endif /* LWIP_NETIF_API */
111 };
Definition: tcpip.h:110
Definition: tcpip.h:104
Definition: tcpip.h:109
Definition: tcpip.h:108

Enum generated from inet/transportlayer/tcp_common/TCPSegment.msg:76 by nedtool.

//
// TCP Option Numbers
// Reference: http://www.iana.org/assignments/tcp-parameters/
// Date: 2011-07-02
//
// Note: Options not yet implemented should stay commented out
//
enum TCPOptionNumbers
{
TCPOPTION_END_OF_OPTION_LIST = 0;                   // RFC 793, LENGTH: 1 Byte
TCPOPTION_NO_OPERATION = 1;                         // RFC 793, LENGTH: 1 Byte
TCPOPTION_MAXIMUM_SEGMENT_SIZE = 2;                 // RFC 793, LENGTH: 4 Bytes
TCPOPTION_WINDOW_SCALE = 3;                         // RFC 1323, LENGTH: 3 Bytes
TCPOPTION_SACK_PERMITTED = 4;                       // RFC 2018, LENGTH: 2 Bytes
TCPOPTION_SACK = 5;                                 // RFC 2018, LENGTH: N (max. N = 4) 8 * n + 2 Bytes  => 32 + 2 + 2 * NOP = 36 Bytes; If TIMESTAMP option is used with SACK: max. n = 3 => 12 Bytes (for Timestamp) + 28 Bytes (for SACK) = 40 Bytes
//    TCPOPTION_ECHO = 6;                               // (obsoleted by option 8) RFC 1072 & RFC 6247, LENGTH: 6 Bytes
//    TCPOPTION_ECHO_REPLY = 7;                         // (obsoleted by option 8) RFC 1072 & RFC 6247, LENGTH: 6 Bytes
TCPOPTION_TIMESTAMP = 8;                            // RFC 1323, LENGTH: 10 Bytes
}
Enumerator
TCPOPTION_END_OF_OPTION_LIST 
TCPOPTION_NO_OPERATION 
TCPOPTION_MAXIMUM_SEGMENT_SIZE 
TCPOPTION_WINDOW_SCALE 
TCPOPTION_SACK_PERMITTED 
TCPOPTION_SACK 
TCPOPTION_TIMESTAMP 
111  {
117  TCPOPTION_SACK = 5,
119 };
Definition: TCPSegment_m.h:114
Definition: TCPSegment_m.h:112
Definition: TCPSegment_m.h:117
Definition: TCPSegment_m.h:118
Definition: TCPSegment_m.h:113
Definition: TCPSegment_m.h:116
Definition: TCPSegment_m.h:115
Enumerator
TCP_S_INIT 
TCP_S_CLOSED 
TCP_S_LISTEN 
TCP_S_SYN_SENT 
TCP_S_SYN_RCVD 
TCP_S_ESTABLISHED 
TCP_S_CLOSE_WAIT 
TCP_S_LAST_ACK 
TCP_S_FIN_WAIT_1 
TCP_S_FIN_WAIT_2 
TCP_S_CLOSING 
TCP_S_TIME_WAIT 
62  {
63  TCP_S_INIT = 0,
64  TCP_S_CLOSED = FSM_Steady(1),
65  TCP_S_LISTEN = FSM_Steady(2),
66  TCP_S_SYN_SENT = FSM_Steady(3),
67  TCP_S_SYN_RCVD = FSM_Steady(4),
68  TCP_S_ESTABLISHED = FSM_Steady(5),
69  TCP_S_CLOSE_WAIT = FSM_Steady(6),
70  TCP_S_LAST_ACK = FSM_Steady(7),
71  TCP_S_FIN_WAIT_1 = FSM_Steady(8),
72  TCP_S_FIN_WAIT_2 = FSM_Steady(9),
73  TCP_S_CLOSING = FSM_Steady(10),
74  TCP_S_TIME_WAIT = FSM_Steady(11)
75 };
Definition: TCPConnection.h:68
Definition: TCPConnection.h:69
Definition: TCPConnection.h:70
Definition: TCPConnection.h:74
Definition: TCPConnection.h:66
Definition: TCPConnection.h:72
Definition: TCPConnection.h:63
Definition: TCPConnection.h:71
Definition: TCPConnection.h:65
Definition: TCPConnection.h:67
Definition: TCPConnection.h:64
Definition: TCPConnection.h:73

Function Documentation

struct inet::tcp::nsc_iphdr inet::tcp::__attribute__ ( (packed)  )
void INET_API inet::tcp::__doPacking ( omnetpp::cCommBuffer *  b,
const TCPPayloadMessage a 
)

Referenced by doParsimPacking().

void INET_API inet::tcp::__doUnpacking ( omnetpp::cCommBuffer *  b,
TCPPayloadMessage a 
)

Referenced by doParsimUnpacking().

inet::tcp::Define_Module ( TCPSpoof  )
inet::tcp::Define_Module ( TCP  )
inet::tcp::Define_Module ( TCP_lwIP  )
inet::tcp::Define_Module ( TCP_NSC  )
void inet::tcp::doPacking ( cCommBuffer *  b,
cPacketPtr msg 
)
inline
65 {msg->parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPPayloadMessage obj 
)
inline
83 { __doPacking(b, obj); }
void INET_API __doPacking(omnetpp::cCommBuffer *b, const TCPPayloadMessage &a)
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const SackItem obj 
)
inline
163 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOption obj 
)
inline
263 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionEnd obj 
)
inline
299 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionNop obj 
)
inline
335 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionMaxSegmentSize obj 
)
inline
375 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionWindowScale obj 
)
inline
415 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionSackPermitted obj 
)
inline
451 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionSack obj 
)
inline
495 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionTimestamp obj 
)
inline
539 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimPacking ( omnetpp::cCommBuffer *  b,
const TCPOptionUnknown obj 
)
inline
581 {obj.parsimPack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPPayloadMessage obj 
)
inline
84 { __doUnpacking(b, obj); }
value< double, units::m > b
Definition: Units.h:1054
void INET_API __doUnpacking(omnetpp::cCommBuffer *b, TCPPayloadMessage &a)
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
SackItem obj 
)
inline
164 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOption obj 
)
inline
264 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionEnd obj 
)
inline
300 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionNop obj 
)
inline
336 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionMaxSegmentSize obj 
)
inline
376 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionWindowScale obj 
)
inline
416 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionSackPermitted obj 
)
inline
452 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionSack obj 
)
inline
496 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionTimestamp obj 
)
inline
540 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doParsimUnpacking ( omnetpp::cCommBuffer *  b,
TCPOptionUnknown obj 
)
inline
582 {obj.parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
void inet::tcp::doUnpacking ( cCommBuffer *  b,
cPacketPtr msg 
)
inline
66 {msg->parsimUnpack(b);}
value< double, units::m > b
Definition: Units.h:1054
u32_t inet::tcp::inet_addr ( const char *  cp)
int inet::tcp::inet_aton ( const char *  cp,
struct in_addr addr 
)
u16_t inet::tcp::inet_chksum ( void *  dataptr,
u16_t  len 
)
u16_t inet::tcp::inet_chksum_pbuf ( struct pbuf p)
u16_t inet::tcp::inet_chksum_pseudo ( struct pbuf p,
struct ip_addr src,
struct ip_addr dest,
u8_t  proto,
u16_t  proto_len 
)
char* inet::tcp::inet_ntoa ( struct in_addr  addr)
u8_t inet::tcp::LwipTcpLayer::ip_addr_isbroadcast ( struct ip_addr addr,
struct netif interf 
)
104 {
105  // TODO implementing this if need
106  return 0;
107 }
err_t inet::tcp::ip_input ( struct pbuf p,
struct netif inp 
)
err_t inet::tcp::ip_output ( struct pbuf p,
struct ip_addr src,
struct ip_addr dest,
u8_t  ttl,
u8_t  tos,
u8_t  proto 
)
err_t inet::tcp::ip_output_if ( struct pbuf p,
struct ip_addr src,
struct ip_addr dest,
u8_t  ttl,
u8_t  tos,
u8_t  proto,
struct netif netif 
)
struct netif* inet::tcp::ip_route ( struct ip_addr dest)
err_t inet::tcp::loopif_init ( struct netif netif)
err_t inet::tcp::mem_free_callback ( void *  m)
void inet::tcp::LwipTcpLayer::memp_free ( memp_t  type,
void *  mem 
)

Put an element back into its pool.

Parameters
typethe pool where to put mem
memthe memp element to free

Referenced by ip_addr_isbroadcast(), and pbuf_free().

357 {
358  struct memp *memp;
359  SYS_ARCH_DECL_PROTECT(old_level);
360 
361  if (mem == nullptr) {
362  return;
363  }
364  LWIP_ASSERT("memp_free: mem properly aligned",
365  ((mem_ptr_t)mem % MEM_ALIGNMENT) == 0);
366 
367  memp = (struct memp *)((u8_t*)mem - MEMP_SIZE);
368 
369  SYS_ARCH_PROTECT(old_level);
370 #if MEMP_OVERFLOW_CHECK
371 #if MEMP_OVERFLOW_CHECK >= 2
372  memp_overflow_check_all();
373 #else
374  memp_overflow_check_element(memp, memp_sizes[type]);
375 #endif /* MEMP_OVERFLOW_CHECK >= 2 */
376 #endif /* MEMP_OVERFLOW_CHECK */
377 
378  MEMP_STATS_DEC(used, type);
379 
380  memp->next = memp_tab[type];
381  memp_tab[type] = memp;
382 
383 #if MEMP_SANITY_CHECK
384  LWIP_ASSERT("memp sanity", memp_sanity());
385 #endif /* MEMP_SANITY_CHECK */
386 
387  SYS_ARCH_UNPROTECT(old_level);
388 }
uint8_t u8_t
Definition: cc.h:31
#define MEMP_SIZE
Definition: memp.cc:109
#define MEM_ALIGNMENT
MEM_ALIGNMENT: should be set to the alignment of the CPU 4 byte alignment -> #define MEM_ALIGNMENT 4 ...
Definition: opt.h:120
#define SYS_ARCH_DECL_PROTECT(lev)
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for ...
Definition: sys.h:210
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
intptr_t mem_ptr_t
Definition: cc.h:28
#define SYS_ARCH_PROTECT(lev)
Definition: sys.h:211
#define SYS_ARCH_UNPROTECT(lev)
Definition: sys.h:212
#define MEMP_STATS_DEC(x, i)
Definition: stats.h:251
void inet::tcp::memp_init ( void  )

Initialize this module.

Carves out memp_memory into linked lists for each pool-type.

265 {
266  struct memp *memp;
267  u16_t i, j;
268 
269  for (i = 0; i < MEMP_MAX; ++i) {
270  MEMP_STATS_AVAIL(used, i, 0);
271  MEMP_STATS_AVAIL(max, i, 0);
272  MEMP_STATS_AVAIL(err, i, 0);
273  MEMP_STATS_AVAIL(avail, i, memp_num[i]);
274  }
275 
276  memp = LWIP_MEM_ALIGN(memp_memory);
277  /* for every pool: */
278  for (i = 0; i < MEMP_MAX; ++i) {
279  memp_tab[i] = nullptr;
280  /* create a linked list of memp elements */
281  for (j = 0; j < memp_num[i]; ++j) {
282  memp->next = memp_tab[i];
283  memp_tab[i] = memp;
284  memp = (struct memp *)((u8_t *)memp + MEMP_SIZE + memp_sizes[i]
285 #if MEMP_OVERFLOW_CHECK
286  + MEMP_SANITY_REGION_AFTER_ALIGNED
287 #endif
288  );
289  }
290  }
291 #if MEMP_OVERFLOW_CHECK
292  memp_overflow_init();
293  /* check everything a first time to see if it worked */
294  memp_overflow_check_all();
295 #endif /* MEMP_OVERFLOW_CHECK */
296 }
uint8_t u8_t
Definition: cc.h:31
#define MEMP_STATS_AVAIL(x, i, y)
Definition: stats.h:249
#define MEMP_SIZE
Definition: memp.cc:109
Definition: memp.h:59
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
struct memp * next
Definition: memp.cc:66
uint16_t u16_t
Definition: cc.h:35
#define LWIP_MEM_ALIGN(addr)
Definition: mem.h:104
void * inet::tcp::memp_malloc ( memp_t  type)

Get an element from a specific pool.

Parameters
typethe pool to get an element from

the debug version has two more parameters:

Parameters
filefile name calling this function
linenumber of line where this function is called
Returns
a pointer to the allocated memory or a nullptr pointer on error

Referenced by pbuf_alloc().

315 {
316  struct memp *memp;
317  SYS_ARCH_DECL_PROTECT(old_level);
318 
319  LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type < MEMP_MAX), return nullptr;);
320 
321  SYS_ARCH_PROTECT(old_level);
322 #if MEMP_OVERFLOW_CHECK >= 2
323  memp_overflow_check_all();
324 #endif /* MEMP_OVERFLOW_CHECK >= 2 */
325 
326  memp = memp_tab[type];
327 
328  if (memp != nullptr) {
329  memp_tab[type] = memp->next;
330 #if MEMP_OVERFLOW_CHECK
331  memp->next = nullptr;
332  memp->file = file;
333  memp->line = line;
334 #endif /* MEMP_OVERFLOW_CHECK */
335  MEMP_STATS_INC_USED(used, type);
336  LWIP_ASSERT("memp_malloc: memp properly aligned",
337  ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
338  memp = (struct memp*)((u8_t*)memp + MEMP_SIZE);
339  } else {
340  LWIP_DEBUGF(MEMP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("memp_malloc: out of memory in pool %s\n", memp_desc[type]));
341  MEMP_STATS_INC(err, type);
342  }
343 
344  SYS_ARCH_UNPROTECT(old_level);
345 
346  return memp;
347 }
uint8_t u8_t
Definition: cc.h:31
#define LWIP_DBG_LEVEL_SERIOUS
Definition: debug.h:50
#define MEMP_SIZE
Definition: memp.cc:109
Definition: memp.h:59
#define MEM_ALIGNMENT
MEM_ALIGNMENT: should be set to the alignment of the CPU 4 byte alignment -> #define MEM_ALIGNMENT 4 ...
Definition: opt.h:120
#define MEMP_DEBUG
MEMP_DEBUG: Enable debugging in memp.c.
Definition: opt.h:1707
#define SYS_ARCH_DECL_PROTECT(lev)
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for ...
Definition: sys.h:210
#define MEMP_STATS_INC_USED(x, i)
Definition: stats.h:252
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
struct memp * next
Definition: memp.cc:66
intptr_t mem_ptr_t
Definition: cc.h:28
#define SYS_ARCH_PROTECT(lev)
Definition: sys.h:211
#define SYS_ARCH_UNPROTECT(lev)
Definition: sys.h:212
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
#define MEMP_STATS_INC(x, i)
Definition: stats.h:250
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
void* inet::tcp::netbuf_alloc ( struct netbuf buf,
u16_t  size 
)
void inet::tcp::netbuf_chain ( struct netbuf head,
struct netbuf tail 
)
err_t inet::tcp::netbuf_data ( struct netbuf buf,
void **  dataptr,
u16_t len 
)
void inet::tcp::netbuf_delete ( struct netbuf buf)
void inet::tcp::netbuf_first ( struct netbuf buf)
void inet::tcp::netbuf_free ( struct netbuf buf)
u16_t inet::tcp::netbuf_len ( struct netbuf buf)
struct netbuf* inet::tcp::netbuf_new ( void  )
s8_t inet::tcp::netbuf_next ( struct netbuf buf)
err_t inet::tcp::netbuf_ref ( struct netbuf buf,
const void *  dataptr,
u16_t  size 
)
struct netif* inet::tcp::netif_add ( struct netif netif,
struct ip_addr ipaddr,
struct ip_addr netmask,
struct ip_addr gw,
void *  state,
err_t(*)(struct netif *netif init,
err_t(*)(struct pbuf *p, struct netif *netif input 
)
struct netif* inet::tcp::netif_find ( char *  name)
u8_t inet::tcp::netif_is_up ( struct netif netif)
void inet::tcp::netif_remove ( struct netif netif)
void inet::tcp::netif_set_addr ( struct netif netif,
struct ip_addr ipaddr,
struct ip_addr netmask,
struct ip_addr gw 
)
void inet::tcp::netif_set_default ( struct netif netif)
void inet::tcp::netif_set_down ( struct netif netif)
void inet::tcp::netif_set_gw ( struct netif netif,
struct ip_addr gw 
)
void inet::tcp::netif_set_ipaddr ( struct netif netif,
struct ip_addr ipaddr 
)
void inet::tcp::netif_set_netmask ( struct netif netif,
struct ip_addr netmask 
)
void inet::tcp::netif_set_up ( struct netif netif)
std::ostream& inet::tcp::operator<< ( std::ostream &  os,
cPacketPtr  msg 
)
inline
61  {
62  return os << "(" << msg->getClassName() << ") " << msg->getName() << ": " << msg->str();
63  }
struct pbuf * inet::tcp::pbuf_alloc ( pbuf_layer  layer,
u16_t  length,
pbuf_type  type 
)

Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type).

The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter).

Parameters
layerflag to define header size
lengthsize of the pbuf's payload
typethis parameter decides how and where the pbuf should be allocated as follows:
  • PBUF_RAM: buffer memory for pbuf is allocated as one large chunk. This includes protocol headers as well.
  • PBUF_ROM: no buffer memory is allocated for the pbuf, even for protocol headers. Additional headers must be prepended by allocating another pbuf and chain in to the front of the ROM pbuf. It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead.
  • PBUF_REF: no buffer memory is allocated for the pbuf, even for protocol headers. It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer.
  • PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from the pbuf pool that is allocated during pbuf_init().
Returns
the allocated pbuf. If multiple pbufs where allocated, this is the first pbuf of a pbuf chain.

Referenced by pbuf_coalesce().

211 {
212  struct pbuf *p, *q, *r;
213  u16_t offset;
214  s32_t rem_len; /* remaining length */
215  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%" U16_F ")\n", length));
216 
217  /* determine header offset */
218  offset = 0;
219  switch (layer) {
220  case PBUF_TRANSPORT:
221  /* add room for transport (often TCP) layer header */
222  offset += PBUF_TRANSPORT_HLEN;
223  /* FALLTHROUGH */
224  case PBUF_IP:
225  /* add room for IP layer header */
226  offset += PBUF_IP_HLEN;
227  /* FALLTHROUGH */
228  case PBUF_LINK:
229  /* add room for link layer header */
230  offset += PBUF_LINK_HLEN;
231  break;
232  case PBUF_RAW:
233  break;
234  default:
235  LWIP_ASSERT("pbuf_alloc: bad pbuf layer", 0);
236  return nullptr;
237  }
238 
239  switch (type) {
240  case PBUF_POOL:
241  /* allocate head of pbuf chain into p */
242  p = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
243  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc: allocated pbuf %p\n", (void *)p));
244  if (p == nullptr) {
246  return nullptr;
247  }
248  p->type = type;
249  p->next = nullptr;
250 
251  /* make the payload pointer point 'offset' bytes into pbuf data memory */
252  p->payload = LWIP_MEM_ALIGN((void *)((u8_t *)p + (SIZEOF_STRUCT_PBUF + offset)));
253  LWIP_ASSERT("pbuf_alloc: pbuf p->payload properly aligned",
254  ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
255  /* the total length of the pbuf chain is the requested size */
256  p->tot_len = length;
257  /* set the length of the first pbuf in the chain */
258  p->len = LWIP_MIN(length, PBUF_POOL_BUFSIZE_ALIGNED - LWIP_MEM_ALIGN_SIZE(offset));
259  LWIP_ASSERT("check p->payload + p->len does not overflow pbuf",
260  ((u8_t*)p->payload + p->len <=
262  LWIP_ASSERT("PBUF_POOL_BUFSIZE must be bigger than MEM_ALIGNMENT",
264  /* set reference count (needed here in case we fail) */
265  p->ref = 1;
266 
267  /* now allocate the tail of the pbuf chain */
268 
269  /* remember first pbuf for linkage in next iteration */
270  r = p;
271  /* remaining length to be allocated */
272  rem_len = length - p->len;
273  /* any remaining pbufs to be allocated? */
274  while (rem_len > 0) {
275  q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
276  if (q == nullptr) {
278  /* free chain so far allocated */
279  pbuf_free(p);
280  /* bail out unsuccesfully */
281  return nullptr;
282  }
283  q->type = type;
284  q->flags = 0;
285  q->next = nullptr;
286  /* make previous pbuf point to this pbuf */
287  r->next = q;
288  /* set total length of this pbuf and next in chain */
289  LWIP_ASSERT("rem_len < max_u16_t", rem_len < 0xffff);
290  q->tot_len = (u16_t)rem_len;
291  /* this pbuf length is pool size, unless smaller sized tail */
292  q->len = LWIP_MIN((u16_t)rem_len, PBUF_POOL_BUFSIZE_ALIGNED);
293  q->payload = (void *)((u8_t *)q + SIZEOF_STRUCT_PBUF);
294  LWIP_ASSERT("pbuf_alloc: pbuf q->payload properly aligned",
295  ((mem_ptr_t)q->payload % MEM_ALIGNMENT) == 0);
296  LWIP_ASSERT("check p->payload + p->len does not overflow pbuf",
297  ((u8_t*)p->payload + p->len <=
299  q->ref = 1;
300  /* calculate remaining length to be allocated */
301  rem_len -= q->len;
302  /* remember this pbuf for linkage in next iteration */
303  r = q;
304  }
305  /* end of chain */
306  /*r->next = nullptr;*/
307 
308  break;
309  case PBUF_RAM:
310  /* If pbuf is to be allocated in RAM, allocate memory for it. */
311  p = (struct pbuf*)mem_malloc(LWIP_MEM_ALIGN_SIZE(SIZEOF_STRUCT_PBUF + offset) + LWIP_MEM_ALIGN_SIZE(length));
312  if (p == nullptr) {
313  return nullptr;
314  }
315  /* Set up internal structure of the pbuf. */
316  p->payload = LWIP_MEM_ALIGN((void *)((u8_t *)p + SIZEOF_STRUCT_PBUF + offset));
317  p->len = p->tot_len = length;
318  p->next = nullptr;
319  p->type = type;
320 
321  LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",
322  ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
323  break;
324  /* pbuf references existing (non-volatile static constant) ROM payload? */
325  case PBUF_ROM:
326  /* pbuf references existing (externally allocated) RAM payload? */
327  case PBUF_REF:
328  /* only allocate memory for the pbuf structure */
329  p = (struct pbuf *)memp_malloc(MEMP_PBUF);
330  if (p == nullptr) {
332  ("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n",
333  (type == PBUF_ROM) ? "ROM" : "REF"));
334  return nullptr;
335  }
336  /* caller must set this field properly, afterwards */
337  p->payload = nullptr;
338  p->len = p->tot_len = length;
339  p->next = nullptr;
340  p->type = type;
341  break;
342  default:
343  LWIP_ASSERT("pbuf_alloc: erroneous type", 0);
344  return nullptr;
345  }
346  /* set reference count */
347  p->ref = 1;
348  /* set flags */
349  p->flags = 0;
350  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%" U16_F ") == %p\n", length, (void *)p));
351  return p;
352 }
int32_t s32_t
Definition: cc.h:53
uint8_t u8_t
Definition: cc.h:31
u8_t pbuf_free(struct pbuf *p)
Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain o...
Definition: pbuf.cc:559
#define LWIP_DBG_LEVEL_SERIOUS
Definition: debug.h:50
#define U16_F
Definition: cc.h:56
#define SIZEOF_STRUCT_PBUF
Definition: pbuf.cc:93
#define PBUF_IP_HLEN
Definition: pbuf.h:48
#define MEM_ALIGNMENT
MEM_ALIGNMENT: should be set to the alignment of the CPU 4 byte alignment -> #define MEM_ALIGNMENT 4 ...
Definition: opt.h:120
#define PBUF_POOL_BUFSIZE_ALIGNED
Definition: pbuf.cc:96
void * memp_malloc(memp_t type)
Get an element from a specific pool.
Definition: memp.cc:311
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define LWIP_MIN(x, y)
Definition: def.h:43
Definition: pbuf.h:53
#define PBUF_TRANSPORT_HLEN
Definition: pbuf.h:47
#define PBUF_POOL_IS_EMPTY()
Definition: pbuf.cc:99
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
IP layer
Definition: lwip_tcp.txt:3
Definition: pbuf.h:59
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
Definition: pbuf.h:61
Definition: pbuf.h:51
Definition: pbuf.h:60
Definition: pbuf.h:52
void * mem_malloc(mem_size_t size)
Definition: pbuf.h:54
uint16_t u16_t
Definition: cc.h:35
Definition: pbuf.h:58
intptr_t mem_ptr_t
Definition: cc.h:28
#define LWIP_MEM_ALIGN(addr)
Definition: mem.h:104
#define LWIP_MEM_ALIGN_SIZE(size)
Definition: mem.h:100
#define PBUF_LINK_HLEN
PBUF_LINK_HLEN: the number of bytes that should be allocated for a link level header.
Definition: opt.h:897
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
void inet::tcp::pbuf_cat ( struct pbuf h,
struct pbuf t 
)

Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf.

Note
The caller MAY NOT reference the tail pbuf afterwards. Use pbuf_chain() for that purpose.
See also
pbuf_chain()

Referenced by pbuf_chain().

677 {
678  struct pbuf *p;
679 
680  LWIP_ERROR("(h != nullptr) && (t != nullptr) (programmer violates API)",
681  ((h != nullptr) && (t != nullptr)), return;);
682 
683  /* proceed to last pbuf of chain */
684  for (p = h; p->next != nullptr; p = p->next) {
685  /* add total length of second chain to all totals of first chain */
686  p->tot_len += t->tot_len;
687  }
688  /* { p is last pbuf of first h chain, p->next == nullptr } */
689  LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
690  LWIP_ASSERT("p->next == nullptr", p->next == nullptr);
691  /* add total length of second chain to last pbuf total of first chain */
692  p->tot_len += t->tot_len;
693  /* chain last pbuf of head (p) with first of tail (t) */
694  p->next = t;
695  /* p->next now references t, but the caller will drop its reference to t,
696  * so netto there is no change to the reference count of t.
697  */
698 }
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
void inet::tcp::pbuf_chain ( struct pbuf h,
struct pbuf t 
)

Chain two pbufs (or pbuf chains) together.

The caller MUST call pbuf_free(t) once it has stopped using it. Use pbuf_cat() instead if you no longer use t.

Parameters
hhead pbuf (chain)
ttail pbuf (chain)
Note
The pbufs MUST belong to the same packet.
MAY NOT be called on a packet queue.

The ->tot_len fields of all pbufs of the head chain are adjusted. The ->next field of the last pbuf of the head chain is adjusted. The ->ref field of the first pbuf of the tail chain is adjusted.

718 {
719  pbuf_cat(h, t);
720  /* t is now referenced by h */
721  pbuf_ref(t);
722  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_chain: %p references %p\n", (void *)h, (void *)t));
723 }
void pbuf_ref(struct pbuf *p)
Increment the reference count of the pbuf.
Definition: pbuf.cc:654
void pbuf_cat(struct pbuf *h, struct pbuf *t)
Concatenate two pbufs (each may be a pbuf chain) and take over the caller&#39;s reference of the tail pbu...
Definition: pbuf.cc:676
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
u8_t inet::tcp::pbuf_clen ( struct pbuf p)

Count number of pbufs in a chain.

Parameters
pfirst pbuf of chain
Returns
the number of pbufs in a chain
636 {
637  u8_t len;
638 
639  len = 0;
640  while (p != nullptr) {
641  ++len;
642  p = p->next;
643  }
644  return len;
645 }
uint8_t u8_t
Definition: cc.h:31
uint16_t len
Definition: TCP_NSC.cc:85
struct pbuf * inet::tcp::pbuf_coalesce ( struct pbuf p,
pbuf_layer  layer 
)

Creates a single pbuf out of a queue of pbufs.

Remarks
: The source pbuf 'p' is not freed by this function because that can be illegal in some places!
Parameters
pthe source pbuf
layerpbuf_layer of the new pbuf
Returns
a new, single pbuf (p->next is nullptr) or the old pbuf if allocation fails
942 {
943  struct pbuf *q;
944  err_t err;
945  if (p->next == nullptr) {
946  return p;
947  }
948  q = pbuf_alloc(layer, p->tot_len, PBUF_RAM);
949  if (q == nullptr) {
950  /* @todo: what do we do now? */
951  return p;
952  }
953  err = pbuf_copy(q, p);
954  LWIP_ASSERT("pbuf_copy failed", err == ERR_OK);
955  pbuf_free(p);
956  return q;
957 }
u8_t pbuf_free(struct pbuf *p)
Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain o...
Definition: pbuf.cc:559
#define ERR_OK
Definition: err.h:56
IP layer
Definition: lwip_tcp.txt:3
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
Definition: pbuf.h:58
err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
Create PBUF_RAM copies of pbufs.
Definition: pbuf.cc:783
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type).
Definition: pbuf.cc:210
s8_t err_t
Define LWIP_ERR_T in cc.h if you want to use a different type for your platform (must be signed)...
Definition: err.h:51
err_t inet::tcp::pbuf_copy ( struct pbuf p_to,
struct pbuf p_from 
)

Create PBUF_RAM copies of pbufs.

Used to queue packets on behalf of the lwIP stack, such as ARP based queueing.

Note
You MUST explicitly use p = pbuf_take(p);
Only one packet is copied, no packet queue!
Parameters
p_topbuf destination of the copy
p_frompbuf source of the copy
Returns
ERR_OK if pbuf was copied ERR_ARG if one of the pbufs is nullptr or p_to is not big enough to hold p_from

Referenced by pbuf_coalesce().

784 {
785  u16_t offset_to=0, offset_from=0, len;
786 
787  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy(%p, %p)\n",
788  (void*)p_to, (void*)p_from));
789 
790  /* is the target big enough to hold the source? */
791  LWIP_ERROR("pbuf_copy: target not big enough to hold source", ((p_to != nullptr) &&
792  (p_from != nullptr) && (p_to->tot_len >= p_from->tot_len)), return ERR_ARG;);
793 
794  /* iterate through pbuf chain */
795  do
796  {
797  LWIP_ASSERT("p_to != nullptr", p_to != nullptr);
798  /* copy one part of the original chain */
799  if ((p_to->len - offset_to) >= (p_from->len - offset_from)) {
800  /* complete current p_from fits into current p_to */
801  len = p_from->len - offset_from;
802  } else {
803  /* current p_from does not fit into current p_to */
804  len = p_to->len - offset_to;
805  }
806  MEMCPY((u8_t*)p_to->payload + offset_to, (u8_t*)p_from->payload + offset_from, len);
807  offset_to += len;
808  offset_from += len;
809  LWIP_ASSERT("offset_to <= p_to->len", offset_to <= p_to->len);
810  if (offset_to == p_to->len) {
811  /* on to next p_to (if any) */
812  offset_to = 0;
813  p_to = p_to->next;
814  }
815  LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len);
816  if (offset_from >= p_from->len) {
817  /* on to next p_from (if any) */
818  offset_from = 0;
819  p_from = p_from->next;
820  }
821 
822  if((p_from != nullptr) && (p_from->len == p_from->tot_len)) {
823  /* don't copy more than one packet! */
824  LWIP_ERROR("pbuf_copy() does not allow packet queues!\n",
825  (p_from->next == nullptr), return ERR_VAL;);
826  }
827  if((p_to != nullptr) && (p_to->len == p_to->tot_len)) {
828  /* don't copy more than one packet! */
829  LWIP_ERROR("pbuf_copy() does not allow packet queues!\n",
830  (p_to->next == nullptr), return ERR_VAL;);
831  }
832  } while (p_from);
833  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy: end of chain reached.\n"));
834  return ERR_OK;
835 }
uint8_t u8_t
Definition: cc.h:31
uint16_t len
Definition: TCP_NSC.cc:85
#define ERR_VAL
Definition: err.h:69
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define ERR_OK
Definition: err.h:56
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
#define ERR_ARG
Definition: err.h:71
uint16_t u16_t
Definition: cc.h:35
#define MEMCPY(dst, src, len)
MEMCPY: override this if you have a faster implementation at hand than the one included in your C lib...
Definition: opt.h:80
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
u16_t inet::tcp::pbuf_copy_partial ( struct pbuf buf,
void *  dataptr,
u16_t  len,
u16_t  offset 
)

Copy (part of) the contents of a packet buffer to an application supplied buffer.

Parameters
bufthe pbuf from which to copy data
dataptrthe application supplied buffer
lenlength of data to copy (dataptr must be big enough). No more than buf->tot_len will be copied, irrespective of len
offsetoffset into the packet buffer from where to begin copying len bytes
Returns
the number of bytes copied, or 0 on failure
850 {
851  struct pbuf *p;
852  u16_t left;
853  u16_t buf_copy_len;
854  u16_t copied_total = 0;
855 
856  LWIP_ERROR("pbuf_copy_partial: invalid buf", (buf != nullptr), return 0;);
857  LWIP_ERROR("pbuf_copy_partial: invalid dataptr", (dataptr != nullptr), return 0;);
858 
859  left = 0;
860 
861  if((buf == nullptr) || (dataptr == nullptr)) {
862  return 0;
863  }
864 
865  /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
866  for(p = buf; len != 0 && p != nullptr; p = p->next) {
867  if ((offset != 0) && (offset >= p->len)) {
868  /* don't copy from this buffer -> on to the next */
869  offset -= p->len;
870  } else {
871  /* copy from this buffer. maybe only partially. */
872  buf_copy_len = p->len - offset;
873  if (buf_copy_len > len)
874  buf_copy_len = len;
875  /* copy the necessary parts of the buffer */
876  MEMCPY(&((char*)dataptr)[left], &((char*)p->payload)[offset], buf_copy_len);
877  copied_total += buf_copy_len;
878  left += buf_copy_len;
879  len -= buf_copy_len;
880  offset = 0;
881  }
882  }
883  return copied_total;
884 }
uint16_t len
Definition: TCP_NSC.cc:85
uint16_t u16_t
Definition: cc.h:35
#define MEMCPY(dst, src, len)
MEMCPY: override this if you have a faster implementation at hand than the one included in your C lib...
Definition: opt.h:80
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
struct pbuf * inet::tcp::pbuf_dechain ( struct pbuf p)

Dechains the first pbuf from its succeeding pbufs in the chain.

Makes p->tot_len field equal to p->len.

Parameters
ppbuf to dechain
Returns
remainder of the pbuf chain, or nullptr if it was de-allocated.
Note
May not be called on a packet queue.
735 {
736  struct pbuf *q;
737  u8_t tail_gone = 1;
738  /* tail */
739  q = p->next;
740  /* pbuf has successor in chain? */
741  if (q != nullptr) {
742  /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
743  LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len);
744  /* enforce invariant if assertion is disabled */
745  q->tot_len = p->tot_len - p->len;
746  /* decouple pbuf from remainder */
747  p->next = nullptr;
748  /* total length of pbuf p is its own length only */
749  p->tot_len = p->len;
750  /* q is no longer referenced by p, free it */
751  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_dechain: unreferencing %p\n", (void *)q));
752  tail_gone = pbuf_free(q);
753  if (tail_gone > 0) {
755  ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q));
756  }
757  /* return remaining tail or nullptr if deallocated */
758  }
759  /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
760  LWIP_ASSERT("p->tot_len == p->len", p->tot_len == p->len);
761  return ((tail_gone > 0) ? nullptr : q);
762 }
uint8_t u8_t
Definition: cc.h:31
u8_t pbuf_free(struct pbuf *p)
Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain o...
Definition: pbuf.cc:559
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
u8_t inet::tcp::pbuf_free ( struct pbuf p)

Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain or queue.

Decrements the pbuf reference count. If it reaches zero, the pbuf is deallocated.

For a pbuf chain, this is repeated for each pbuf in the chain, up to the first pbuf which has a non-zero reference count after decrementing. So, when all reference counts are one, the whole chain is free'd.

Parameters
pThe pbuf (chain) to be dereferenced.
Returns
the number of pbufs that were de-allocated from the head of the chain.
Note
MUST NOT be called on a packet queue (Not verified to work yet).
the reference counter of a pbuf equals the number of pointers that refer to the pbuf (or into the pbuf).

Referenced by pbuf_alloc(), pbuf_coalesce(), pbuf_dechain(), pbuf_realloc(), and inet::tcp::TCP_lwIP::tcp_event_recv().

560 {
561  u16_t type;
562  struct pbuf *q;
563  u8_t count;
564 
565  if (p == nullptr) {
566  LWIP_ASSERT("p != nullptr", p != nullptr);
567  /* if assertions are disabled, proceed with debug output */
569  ("pbuf_free(p == nullptr) was called.\n"));
570  return 0;
571  }
572  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free(%p)\n", (void *)p));
573 
574  PERF_START;
575 
576  LWIP_ASSERT("pbuf_free: sane type",
577  p->type == PBUF_RAM || p->type == PBUF_ROM ||
578  p->type == PBUF_REF || p->type == PBUF_POOL);
579 
580  count = 0;
581  /* de-allocate all consecutive pbufs from the head of the chain that
582  * obtain a zero reference count after decrementing*/
583  while (p != nullptr) {
584  u16_t ref;
585  SYS_ARCH_DECL_PROTECT(old_level);
586  /* Since decrementing ref cannot be guaranteed to be a single machine operation
587  * we must protect it. We put the new ref into a local variable to prevent
588  * further protection. */
589  SYS_ARCH_PROTECT(old_level);
590  /* all pbufs in a chain are referenced at least once */
591  LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
592  /* decrease reference count (number of pointers to pbuf) */
593  ref = --(p->ref);
594  SYS_ARCH_UNPROTECT(old_level);
595  /* this pbuf is no longer referenced to? */
596  if (ref == 0) {
597  /* remember next pbuf in chain for next iteration */
598  q = p->next;
599  LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: deallocating %p\n", (void *)p));
600  type = p->type;
601  /* is this a pbuf from the pool? */
602  if (type == PBUF_POOL) {
603  memp_free(MEMP_PBUF_POOL, p);
604  /* is this a ROM or RAM referencing pbuf? */
605  } else if (type == PBUF_ROM || type == PBUF_REF) {
606  memp_free(MEMP_PBUF, p);
607  /* type == PBUF_RAM */
608  } else {
609  mem_free(p);
610  }
611  count++;
612  /* proceed to next pbuf */
613  p = q;
614  /* p->ref > 0, this pbuf is still referenced to */
615  /* (and so the remaining pbufs in chain as well) */
616  } else {
617  LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %" U16_F ", ending here.\n", (void *)p, ref));
618  /* stop walking through the chain */
619  p = nullptr;
620  }
621  }
622  PERF_STOP("pbuf_free");
623  /* return number of de-allocated pbufs */
624  return count;
625 }
void memp_free(memp_t type, void *mem)
Put an element back into its pool.
Definition: memp.cc:356
uint8_t u8_t
Definition: cc.h:31
#define LWIP_DBG_LEVEL_SERIOUS
Definition: debug.h:50
void mem_free(void *mem)
#define U16_F
Definition: cc.h:56
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
#define PERF_STOP(x)
Definition: perf.h:4
#define PERF_START
Definition: perf.h:3
#define SYS_ARCH_DECL_PROTECT(lev)
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for ...
Definition: sys.h:210
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
Definition: pbuf.h:59
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
Definition: pbuf.h:61
Definition: pbuf.h:60
uint16_t u16_t
Definition: cc.h:35
Definition: pbuf.h:58
#define SYS_ARCH_PROTECT(lev)
Definition: sys.h:211
#define SYS_ARCH_UNPROTECT(lev)
Definition: sys.h:212
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
err_t inet::tcp::pbuf_free_callback ( struct pbuf p)
u8_t inet::tcp::pbuf_header ( struct pbuf p,
s16_t  header_size_increment 
)

Adjusts the payload pointer to hide or reveal headers in the payload.

Adjusts the ->payload pointer so that space for a header (dis)appears in the pbuf payload.

The ->payload, ->tot_len and ->len fields are adjusted.

Parameters
ppbuf to change the header size.
header_size_incrementNumber of bytes to increment header size which increases the size of the pbuf. New space is on the front. (Using a negative value decreases the header size.) If hdr_size_inc is 0, this function does nothing and returns succesful.

PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so the call will fail. A check is made that the increase in header size does not move the payload pointer in front of the start of the buffer.

Returns
non-zero on failure, zero on success.
453 {
454  u16_t type;
455  void *payload;
456  u16_t increment_magnitude;
457 
458  LWIP_ASSERT("p != nullptr", p != nullptr);
459  if ((header_size_increment == 0) || (p == nullptr))
460  return 0;
461 
462  if (header_size_increment < 0){
463  increment_magnitude = -header_size_increment;
464  /* Check that we aren't going to move off the end of the pbuf */
465  LWIP_ERROR("increment_magnitude <= p->len", (increment_magnitude <= p->len), return 1;);
466  } else {
467  increment_magnitude = header_size_increment;
468 #if 0
469  /* Can't assert these as some callers speculatively call
470  pbuf_header() to see if it's OK. Will return 1 below instead. */
471  /* Check that we've got the correct type of pbuf to work with */
472  LWIP_ASSERT("p->type == PBUF_RAM || p->type == PBUF_POOL",
473  p->type == PBUF_RAM || p->type == PBUF_POOL);
474  /* Check that we aren't going to move off the beginning of the pbuf */
475  LWIP_ASSERT("p->payload - increment_magnitude >= p + SIZEOF_STRUCT_PBUF",
476  (u8_t *)p->payload - increment_magnitude >= (u8_t *)p + SIZEOF_STRUCT_PBUF);
477 #endif
478  }
479 
480  type = p->type;
481  /* remember current payload pointer */
482  payload = p->payload;
483 
484  /* pbuf types containing payloads? */
485  if (type == PBUF_RAM || type == PBUF_POOL) {
486  /* set new payload pointer */
487  p->payload = (u8_t *)p->payload - header_size_increment;
488  /* boundary check fails? */
489  if ((u8_t *)p->payload < (u8_t *)p + SIZEOF_STRUCT_PBUF) {
491  ("pbuf_header: failed as %p < %p (not enough space for new header size)\n",
492  (void *)p->payload, (void *)(p + 1)));
493  /* restore old payload pointer */
494  p->payload = payload;
495  /* bail out unsuccesfully */
496  return 1;
497  }
498  /* pbuf types refering to external payloads? */
499  } else if (type == PBUF_REF || type == PBUF_ROM) {
500  /* hide a header in the payload? */
501  if ((header_size_increment < 0) && (increment_magnitude <= p->len)) {
502  /* increase payload pointer */
503  p->payload = (u8_t *)p->payload - header_size_increment;
504  } else {
505  /* cannot expand payload to front (yet!)
506  * bail out unsuccesfully */
507  return 1;
508  }
509  }
510  else {
511  /* Unknown type */
512  LWIP_ASSERT("bad pbuf type", 0);
513  return 1;
514  }
515  /* modify pbuf length fields */
516  p->len += header_size_increment;
517  p->tot_len += header_size_increment;
518 
519  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_header: old %p new %p (%" S16_F ")\n",
520  (void *)payload, (void *)p->payload, header_size_increment));
521 
522  return 0;
523 }
uint8_t u8_t
Definition: cc.h:31
#define LWIP_DBG_LEVEL_SERIOUS
Definition: debug.h:50
#define SIZEOF_STRUCT_PBUF
Definition: pbuf.cc:93
uint16_t len
Definition: TCP_NSC.cc:85
#define PBUF_DEBUG
PBUF_DEBUG: Enable debugging in pbuf.c.
Definition: opt.h:1630
#define LWIP_DBG_TRACE
flag for LWIP_DEBUGF indicating a tracing message (to follow program flow)
Definition: debug.h:60
Definition: pbuf.h:59
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
Definition: pbuf.h:61
#define S16_F
Definition: cc.h:58
Definition: pbuf.h:60
uint16_t u16_t
Definition: cc.h:35
Definition: pbuf.h:58
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
if(!(yy_init))
Definition: lexer.cc:1644
void inet::tcp::pbuf_realloc ( struct pbuf p,
u16_t  new_len 
)

Shrink a pbuf chain to a desired length.

Parameters
ppbuf to shrink.
new_lendesired new length of pbuf chain

Depending on the desired length, the first few pbufs in a chain might be skipped and left unchanged. The new last pbuf in the chain will be resized, and any remaining pbufs will be freed.

Note
If the pbuf is ROM/REF, only the ->tot_len and ->len fields are adjusted.
May not be called on a packet queue.
Despite its name, pbuf_realloc cannot grow the size of a pbuf (chain).
372 {
373  struct pbuf *q;
374  u16_t rem_len; /* remaining length */
375  s32_t grow;
376 
377  LWIP_ASSERT("pbuf_realloc: p != nullptr", p != nullptr);
378  LWIP_ASSERT("pbuf_realloc: sane p->type", p->type == PBUF_POOL ||
379  p->type == PBUF_ROM ||
380  p->type == PBUF_RAM ||
381  p->type == PBUF_REF);
382 
383  /* desired length larger than current length? */
384  if (new_len >= p->tot_len) {
385  /* enlarging not yet supported */
386  return;
387  }
388 
389  /* the pbuf chain grows by (new_len - p->tot_len) bytes
390  * (which may be negative in case of shrinking) */
391  grow = new_len - p->tot_len;
392 
393  /* first, step over any pbufs that should remain in the chain */
394  rem_len = new_len;
395  q = p;
396  /* should this pbuf be kept? */
397  while (rem_len > q->len) {
398  /* decrease remaining length by pbuf length */
399  rem_len -= q->len;
400  /* decrease total length indicator */
401  LWIP_ASSERT("grow < max_u16_t", grow < 0xffff);
402  q->tot_len += (u16_t)grow;
403  /* proceed to next pbuf in chain */
404  q = q->next;
405  LWIP_ASSERT("pbuf_realloc: q != nullptr", q != nullptr);
406  }
407  /* we have now reached the new last pbuf (in q) */
408  /* rem_len == desired length for pbuf q */
409 
410  /* shrink allocated memory for PBUF_RAM */
411  /* (other types merely adjust their length fields */
412  if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
413  /* reallocate and adjust the length of the pbuf that will be split */
414  q = (struct pbuf *)mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len);
415  LWIP_ASSERT("mem_realloc give q == nullptr", q != nullptr);
416  }
417  /* adjust length fields for new last pbuf */
418  q->len = rem_len;
419  q->tot_len = q->len;
420 
421  /* any remaining pbufs in chain? */
422  if (q->next != nullptr) {
423  /* free remaining pbufs in chain */
424  pbuf_free(q->next);
425  }
426  /* q is last packet in chain */
427  q->next = nullptr;
428 
429 }
int32_t s32_t
Definition: cc.h:53
uint8_t u8_t
Definition: cc.h:31
u8_t pbuf_free(struct pbuf *p)
Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain o...
Definition: pbuf.cc:559
void * mem_realloc(void *mem, mem_size_t size)
Definition: pbuf.h:59
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
Definition: pbuf.h:61
Definition: pbuf.h:60
uint16_t u16_t
Definition: cc.h:35
Definition: pbuf.h:58
void inet::tcp::pbuf_ref ( struct pbuf p)

Increment the reference count of the pbuf.

Parameters
ppbuf to increase reference counter of

Referenced by pbuf_chain().

655 {
656  SYS_ARCH_DECL_PROTECT(old_level);
657  /* pbuf given? */
658  if (p != nullptr) {
659  SYS_ARCH_PROTECT(old_level);
660  ++(p->ref);
661  SYS_ARCH_UNPROTECT(old_level);
662  }
663 }
#define SYS_ARCH_DECL_PROTECT(lev)
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for ...
Definition: sys.h:210
#define SYS_ARCH_PROTECT(lev)
Definition: sys.h:211
#define SYS_ARCH_UNPROTECT(lev)
Definition: sys.h:212
void inet::tcp::pbuf_ref_chain ( struct pbuf p)
err_t inet::tcp::pbuf_take ( struct pbuf buf,
const void *  dataptr,
u16_t  len 
)

Copy application supplied data into a pbuf.

This function can only be used to copy the equivalent of buf->tot_len data.

Parameters
bufpbuf to fill with data
dataptrapplication supplied data buffer
lenlength of the application supplied data buffer
Returns
ERR_OK if successful, ERR_MEM if the pbuf is not big enough
898 {
899  struct pbuf *p;
900  u16_t buf_copy_len;
901  u16_t total_copy_len = len;
902  u16_t copied_total = 0;
903 
904  LWIP_ERROR("pbuf_take: invalid buf", (buf != nullptr), return 0;);
905  LWIP_ERROR("pbuf_take: invalid dataptr", (dataptr != nullptr), return 0;);
906 
907  if ((buf == nullptr) || (dataptr == nullptr) || (buf->tot_len < len)) {
908  return ERR_ARG;
909  }
910 
911  /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
912  for(p = buf; total_copy_len != 0; p = p->next) {
913  LWIP_ASSERT("pbuf_take: invalid pbuf", p != nullptr);
914  buf_copy_len = total_copy_len;
915  if (buf_copy_len > p->len) {
916  /* this pbuf cannot hold all remaining data */
917  buf_copy_len = p->len;
918  }
919  /* copy the necessary parts of the buffer */
920  MEMCPY(p->payload, &((char*)dataptr)[copied_total], buf_copy_len);
921  total_copy_len -= buf_copy_len;
922  copied_total += buf_copy_len;
923  }
924  LWIP_ASSERT("did not copy all data", total_copy_len == 0 && copied_total == len);
925  return ERR_OK;
926 }
uint16_t len
Definition: TCP_NSC.cc:85
#define ERR_OK
Definition: err.h:56
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:69
#define ERR_ARG
Definition: err.h:71
uint16_t u16_t
Definition: cc.h:35
#define MEMCPY(dst, src, len)
MEMCPY: override this if you have a faster implementation at hand than the one included in your C lib...
Definition: opt.h:80
#define LWIP_ERROR(message, expression, handler)
if "expression" isn&#39;t true, then print "message" and execute "handler" expression ...
Definition: debug.h:77
inet::tcp::Register_Class ( Sack  )
inet::tcp::Register_Class ( TCPVirtualDataSendQueue  )
inet::tcp::Register_Class ( TCPVirtualDataRcvQueue  )
inet::tcp::Register_Class ( TCPNoCongestionControl  )
inet::tcp::Register_Class ( DumbTCP  )

Referenced by inet::tcp::Sack::str().

inet::tcp::Register_Class ( TCPNewReno  )
inet::tcp::Register_Class ( TCPTahoe  )
inet::tcp::Register_Class ( TCPMsgBasedSendQueue  )
inet::tcp::Register_Class ( TCPReno  )
inet::tcp::Register_Class ( TCPByteStreamSendQueue  )
inet::tcp::Register_Class ( TCPMsgBasedRcvQueue  )
inet::tcp::Register_Class ( TCPVegas  )
inet::tcp::Register_Class ( TCPWestwood  )
inet::tcp::Register_Class ( TcpLwipVirtualDataSendQueue  )
inet::tcp::Register_Class ( TCP_NSC_VirtualDataSendQueue  )
inet::tcp::Register_Class ( TcpLwipMsgBasedSendQueue  )
inet::tcp::Register_Class ( TCP_NSC_VirtualDataReceiveQueue  )
inet::tcp::Register_Class ( TCP_NSC_ByteStreamSendQueue  )
inet::tcp::Register_Class ( TcpLwipVirtualDataReceiveQueue  )
inet::tcp::Register_Class ( TCPByteStreamRcvQueue  )
inet::tcp::Register_Class ( TcpLwipByteStreamSendQueue  )
inet::tcp::Register_Class ( TcpLwipMsgBasedReceiveQueue  )
inet::tcp::Register_Class ( TcpLwipByteStreamReceiveQueue  )
inet::tcp::Register_Class ( TCP_NSC_ByteStreamReceiveQueue  )
inet::tcp::Register_Class ( TCPSegment  )
simtime_t inet::tcp::roundTime ( const simtime_t &  timeP,
int  secSlicesP 
)

Referenced by inet::tcp::TCP_lwIP::handleMessage().

420 {
421  int64_t scale = timeP.getScale() / secSlicesP;
422  simtime_t ret = timeP;
423  ret /= scale;
424  ret *= scale;
425  return ret;
426 }
bool inet::tcp::seqLE ( uint32  a,
uint32  b 
)
inline

Referenced by inet::tcp::TCPConnection::addSacks(), inet::tcp::TCPSACKRexmitQueue::checkRexmitQueueForSackedOrRexmittedSegments(), inet::tcp::TCPSACKRexmitQueue::checkSackBlock(), inet::tcp::TCPSegmentTransmitInfoList::clearTo(), inet::tcp::Sack::contains(), inet::tcp::TCPByteStreamSendQueue::createSegmentWithBytes(), inet::tcp::TCPVirtualDataSendQueue::createSegmentWithBytes(), inet::tcp::TCPMsgBasedSendQueue::createSegmentWithBytes(), inet::tcp::TcpLwipMsgBasedSendQueue::createSegmentWithBytes(), inet::tcp::TcpLwipMsgBasedSendQueue::discardAckedBytes(), inet::tcp::TCPByteStreamSendQueue::discardUpTo(), inet::tcp::TCPVirtualDataSendQueue::discardUpTo(), inet::tcp::TCPMsgBasedSendQueue::discardUpTo(), inet::tcp::TCPSACKRexmitQueue::discardUpTo(), inet::tcp::TCPSACKRexmitQueue::enqueueSentData(), inet::tcp::TcpLwipMsgBasedReceiveQueue::extractBytesUpTo(), inet::tcp::TCPVirtualDataRcvQueue::extractTo(), inet::tcp::TCPSegmentTransmitInfoList::get(), inet::tcp::TCPSACKRexmitQueue::getAmountOfSackedBytes(), inet::tcp::TCPVirtualDataRcvQueue::getLE(), inet::tcp::TCPVirtualDataRcvQueue::Region::getLengthTo(), inet::tcp::TCPSACKRexmitQueue::getNumOfDiscontiguousSacks(), inet::tcp::TCPVirtualDataRcvQueue::getRE(), inet::tcp::TCPSACKRexmitQueue::getSackedBit(), inet::tcp::TCPConnection::hasEnoughSpaceForSegmentInReceiveQueue(), inet::tcp::TCPMsgBasedRcvQueue::insertBytesFromSegment(), inet::tcp::TCPConnection::isSegmentAcceptable(), inet::tcp::TcpLwipMsgBasedReceiveQueue::notifyAboutIncomingSegmentProcessing(), inet::tcp::TCPConnection::processAckInEstabEtc(), inet::tcp::TCPConnection::processSACKOption(), inet::tcp::TCPConnection::processSegment1stThru8th(), inet::tcp::TCPConnection::processSegmentInSynSent(), inet::tcp::TCPConnection::processTSOption(), inet::tcp::TCPConnection::sendSegmentDuringLossRecoveryPhase(), inet::tcp::TCPSegmentTransmitInfoList::set(), inet::tcp::TCPSACKRexmitQueue::setSackedBit(), and inet::tcp::TCPConnection::updateWndInfo().

33 { return (b - a) < (1UL << 31); }
value< double, units::m > b
Definition: Units.h:1054
bool inet::tcp::seqLess ( uint32  a,
uint32  b 
)
inline

Referenced by inet::tcp::TCPConnection::addSacks(), inet::tcp::TCPSACKRexmitQueue::checkQueue(), inet::tcp::TCPSACKRexmitQueue::checkRexmitQueueForSackedOrRexmittedSegments(), inet::tcp::TCPSACKRexmitQueue::checkSackBlock(), inet::tcp::TCPSegmentTransmitInfoList::clearTo(), inet::tcp::TCPVirtualDataRcvQueue::Region::compare(), inet::tcp::TCPSACKRexmitQueue::discardUpTo(), inet::tcp::TCPVirtualDataSendQueue::enqueueAppData(), inet::tcp::TCPMsgBasedSendQueue::enqueueAppData(), inet::tcp::TCPSACKRexmitQueue::enqueueSentData(), inet::tcp::TCPMsgBasedRcvQueue::extractBytesUpTo(), inet::tcp::TCPSegmentTransmitInfoList::get(), inet::tcp::TCPSACKRexmitQueue::getAmountOfSackedBytes(), inet::tcp::TCPSendQueue::getBytesAvailable(), inet::tcp::TCPVirtualDataRcvQueue::getLE(), inet::tcp::TCPVirtualDataRcvQueue::Region::getLengthTo(), inet::tcp::TCPVirtualDataRcvQueue::getRE(), inet::tcp::TCPSACKRexmitQueue::getSackedBit(), inet::tcp::TCPMsgBasedRcvQueue::insertBytesFromSegment(), inet::tcp::TCPConnection::isSegmentAcceptable(), inet::tcp::TCPByteStreamRcvQueue::Region::merge(), inet::tcp::TCPVirtualDataRcvQueue::Region::merge(), inet::tcp::TCPConnection::nextSeg(), inet::tcp::TcpLwipMsgBasedReceiveQueue::notifyAboutIncomingSegmentProcessing(), inet::tcp::TCPConnection::processAckInEstabEtc(), inet::tcp::TCPConnection::processSegment1stThru8th(), inet::tcp::TCPConnection::processTSOption(), inet::tcp::TCPBaseAlg::receivedDataAck(), inet::tcp::TCPConnection::sendSegmentDuringLossRecoveryPhase(), inet::tcp::TCPSegmentTransmitInfoList::set(), inet::tcp::TCPConnection::setPipe(), inet::tcp::TCPSACKRexmitQueue::setSackedBit(), inet::tcp::TCPByteStreamRcvQueue::Region::split(), inet::tcp::TCPVirtualDataRcvQueue::Region::split(), inet::tcp::TCPSegment::truncateSegment(), and inet::tcp::TCPConnection::updateWndInfo().

32 { return a != b && (b - a) < (1UL << 31); }
value< double, units::m > b
Definition: Units.h:1054
uint32 inet::tcp::seqMax ( uint32  a,
uint32  b 
)
inline

Referenced by inet::tcp::TCPVirtualDataRcvQueue::insertBytesFromSegment(), and inet::tcp::TCPByteStreamRcvQueue::Region::merge().

37 { return ((a - b) < (1UL << 31)) ? a : b; }
value< double, units::m > b
Definition: Units.h:1054
uint32 inet::tcp::seqMin ( uint32  a,
uint32  b 
)
inline

Referenced by inet::tcp::TCPVirtualDataRcvQueue::getFirstSeqNo(), inet::tcp::TCPVirtualDataRcvQueue::insertBytesFromSegment(), and inet::tcp::TCPByteStreamRcvQueue::Region::merge().

36 { return ((b - a) < (1UL << 31)) ? a : b; }
value< double, units::m > b
Definition: Units.h:1054
err_t inet::tcp::slipif_init ( struct netif netif)
void inet::tcp::slipif_poll ( struct netif netif)
u32_t inet::tcp::sys_arch_mbox_fetch ( sys_mbox_t  mbox,
void **  msg,
u32_t  timeout 
)
u32_t inet::tcp::sys_arch_mbox_tryfetch ( sys_mbox_t  mbox,
void **  msg 
)
u32_t inet::tcp::sys_arch_sem_wait ( sys_sem_t  sem,
u32_t  timeout 
)
struct sys_timeouts* inet::tcp::sys_arch_timeouts ( void  )
void inet::tcp::sys_init ( void  )
u32_t inet::tcp::sys_jiffies ( void  )
void inet::tcp::sys_mbox_fetch ( sys_mbox_t  mbox,
void **  msg 
)
void inet::tcp::sys_mbox_free ( sys_mbox_t  mbox)
sys_mbox_t inet::tcp::sys_mbox_new ( int  size)
void inet::tcp::sys_mbox_post ( sys_mbox_t  mbox,
void *  msg 
)
err_t inet::tcp::sys_mbox_trypost ( sys_mbox_t  mbox,
void *  msg 
)
void inet::tcp::sys_msleep ( u32_t  ms)
u32_t inet::tcp::sys_now ( void  )

Returns the current time in milliseconds.

void inet::tcp::sys_sem_free ( sys_sem_t  sem)
sys_sem_t inet::tcp::sys_sem_new ( u8_t  count)
void inet::tcp::sys_sem_signal ( sys_sem_t  sem)
void inet::tcp::sys_sem_wait ( sys_sem_t  sem)
int inet::tcp::sys_sem_wait_timeout ( sys_sem_t  sem,
u32_t  timeout 
)
sys_thread_t inet::tcp::sys_thread_new ( char *  name,
void(*)(void *arg)  thread,
void *  arg,
int  stacksize,
int  prio 
)
void inet::tcp::sys_timeout ( u32_t  msecs,
sys_timeout_handler  h,
void *  arg 
)
void inet::tcp::sys_untimeout ( sys_timeout_handler  h,
void *  arg 
)
err_t inet::tcp::tcpip_callback_with_block ( void(*)(void *ctx)  f,
void *  ctx,
u8_t  block 
)
void inet::tcp::tcpip_init ( void(*)(void *)  tcpip_init_done,
void *  arg 
)
err_t inet::tcp::tcpip_input ( struct pbuf p,
struct netif inp 
)
err_t inet::tcp::tcpip_timeout ( u32_t  msecs,
sys_timeout_handler  h,
void *  arg 
)
err_t inet::tcp::tcpip_untimeout ( sys_timeout_handler  h,
void *  arg 
)

Variable Documentation

class INET_API inet::tcp::TCP_NSC_Connection inet::tcp::__attribute__
const struct ip_hdr* inet::tcp::current_header

Header of the input packet currently being processed.

struct netif* inet::tcp::current_netif

The interface that provided the packet for the current callback invocation.

const struct ip_addr inet::tcp::ip_addr_any
const struct ip_addr inet::tcp::ip_addr_broadcast
const unsigned int inet::tcp::MAX_SACK_ENTRIES = 4
struct netif* inet::tcp::netif_default

The default network interface.

struct netif* inet::tcp::netif_list

The list of network interfaces.

PACK_STRUCT_BEGIN struct inet::tcp::ip_hdr inet::tcp::PACK_STRUCT_STRUCT
const unsigned int inet::tcp::TCP_MAX_HEADER_OCTETS = 60