/* * Pure Data Packet header file. communication / serialization * Copyright (c) by Tom Schouten * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* This code contains stream abstraction: the things necessary to convert (infinite) lists of atoms (records) to raw binary data for communication and serialization. Textual formats are solved elsewhere. All reading and writing uses posix file descriptors. No buffered i/o from libc. Using blocking read. Since there's no buffering, we try to minimize the number of read calls: - minimize the number of read() calls for small atoms - minimize data copy for bulk data, read each packet in one go So, the minimum number of reads for a chunk of data containing meta data is 2. One for the metadata to set up the memory allocation, and one to read in the chunk. The only smaller possibility is raw streams. */ // READ pf_atom_t *pf_fd_read(int fd){ pf_atom_t *a = pf_atom_new(); } // WRITE int pf_fd_write(pf_atom_t *a){ }