/****************************************************************************** * * Name: static_add_rx_fragment * * Description: Add received fragment to a data connection's fragment queue * and update the total bytes length of data connection's queue. * * Input: p_ctx - handle to NCI DATA context object * conn_id - Connection ID * p_buff - Received data buffer * * Output: None * * Return: Accumulated length of incoming fragments in the connection * *******************************************************************************/ static nfc_u32 static_add_rx_fragment(struct nci_data_context *p_ctx, nfc_u8 conn_id, struct nci_buff *p_buff) { struct nci_conn *p_conn = &p_ctx->p_conn_tbl[conn_id]; que_enqueue(p_conn->h_rx_fragments, p_buff); p_conn->rx_accumulated_length += nci_buff_length(p_buff); return p_conn->rx_accumulated_length; }
///삭제된 단어의 고유번호를 파일에서 읽어서 queue에 저장 unsigned int fio_read_from_file_kno (char *fname, QUEUE* queue) { FILE *fp; register int i; unsigned int kno, *pno; int ch; char in_key[ASIZE]; fp = fopen (fname, "r"); if (fp == NULL) return 0; //printf (", Not exist!\n"); printf ("Reading data from the %s...\n", fname); if (_fio_read_header (fp, fname, in_key) < 0) { printf (", Header error!\n"); return 0; } while ((ch = fgetc (fp)) != EOF) { //-1, 0x1A, ^Z i = 0; while (ch != '\0' && i < ASIZE-2) { in_key[i++] = ch; ch = fgetc (fp); } in_key[i] = '\0'; //문자열을 unsigned int로 변환 kno = str_to_uint (in_key); //큐에 입력 pno = malloc (sizeof(unsigned int)); if (pno) { *pno = kno; que_enqueue (queue, pno); //삭제된 고유번호를 큐에 저장 } else return 0; //메모리 할당 실패 } //while fclose (fp); printf ("have read data: queue (%d)\n", queue->count); return queue->count; //읽은 키 개수 }