00001
00002
00003
00004
00005
00006
00007
00078 #include <CoreFoundation/CoreFoundation.h>
00079
00080 #ifndef PORT_MAPPER_H
00081 #define PORT_MAPPER_H
00082
00083 #ifdef __cplusplus
00084 extern "C"
00085 {
00086 #endif
00087
00089 typedef enum PMProtocol {
00090 kPMUDP_Protocol,
00091 kPMTCP_Protocol
00092 } PMProtocol;
00094 typedef enum PMResult {kPMSuccessful = 0,
00095 kPMInitializationError,
00096 kPMNotInitializedError,
00097 kPMNoRouterFoundError,
00098 kPMPortMappingError,
00099 kPMPortMappingInUseError,
00100 kPMNoSuchPortMappingError,
00101 kPMUnexpectedResult,
00102 kPMPortMappingDisabledError,
00103 kPMSamePortValuesRequired
00104 } PMResult;
00107 typedef enum PMRouterType {
00108 kPMUnknownRouter,
00109 kPMUPnPRouterType,
00110 kPMNAT_PMPRouterType
00111 } PMRouterType;
00112
00119 typedef void (*PMInitializeCallback)(PMResult result, void *context);
00126 typedef void (*PMGetPublicIPCallback)(CFStringRef ipAddress, void *context);
00136 typedef void (*PMAddPortMapCallback)(PMResult result, int publicPort, int privatePort, PMProtocol protocol, void *context);
00146 typedef void (*PMRemovePortMapCallback)(PMResult result, int publicPort, int privatePort, PMProtocol protocol, void *context);
00147
00167 PMResult PMInitialize();
00168
00181 void PMInitializeAsync(PMInitializeCallback callback, CFRunLoopRef runLoop, void *context);
00182
00197 PMResult PMAddPortMapping(int publicPort, int privatePort, PMProtocol protocol);
00198
00215 void PMAddPortMappingAsync(int publicPort, int privatePort, PMProtocol protocol, PMAddPortMapCallback callback, CFRunLoopRef runLoop, void *context);
00216
00230 PMResult PMRemovePortMapping(int publicPort, int privatePort, PMProtocol protocol);
00231
00250 void PMRemovePortMappingAsync(int publicPort, int privatePort, PMProtocol protocol, PMRemovePortMapCallback callback, CFRunLoopRef runLoop, void *context);
00251
00252
00262 CFStringRef PMGetPublicIPAddress();
00263
00277 void PMGetPublicIPAddressAsync(PMGetPublicIPCallback callback, CFRunLoopRef runLoop, void *context);
00278
00286 CFStringRef PMGetRouterName();
00287
00293 PMRouterType PMGetRouterType();
00294
00305 void PMSetRemoveAtExit(int flag);
00306
00307 #ifdef __cplusplus
00308 }
00309 #endif
00310
00311 #endif