Microchip® Advanced Software Framework

psock.c File Reference
#include <string.h>
#include "net/ip/psock.h"

Macros

#define BUF_FOUND   2
 
#define BUF_FULL   1
 
#define BUF_NOT_FOUND   0
 
#define BUF_NOT_FULL   0
 
#define STATE_ACKED   1
 
#define STATE_BLOCKED_CLOSE   4
 
#define STATE_BLOCKED_NEWDATA   3
 
#define STATE_BLOCKED_SEND   5
 
#define STATE_DATA_SENT   6
 
#define STATE_NONE   0
 
#define STATE_READ   2
 

Functions

static uint8_t buf_bufdata (struct psock_buf *buf, uint16_t len, uint8_t **dataptr, uint16_t *datalen)
 
static uint8_t buf_bufto (CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, CC_REGISTER_ARG uint8_t **dataptr, CC_REGISTER_ARG uint16_t *datalen)
 
static void buf_setup (struct psock_buf *buf, uint8_t *bufptr, uint16_t bufsize)
 
static char data_is_sent_and_acked (CC_REGISTER_ARG struct psock *s)
 
 if (psock_datalen(psock)==0)
 
uint16_t psock_datalen (struct psock *psock)
 
void psock_init (CC_REGISTER_ARG struct psock *psock, uint8_t *buffer, unsigned int buffersize)
 
char psock_newdata (struct psock *s)
 
 PT_THREAD (psock_send(CC_REGISTER_ARG struct psock *s, const uint8_t *buf, unsigned int len))
 
 PT_THREAD (psock_generator_send(CC_REGISTER_ARG struct psock *s, unsigned short(*generate)(void *), void *arg))
 

Variables

 do
 
buf_setuppsock
 

#define BUF_FOUND   2

Referenced by buf_bufto().

#define BUF_FULL   1

Referenced by buf_bufdata(), and buf_bufto().

#define BUF_NOT_FOUND   0

Referenced by buf_bufto().

#define BUF_NOT_FULL   0

Referenced by buf_bufdata().

#define STATE_ACKED   1

Referenced by data_is_sent_and_acked().

#define STATE_BLOCKED_CLOSE   4
#define STATE_BLOCKED_NEWDATA   3

Referenced by psock_newdata().

#define STATE_BLOCKED_SEND   5
#define STATE_DATA_SENT   6
#define STATE_NONE   0

Referenced by if(), psock_init(), and PT_THREAD().

#define STATE_READ   2

Referenced by psock_newdata().

static uint8_t buf_bufdata ( struct psock_buf buf,
uint16_t  len,
uint8_t **  dataptr,
uint16_t *  datalen 
)
static
static uint8_t buf_bufto ( CC_REGISTER_ARG struct psock_buf buf,
uint8_t  endmarker,
CC_REGISTER_ARG uint8_t **  dataptr,
CC_REGISTER_ARG uint16_t *  datalen 
)
static

References BUF_FOUND, BUF_FULL, BUF_NOT_FOUND, and c.

static void buf_setup ( struct psock_buf buf,
uint8_t *  bufptr,
uint16_t  bufsize 
)
static

References bufptr, psock_buf::left, and psock_buf::ptr.

Referenced by psock_init().

static char data_is_sent_and_acked ( CC_REGISTER_ARG struct psock s)
static
if ( psock_datalen(psock = = 0)

References PT_RESTART, and STATE_NONE.

void psock_init ( CC_REGISTER_ARG struct psock psock,
uint8_t *  buffer,
unsigned int  buffersize 
)

References buf_setup(), buffer, PT_INIT, and STATE_NONE.

PT_THREAD ( psock_send(CC_REGISTER_ARG struct psock *s, const uint8_t *buf,unsigned int len )
PT_THREAD ( psock_generator_send(CC_REGISTER_ARG struct psock *s,unsigned short(*generate)(void *), void *arg)  )

do
Initial value:
{
if(psock->readlen == 0) {
psock->readptr = (uint8_t *)uip_appdata;
}
} while(buf_bufto(&psock->buf, c,
unsigned char state
Definition: psock.h:129
struct psock_buf buf
Definition: psock.h:125
#define BUF_NOT_FOUND
Definition: psock.c:53
void * uip_appdata
Pointer to the application data in the packet buffer.
Definition: uip6.c:174
uint16_t readlen
Definition: psock.h:123
#define PT_WAIT_UNTIL(pt, condition)
Block and wait until condition is true.
Definition: pt.h:147
The representation of a protosocket.
Definition: psock.h:112
static Client c
Definition: aws_iot_mqtt_embedded_client_wrapper.c:21
static uint8_t buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, CC_REGISTER_ARG uint8_t **dataptr, CC_REGISTER_ARG uint16_t *datalen)
Definition: psock.c:107
uint8_t * readptr
Definition: psock.h:117
char psock_newdata(struct psock *s)
Definition: psock.c:232
struct pt pt psockpt
Definition: psock.h:113
#define STATE_READ
Definition: psock.c:41
#define uip_datalen()
The length of any incoming data that is currently available (if available) in the uip_appdata buffer...
Definition: uip.h:650
Initial value:
{
The representation of a protosocket.
Definition: psock.h:112
#define PT_BEGIN(pt)
Declare the start of a protothread inside the C function implementing the protothread.
Definition: pt.h:114
struct pt pt psockpt
Definition: psock.h:113