1/*
2    File:       ttppdu.h
3
4    Contains:   TinyTP PDU routines
5
6*/
7#ifndef _TTPPDU_
8#define _TTPPDU_
9
10#include "ttp.h"
11
12//
13// Connect PDU
14//
15#define PiMaxSduSize 0x01       // Only defined Pi value as of TinyTP 1.0
16
17// Generate a connect PDU, does *not* change or free input databuffer
18TTPBuf *
19ttp_pdu_connect(int P, int InitialCredit, int MaxSduSize, TTPBuf *UserData);
20
21// Parse a connect PDU, copies parameters into *plist (sizeof >= 60 bytes)
22// input data buffer has parameters removed
23void
24ttp_pdu_connect_parse(TTPBuf *data, int *p, int *n, unsigned char *plist);
25
26// parse a connect PDU's parameter list to extract the MaxSduSize
27// returns true if the parameter was found and *maxsize is set
28Boolean
29ttp_pdu_connect_get_max_sdu_size(unsigned char *buf, UInt32 *maxsize);
30
31//
32// Data PDU
33//
34
35// returns a new TTPBuf with the flag byte at the start, any data appended
36//   this needs to be designed better!
37TTPBuf *
38ttp_pdu_data(Boolean m, int credit, TTPBuf *data);
39
40void
41ttp_pdu_data_setbyte(Boolean m, int credit, TTPBuf *data);      // put in ttp byte at start of data
42
43
44// extracts More flag, credit, and incr's pointer in userdata to skip TTP overhead byte
45void ttp_pdu_data_parse(TTPBuf *userData, Boolean *m, int *credit);
46
47void BufHideRest(TTPBuf *data);         // misc buffer manipulation
48
49//********* TEMP UNTIL BETTER QUEUE ROUTINES FOUND FOR OS-X ********************
50// note - currently do *not* need atomic enqueue/dequeue
51IrDAErr Enqueue(QElemPtr qElement, QHdrPtr qHeader);
52IrDAErr Dequeue(QElemPtr qElement, QHdrPtr qHeader);
53//******************************************************************************
54
55
56#endif // _TTPPDU_