DatagramSocketImpl.h

Go to the documentation of this file.
00001 #ifndef JAVA_NET_DATAGRAMSOCKETIMPL_H
00002 #define JAVA_NET_DATAGRAMSOCKETIMPL_H 1
00003 
00004 #ifndef JAVA_NET_SOCKETOPTIONS_H
00005 #include <java_net/SocketOptions.h>
00006 #endif /* JAVA_NET_SOCKETOPTIONS_H */
00007 #ifndef JAVA_NET_DATAGRAMPACKET_H
00008 #include <java_net/DatagramPacket.h>
00009 #endif /* JAVA_NET_DATAGRAMPACKET_H */
00010 #ifndef JAVA_NET_INETADDRESS_H
00011 #include <java_net/InetAddress.h>
00012 #endif /* JAVA_NET_INETADDRESS_H */
00013 #ifndef JAVA_NET_SOCKETADDRESS_H
00014 #include <java_net/SocketAddress.h>
00015 #endif /* JAVA_NET_SOCKETADDRESS_H */
00016 #ifndef JAVA_NET_NETWORKINTERFACE_H
00017 #include <java_net/NetworkInterface.h>
00018 #endif /* JAVA_NET_NETWORKINTERFACE_H */
00019 #ifndef JAVA_IO_FILEDESCRIPTOR_H
00020 #include <java_io/FileDescriptor.h>
00021 #endif /* JAVA_IO_FILEDESCRIPTOR_H */
00022 #ifndef JAVA_NET_SPEC
00023 #include <java_net/Spec.h>
00024 #endif /* JAVA_NET_SPEC */
00025 
00026 namespace java {
00027   namespace net {
00028 
00029     using namespace java::io;
00030 
00037     class 
00038       DatagramSocketImpl : virtual public SocketOptions {
00039 
00040     public:
00041 
00047       virtual void create() = 0;
00048   
00056       virtual void bind(const Ref<InetAddress>& laddr, jint lport) = 0;
00057 
00075       virtual void connect(const Ref<InetAddress>& address, jint port);
00076   
00081       virtual void disconnect();
00082 
00093       virtual void send(const Ref<DatagramPacket>& p) = 0;
00094 
00104       virtual jint peek(const Ref<InetAddress>& i) = 0;
00105 
00118       virtual jint peekData(const Ref<DatagramPacket>& p) = 0;
00119 
00129       virtual void receive(const Ref<DatagramPacket>& p) = 0;
00130 
00138       virtual void setTimeToLive(jint ttl) = 0;
00139 
00147       virtual jint getTimeToLive() const = 0;
00148 
00155       virtual void join(const Ref<InetAddress>& inetaddr) = 0;
00156 
00163       virtual void leave(const Ref<InetAddress>& inetaddr) = 0;
00164 
00174       virtual void joinGroup(const Ref<SocketAddress>& mcastaddr, const Ref<NetworkInterface>& netIf) = 0;
00175 
00184       virtual void leaveGroup(const Ref<SocketAddress>& mcastaddr, const Ref<NetworkInterface>& netIf) = 0;
00185 
00191       virtual void close() = 0;
00192 
00199       virtual Ref<FileDescriptor> getFileDescriptor() const;
00200 
00207       virtual Ref<InetAddress> getInetAddress() const;
00208 
00215       virtual jint getPort() const;
00216 
00223       virtual Ref<InetAddress> getLocalAddress() const;
00224 
00231       virtual jint getLocalPort() const;
00232 
00239       jboolean isConnected() const;
00240 
00248       jboolean isBound() const;
00249 
00257       jboolean isClosed() const;
00258 
00264       virtual String toString() const;
00265 
00266     protected:
00267 
00268       DatagramSocketImpl();
00269 
00273       Ref<FileDescriptor> fd;
00274 
00275       Ref<InetAddress> localAddress;
00276       jint localPort;
00277 
00281       jboolean bound;
00282       jboolean connected;
00283       Ref<InetAddress> connectedAddress;
00284       jint connectedPort;
00285 
00286     private:
00287 
00288       REGISTER_MEMBERS;
00289 
00290     };
00291 
00292   } // namespace net
00293 } // namespace java
00294 
00295 #endif /* JAVA_NET_DATAGRAMSOCKETIMPL_H */

Generated on Fri May 16 11:54:43 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3