You want an implementation of a dictionary. A dictionary in the computer science sense is any data structure that can store key/value pairs and look up the value given a key.
It sounds like you want a dictionary keyed by pipe id giving a pointer back.
Common implementations of dictionaries:
* Linked list: Simple, but O(n) in the average case (linear lookup time).
* Array: Simple, and O(1) (constant lookup time) for time, but O(n) for space.
* Search tree: Several algorithms around, look for red-black trees or AVL trees. Much more complex, and well beyond what you need, they generally provide ~O(log2 n) time functions for lookup, insert and remove.
* Hashtable: This is what I would recommend - it's half way between a linked list and an array (when using chained hashing, which is generally used more than probing).
Hashtables
A hashtable consists of a number of "buckets". Initially these are NULL, but when items are added they become linked lists. So essentially you have an array of linked lists.
The array is statically sized - it doesn't get increased when more items are added (this is not always true - if many items are added it may be worthwhile resizing the array to improve lookup times).
When inserting or looking up an item the item is assigned a bucket by use of a hash function, hash(key). The linked list at that bucket is then traversed / added to.
Interestingly, hashtables can perform as arrays or as linked lists depending on the hash function: if it always hashes every key to the same bucket you will end up with one long linked list (with O(n) time lookups/inserts).
If it always hashes every key to a different bucket and there are less keys than the number of buckets you end up with an array (albeit with one level of indirection).
So it is VERY important to get the hash function correct - an ideal hash function will distribute the set of possible keys perfectly evenly over the available buckets. Normal hash functions look something like:
Which should do a half-decent job. Also interesting to note is that hashtables work much better (with this sort of hash function) if the number of buckets is prime. I'll leave you to work out yourself why that is (hint: it uses a modulo (%)).
Summary
I think a hashtable is what you want