PageRenderTime 25ms CodeModel.GetById 10ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/sctp/SctpServerChannel.java

http://mobicents.googlecode.com/
Java | 95 lines | 32 code | 12 blank | 51 comment | 0 complexity | ce9ef09e22f972cf2908074e45934460 MD5 | raw file
 1/*
 2 * JBoss, Home of Professional Open Source
 3 * Copyright 2011, Red Hat, Inc. and individual contributors
 4 * by the @authors tag. See the copyright.txt in the distribution for a
 5 * full listing of individual contributors.
 6 *
 7 * This is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU Lesser General Public License as
 9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22
23package org.mobicents.protocols.ss7.m3ua.impl.sctp;
24
25import java.io.IOException;
26import java.net.SocketAddress;
27import java.nio.channels.spi.AbstractSelectableChannel;
28
29import org.mobicents.protocols.ss7.m3ua.M3UAChannel;
30import org.mobicents.protocols.ss7.m3ua.impl.M3UAServerChannelImpl;
31
32/**
33 * @author amit bhayani
34 * 
35 */
36public class SctpServerChannel extends M3UAServerChannelImpl {
37
38	private SctpProvider provider;
39
40	/**
41	 * @param channel
42	 * @throws IOException
43	 */
44	public SctpServerChannel(SctpProvider provider,
45			AbstractSelectableChannel channel) throws IOException {
46		super(channel);
47		this.provider = provider;
48	}
49
50	/**
51	 * Opens new M3UA channel.
52	 * 
53	 * @return the new M3UA channel
54	 * @throws java.io.IOException
55	 */
56	public static SctpServerChannel open(SctpProvider provider)
57			throws IOException {
58		return new SctpServerChannel(provider,
59				com.sun.nio.sctp.SctpServerChannel.open());
60	}
61
62	/*
63	 * (non-Javadoc)
64	 * 
65	 * @see org.mobicents.protocols.ss7.m3ua.M3UAServerChannel#accept()
66	 */
67	@Override
68	public M3UAChannel accept() throws IOException {
69		return new SctpChannel(provider,
70				((com.sun.nio.sctp.SctpServerChannel) channel).accept());
71	}
72
73	/*
74	 * (non-Javadoc)
75	 * 
76	 * @see org.mobicents.protocols.ss7.m3ua.M3UAServerChannel#bind(java.net.
77	 * SocketAddress)
78	 */
79	@Override
80	public void bind(SocketAddress address) throws IOException {
81		((com.sun.nio.sctp.SctpServerChannel) channel).bind(address);
82
83	}
84
85	/*
86	 * (non-Javadoc)
87	 * 
88	 * @see org.mobicents.protocols.ss7.m3ua.M3UAServerChannel#close()
89	 */
90	@Override
91	public void close() throws IOException {
92		((com.sun.nio.sctp.SctpServerChannel) channel).close();
93	}
94
95}