001    /**
002     * Copyright (C) 2009-2013 Barchart, Inc. <http://www.barchart.com/>
003     *
004     * All rights reserved. Licensed under the OSI BSD License.
005     *
006     * http://www.opensource.org/licenses/bsd-license.php
007     */
008    package com.barchart.udt;
009    
010    /**
011     * UDT socket mode type.
012     * 
013     * NOTE: {@link #TypeUDT} means stream vs datagram;
014     * {@link com.barchart.udt.nio.KindUDT} means server vs client.
015     * <p>
016     * maps to socket.h constants<br>
017     * SOCK_STREAM = 1<br>
018     * SOCK_DGRAM = 2<br>
019     */
020    public enum TypeUDT {
021    
022            /**
023             * The STREAM type. Defines "byte stream" UDT mode.
024             */
025            STREAM(1), //
026    
027            /**
028             * The DATAGRAM. Defines "datagram or message" UDT mode.
029             */
030            DATAGRAM(2), //
031    
032            ;
033    
034            protected final int code;
035    
036            /**
037             * native UDT constant
038             */
039            public int code() {
040                    return code;
041            }
042    
043            /**
044             * @param code
045             *            native UDT constant
046             */
047            private TypeUDT(final int code) {
048                    this.code = code;
049            }
050    
051    }