*/
typedef struct sAcctIterator tAcctIterator;
+#if 0
/**
* \brief Iterator for a collection of items
*/
typedef struct sItemIterator tItemIterator;
+/**
+ * \brief Item structure
+ */
+typedef struct
+{
+ char *Handler;
+ int ID;
+ int Price;
+ char Name[];
+} tItem;
+#endif
+
/**
* \brief Flag values for the \a Flags parameter to Bank_Iterator
*/
BANK_ITFLAG_SORTMASK = 0x700, //!< Sort type mask
BANK_ITFLAG_REVSORT = 0x800 //!< Sort descending instead
};
+/**
+ * \brief Flag values for the \a Flags parameter to Items_Iterator
+ */
+enum eItems_ItFlags
+{
+ ITEMS_ITFLAG_SHOWDISABLED = 0x001, //!< Show disabled items
+ ITEMS_ITFLAG_SORT_NONE = 0x000, //!< No sorting (up to the implementation)
+ ITEMS_ITFLAG_SORT_NAME = 0x100, //!< Sort alphabetically ascending by name
+ ITEMS_ITFLAG_SORT_PRICE = 0x200, //!< Sort by price, ascending
+ ITEMS_ITFLAG_SORT_IDENT = 0x300, //!< Sort by Identifier (handler:id)
+ ITEMS_ITFLAG_SORTMASK = 0x700, //!< Sort type mask
+ ITEMS_ITFLAG_REVSORT = 0x800 //!< Sort descending instead
+};
/**
* \brief User flag values
*/
extern int Bank_AddAcctCard(int AcctID, const char *CardID);
+// === Item Manipulation ===
+#if 0
+extern tItem *Items_GetItem(char *Handler, int ID);
+/**
+ * \brief Create an item iterator
+ * \return Pointer to an iterator across the selected data set
+ */
+extern tItemIterator *Items_Iterator(int Flags, char *Handler, int MaxPrice);
+
+/**
+ * \brief Get the current entry in the iterator and move to the next
+ * \param It Iterator returned by Items_Iterator
+ * \return Item ID, or -1 for end of list
+ */
+extern tItem *Items_IteratorNext(tItemIterator *It);
+
+/**
+ * \brief Free an allocated iterator
+ * \param It Iterator returned by Items_Iterator
+ */
+extern void Items_DelIterator(tItemIterator *It);
+#endif
+
// ---
// Server provided helper functions
// ---
// Statistics
#define MAX_CONNECTION_QUEUE 5
#define INPUT_BUFFER_SIZE 256
+#define CLIENT_TIMEOUT 10 // Seconds
#define HASH_TYPE SHA1
#define HASH_LENGTH 20
return ;
}
+ // Set a timeout on the user conneciton
+ {
+ struct timeval tv;
+ tv.tv_sec = CLIENT_TIMEOUT;
+ tv.tv_usec = 0;
+ if( setsockopt(client_socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) )
+ {
+ perror("setsockopt");
+ return ;
+ }
+ }
+
// Debug: Print the connection string
if(giDebugLevel >= 2) {
char ipstr[INET_ADDRSTRLEN];
* it is saved to the beginning of `inbuf` and `buf` is updated to
* the end of it.
*/
+ // TODO: Use select() instead (to give a timeout)
while( (bytes = recv(Socket, buf, remspace, 0)) > 0 )
{
char *eol, *start;