00001 /* AL_SENDING.H */ 00002 00003 #ifndef _AL_SENDING_H_ 00004 #define _AL_SENDING_H_ 00005 00006 #include "Buffer.h" 00007 #include "arq.h" 00008 #include "al.h" 00009 #include "rcpc.h" 00010 00011 #define MAX_ARQ_BUFFER_SIZE 10 00012 #define MAX_AL_BUFFER_SIZE 100000 00013 00014 typedef struct { 00015 00016 al_type type; /* AL type (AL1M, AL2M, etc.) */ 00017 int framed; /* Frame with HDLC flags? */ 00018 int seq_num; /* Prepend Sequence number? */ 00019 int rcpc_code; /* Use RCPC coding? */ 00020 int rcpc_rate; /* RCPC coding rate */ 00021 int arq_type; /* ARQ Retransmission (0=None,1=typeI,2=typeII,3=typeI/II */ 00022 int crc_bytes; /* Number of CRC bytes to append */ 00023 00024 int vs; /* Current Sequence number */ 00025 00026 Buffer* al_sdus; /* (byte) new SDU's to send */ 00027 Buffer* rcpcs; /* (buf_rcpc) PDU's to be retransmitted */ 00028 Buffer* forward_arq; /* (arq_message) requests for retransmission from 00029 * corresponding remote al_receiving_entity 00030 * (ARQ on this channel) 00031 */ 00032 Buffer* backward_arq; /* (arq_message) requests for retransmission from 00033 * corresponding local al_receiving_entity 00034 * (ARQ for other channel) 00035 */ 00036 } al_sending_entity; 00037 00038 /* function prototypes */ 00039 00040 int al_send_request(al_sending_entity *which, bytes *al_sdu); 00041 /* 00042 * Called by an AL user to send an SDU through a logical channel. Data 00043 * is put into the al_sending_entity buffer and will be made into an AL_PDU 00044 * and sent when an AL_PDU is requested by the MUX. 00045 * 00046 * Returns 1 if succesful, 0 if unsuccesful (ie. buffer full) 00047 */ 00048 00049 int al_send_byte(al_sending_entity *which, unsigned char b); 00050 /* 00051 * Does the same as above, but for one byte only 00052 */ 00053 00054 int al_request(al_sending_entity *which); 00055 /* 00056 * This function is called by the MUX to see if an al_sending 00057 * entity has data which needs to be sent 00058 */ 00059 00060 int al_requested_size(al_sending_entity *which); 00061 /* 00062 * This function is called by the MUX to see how big an ARQ packet needs 00063 * to be sent. It returns the AL-PDU length needed for the ARQ, or 0 if 00064 * there are no forward ARQ's. 00065 */ 00066 00067 int al_buffer_level(al_sending_entity *which); 00068 /* 00069 * This function is called by the MUX to see how much NEW data this channel 00070 * has waiting to send so that it can devise an appropriate multiplex 00071 * code that assigns a block of data to the channel associated with this 00072 * al_sending_entity. 00073 * 00074 * Also can be called by the al-user (sender) to perform rate control. 00075 * The H.263 encoder does this to control its frame rate. 00076 */ 00077 00078 void al_arq_request(al_sending_entity *which, arq_message *clone); 00079 /* 00080 * This function is called by the corresponding al_receiving entity 00081 * when it wants to request a retransmission of a particular AL_SDU 00082 */ 00083 00084 void al_arq_received(al_sending_entity *which, arq_message *clone); 00085 /* 00086 * This function is called by the corresponding al_receiving entity 00087 * when it wants to report that a retransmission request has been 00088 * received. The al_sending_entity saves the incoming arq_message 00089 */ 00090 00091 al_sending_entity *new_al_sending_entity(channel_info *nfo); 00092 /* 00093 * Makes a new AL-Sending entity based on the channel_info struc 00094 */ 00095 00096 void make_forward_control(bytes *forward_control,unsigned int snf, 00097 unsigned int pt,unsigned int rn); 00098 /* 00099 * This function is only used in the old Annex A product 00100 */ 00101 00102 void make_backward_control(bytes* backward_control,unsigned int snb, 00103 unsigned int sm); 00104 /* 00105 * This function is only used in the old Annex A product 00106 */ 00107 00108 int inc_sn(al_sending_entity *which); 00109 /* 00110 * returns the current sequence number available from which, and 00111 * then increments it. 00112 */ 00113 00114 bytes *get_al_pdu(al_sending_entity *which, int size); 00115 /* 00116 * Constructs an AL-PDU of total size size (including headers, 00117 * FEC, CRC if appropriate). 00118 * 00119 * If there is a forward retransmission request to send (and the size 00120 * compatible) it shall send it. 00121 * If there is a backward_arq message for one or more AL sending entities, 00122 * it shall include a backward control field. 00123 * (last 2 items: old h.223/a only) 00124 */ 00125 00126 00127 #endif