// WctpFactory.hpp #ifndef WCTPFACTORY_HPP #define WCTPFACTORY_HPP #include #include #include #include using namespace std; /* Class WctpFactory * Contains general functionality to format and send WCTP packets. * This is beta software that is still under development. Use * at your own risk. * * New in this version: * - now accepts host names rather than just IP addresses * * Copyright 2000-2001 Arch Wireless Holdings, Inc. * Author Kris Latham * Version 0.1 Beta August 8, 2001 */ class WctpFactory { public: /* * Constructor Method */ WctpFactory(); /* * Destructor Method */ ~WctpFactory(); /* Opens a socket and sends the WCTP Packet * * Parameters: * carrierAddr - the specified gateway (i.e. "10.10.10.10") /wctp is assumed * This will be more configurable in future versions * wctpPacket - the xml document * * Returns the response of the gateway */ string wctpSend(string wctpBody, string gateway); /* Formats the HTTP header * * Parameters: * len - the length of the payload (For Content-Length:) * postDir - this is the directory that you want to post to * * Returns the HTTP header */ string buildHeader(string len, string postDir); /* Correctly formats a WCTP packet * * Returns a WCTP timestamp. */ string getTimeStamp(void); /* Converts a primitive long to a string * * Parameters: * x - the long to convert * * Returns parameter x as a string */ string longToString(long x); /* Converts a primitive int to a string * * Parameters: * x - the integer to convert * * Returns parameter x as a string */ string intToString(int x); /* Method strToLong * * Parameters: * str - the string to convert * * Returns parameter str as a primitive long */ long strToLong(string str); /* Method strToInt * * Parameters: * str - the string to convert * * Returns parameter str as a primitive int */ int strToInt(string str); /* Appends a "0" to a string if the day|month|year|minute|hour|second * is less than 10. This is used to get a correctly formatted WCTP style timestamp * * Parameters: * st - the WCTP packet * x - the day|month|year|minute|hour|second */ void appendZero(int x, string &st); private: }; #endif