Microchip® Advanced Software Framework

psock.h File Reference

Protosocket library header file.

Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se
#include "contiki.h"
#include "contiki-lib.h"
#include "contiki-net.h"

Data Structures

struct  psock
 The representation of a protosocket. More...
 
struct  psock_buf
 

Macros

#define PSOCK_BEGIN(psock)
 Start the protosocket protothread in a function. More...
 
#define PSOCK_CLOSE(psock)
 Close a protosocket. More...
 
#define PSOCK_CLOSE_EXIT(psock)
 Close a protosocket and exit the protosocket's protothread. More...
 
#define PSOCK_DATALEN(psock)
 The length of the data that was previously read. More...
 
#define PSOCK_END(psock)
 Declare the end of a protosocket's protothread. More...
 
#define PSOCK_EXIT(psock)
 Exit the protosocket's protothread. More...
 
#define PSOCK_GENERATOR_SEND(psock, generator, arg)
 Generate data with a function and send it. More...
 
#define PSOCK_INIT(psock, buffer, buffersize)
 Initialize a protosocket. More...
 
#define PSOCK_NEWDATA(psock)
 Check if new data has arrived on a protosocket. More...
 
#define PSOCK_READBUF(psock)
 Read data until the buffer is full. More...
 
#define PSOCK_READBUF_LEN(psock, len)
 Read data until at least len bytes have been read. More...
 
#define PSOCK_READTO(psock, c)
 Read data up to a specified character. More...
 
#define PSOCK_SEND(psock, data, datalen)
 Send data. More...
 
#define PSOCK_SEND_STR(psock, str)
 Send a null-terminated string. More...
 
#define PSOCK_WAIT_THREAD(psock, condition)   PT_WAIT_THREAD(&((psock)->pt), (condition))
 
#define PSOCK_WAIT_UNTIL(psock, condition)
 Wait until a condition is true. More...
 

Functions

uint16_t psock_datalen (struct psock *psock)
 
void psock_init (struct psock *psock, uint8_t *buffer, unsigned int buffersize)
 
char psock_newdata (struct psock *s)
 
 PT_THREAD (psock_send(struct psock *psock, const uint8_t *buf, unsigned int len))
 
 PT_THREAD (psock_generator_send(struct psock *psock, unsigned short(*f)(void *), void *arg))
 
 PT_THREAD (psock_readbuf_len(struct psock *psock, uint16_t len))
 
 PT_THREAD (psock_readto(struct psock *psock, unsigned char c))