/*
 * Copyright 2011 Steven Gribble
 *
 *  This file is part of the UW CSE 333 course project sequence
 *  (333proj).
 *
 *  333proj 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  333proj 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 333proj.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _HW1_LL_PRIV_H_
#define _HW1_LL_PRIV_H_

// Define the internal, private structs associated with a
// linked list.

// this a struct we use to represent a linked list node:
typedef struct ll_node {
  void           *payload;  // customer-supplied payload
  struct ll_node *next;     // next node, or NULL
  struct ll_node *prev;     // previous node, or NULL
} LinkedListNode, *LinkedListNodePtr;

// this is a struct we use to represent an entire linked list:
typedef struct ll_head_st {
  unsigned int      num_elements;
  LinkedListNodePtr head;  // head of linked list, or NULL if empty
  LinkedListNodePtr tail;  // tail of linked list, or NULL if empty
} LinkedListRecord, *LinkedListRecordPtr;

// this is a struct we use to represent an iterator:
typedef struct ll_iter {
  LinkedListRecordPtr list;  // the linked list we're for
  LinkedListNodePtr   node;  // the node we're currently at, or NULL
} LLIterRecord, *LLIterRecordPtr;

#endif  // _HW1_LL_PRIV_H_