Revision: 15840
Author: [email protected]
Date: Fri Dec 17 02:11:58 2010
Log: Fix for The native code for dahdi cards should be independent project
under /ss7. http://code.google.com/p/mobicents/issues/detail?id=2217
http://code.google.com/p/mobicents/source/detail?r=15840
Added:
/trunk/protocols/ss7/hardware/dahdi
/trunk/protocols/ss7/hardware/dahdi/java
/trunk/protocols/ss7/hardware/dahdi/java/pom.xml
/trunk/protocols/ss7/hardware/dahdi/java/src
/trunk/protocols/ss7/hardware/dahdi/java/src/main
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/Mtp1.java
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/Channel.java
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/Selector.java
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/SelectorKeyImpl.java
/trunk/protocols/ss7/hardware/dahdi/native
/trunk/protocols/ss7/hardware/dahdi/native/linux
/trunk/protocols/ss7/hardware/dahdi/native/linux/pom.xml
/trunk/protocols/ss7/hardware/dahdi/native/pom.xml
/trunk/protocols/ss7/hardware/dahdi/native/src
/trunk/protocols/ss7/hardware/dahdi/native/src/main
/trunk/protocols/ss7/hardware/dahdi/native/src/main/native
/trunk/protocols/ss7/hardware/dahdi/native/src/main/native/schannel.c
/trunk/protocols/ss7/hardware/dahdi/pom.xml
/trunk/protocols/ss7/hardware/dialogic
/trunk/protocols/ss7/hardware/dialogic/java
/trunk/protocols/ss7/hardware/dialogic/java/pom.xml
/trunk/protocols/ss7/hardware/dialogic/java/src
/trunk/protocols/ss7/hardware/dialogic/java/src/main
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols/ss7
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols/ss7/hardware
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols/ss7/hardware/dialogic
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols/ss7/hardware/dialogic/InterProcessCommunicator.java
/trunk/protocols/ss7/hardware/dialogic/native
/trunk/protocols/ss7/hardware/dialogic/native/linux
/trunk/protocols/ss7/hardware/dialogic/native/linux/pom.xml
/trunk/protocols/ss7/hardware/dialogic/native/pom.xml
/trunk/protocols/ss7/hardware/dialogic/native/src
/trunk/protocols/ss7/hardware/dialogic/native/src/main
/trunk/protocols/ss7/hardware/dialogic/native/src/main/native
/trunk/protocols/ss7/hardware/dialogic/native/src/main/native/ipc.c
/trunk/protocols/ss7/hardware/dialogic/pom.xml
/trunk/protocols/ss7/hardware/pom.xml
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dahdi/java/pom.xml Fri Dec 17 02:11:58
2010
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dahdi-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dahdi</artifactId>
+ <name>Mobicents SS7 Dahdi Java</name>
+
+ <!-- Please don't use below property, rather use CLI System property
-Dmaven.test.skip=true/false -->
+ <properties>
+ <maven.test.skip>false</maven.test.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.mobicents.protocols.stream</groupId>
+ <artifactId>stream</artifactId>
+ <version>${stream.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>mobicents-dahdi</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <!-- So we dont have to juse xxxTest.java.bak
"_" -->
+ <!--
+ <excludes>
<exclude>**/TestCircle.java</exclude>
+ <exclude>**/TestSquare.java</exclude>
</excludes> <includes>
+ <include>Sample.java</include>
</includes>
+ -->
+ </configuration>
+
+ </plugin>
+ </plugins>
+ </build>
+</project>
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/Mtp1.java
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,95 @@
+/*
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software
Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA 02110-1301 USA
+ */
+package org.mobicents.protocols.ss7.hardware;
+
+import java.io.IOException;
+import org.mobicents.protocols.stream.api.Stream;
+
+/**
+ * @author baranowb
+ * @author kulikov
+ */
+public interface Mtp1 extends Stream {
+ // FIXME: Oleg what's that?
+ /**
+ * Gets the code of this channel.
+ *
+ * @return the code of this channel.
+ */
+ public int getCode();
+
+ /**
+ * Set MTP2 layer serving this MTP1
+ *
+ * @param link
+ */
+ public void setLink(Object link);
+
+ /**
+ * Get MTP2 layer serving this MTP1
+ *
+ * @return
+ */
+ public Object getLink();
+
+ /**
+ * Fetches implementation dependent IO Buffer size which should be used
+ *
+ * @return integer number, Mtp2 implementation should assign buffers of
this
+ * size to interact with Mtp1
+ */
+ public int getIOBufferSize();
+
+ /**
+ * Reads up to buffer.length bytes from layer 1.
+ *
+ * @param buffer
+ * reader buffer
+ * @return the number of actually read bytes.
+ */
+ public int read(byte[] buffer) throws IOException;
+
+ /**
+ * Writes data to layer 1.
+ *
+ * @param buffer
+ * the buffer containing data to write.
+ * @param bytesToWrite
+ */
+ public void write(byte[] buffer, int bytesToWrite) throws IOException;
+
+ /**
+ * Open message transfer part layer 1.
+ */
+ public void open() throws IOException;
+
+ /**
+ * Close message transfer part layer 1.
+ */
+ public void close();
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/Channel.java
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but
WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.mobicents.protocols.ss7.hardware.dahdi;
+
+import java.io.IOException;
+
+import org.mobicents.protocols.ss7.hardware.Mtp1;
+import org.mobicents.protocols.stream.api.SelectorKey;
+import org.mobicents.protocols.stream.api.SelectorProvider;
+import org.mobicents.protocols.stream.api.StreamSelector;
+
+/**
+ *
+ * @author kulikov
+ * @author baranowb
+ * @author amit bhayani
+ */
+public class Channel implements Mtp1 {
+
+ private final static String LIB_NAME = "dahdi-native-linux";
+
+ static {
+ try {
+ System.loadLibrary(LIB_NAME);
+ System.out.println("Loaded library
dahdi-native-linux");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private int span;
+ private int channelID;
+ private int code;
+ private String linkName;
+ private int ioBufferSize = 32; // lets default to 32, it seems optimal.
+ protected int fd;
+
+ private Object link;
+
+ protected SelectorKey selectorKey;
+
+ public Channel() {
+ }
+
+ public int getSpan() {
+ return span;
+ }
+
+ public void setSpan(int span) {
+ this.span = span;
+ }
+
+ public int getChannelID() {
+ return channelID;
+ }
+
+ public void setChannelID(int channelID) {
+ this.channelID = channelID;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setLinkName(String linkName) {
+ this.linkName = linkName;
+ }
+
+ public String getLinkName() {
+ return linkName;
+ }
+
+ public int getIOBufferSize() {
+ return ioBufferSize;
+ }
+
+ public void setIOBufferSize(int bufferSize) {
+ this.ioBufferSize = bufferSize;
+ }
+
+ public void open() {
+ int zapid = 31 * (span - 1) + channelID;
+ fd = openChannel(zapid, ioBufferSize);
+ }
+
+ /**
+ * Opens this channel and prepares it for reading.
+ *
+ * @param id
+ * - id of zap device, its appended at the end of path, for
+ * instance: /dev/dahdi/${id}
+ * @param bufferSize
+ * - size of buffer to be used for I/O ops.
+ */
+ public native int openChannel(int id, int bufferSize);
+
+ /**
+ * Reads data from this pipe.
+ *
+ * @param buffer
+ * the byte buffer to read data.
+ * @return the number of bytes actualy read.
+ */
+ public int read(byte[] buffer) throws IOException {
+ return readData(fd, buffer);
+ }
+
+ public native int readData(int fd, byte[] buffer);
+
+ /**
+ * Writes specified data to the pipe.
+ *
+ * @param buffer
+ * the buffer with data to write
+ * @param len
+ * the length of the buffer.
+ */
+ public int write(byte[] buffer) throws IOException {
+ writeData(fd, buffer, buffer.length);
+ return buffer.length; //?
+ }
+
+ public native void writeData(int fd, byte[] buffer, int len);
+
+ /**
+ * Registers pipe for polling.
+ *
+ * @param fd
+ * the file descriptor.
+ */
+ public native void doRegister(int fd);
+
+ /**
+ * Unregisters pipe from polling.
+ *
+ * @param fd
+ * the file descriptor.
+ */
+ public native void doUnregister(int fd);
+
+ public void close() {
+ closeChannel(fd);
+ }
+
+ /**
+ * Closes this pipe.
+ */
+ public native void closeChannel(int fd);
+
+ @Override
+ public String toString() {
+ return Integer.toString(channelID);
+ }
+
+ public void setLink(Object link) {
+ this.link = link;
+ }
+
+ public Object getLink() {
+ return this.link;
+ }
+
+ protected void doRegister(StreamSelector selector) {
+ doRegister(fd);
+ }
+
+ protected void doUnregister(StreamSelector selector) {
+ doUnregister(fd);
+ }
+
+ public boolean isReadable() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isWriteable() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public SelectorProvider provider() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public SelectorKey register(StreamSelector selector) throws IOException
{
+ return ((Selector) selector).register(this);
+ }
+
+ public void write(byte[] data, int len) throws IOException {
+ this.writeData(fd, data, len);
+ }
+
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/Selector.java
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but
WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.mobicents.protocols.ss7.hardware.dahdi;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+import org.mobicents.protocols.ss7.hardware.Mtp1;
+import org.mobicents.protocols.stream.api.SelectorKey;
+import org.mobicents.protocols.stream.api.Stream;
+import org.mobicents.protocols.stream.api.StreamSelector;
+
+public class Selector implements StreamSelector {
+
+ private final static String LIB_NAME = "dahdi-native-linux";
+
+ public final static int READ = 0x01;
+ public final static int WRITE = 0x02;
+
+ /** array of selected file descriptors */
+ private int fds[] = new int[16];
+
+ /** array of registered channels */
+ private ArrayList<Mtp1> registered = new ArrayList();
+
+ private int ops;
+
+ /** array of selected channels */
+ private ArrayList<SelectorKey> selected = new ArrayList();
+ private static Logger logger = Logger.getLogger(Selector.class);
+
+ static {
+ try {
+ System.loadLibrary(LIB_NAME);
+ System.out.println("Loaded library
dahdi-native-linux");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public Selector() {
+
+ }
+
+ /**
+ * Register channel with this selector.
+ *
+ * @param channel the channel to register.
+ */
+ public SelectorKey register(Channel channel) {
+ //add channel instance to the collection
+ registered.add(channel);
+ //perform actual registration
+ logger.info("Registering file descriptor:" + ((Channel) channel).fd);
+ doRegister(((Channel)channel).fd);
+
+ SelectorKeyImpl key = new SelectorKeyImpl(channel, this);
+ channel.selectorKey = key;
+ return key;
+ }
+
+ /**
+ * Unregister channel.
+ *
+ * @param channel the channel to unregister.
+ */
+ public void unregister(Channel channel) {
+ registered.remove(channel);
+ channel.selectorKey = null;
+ doUnregister(((Channel)channel).fd);
+ }
+
+ /**
+ * Registers pipe for polling.
+ *
+ *...@param fd the file descriptor.
+ */
+ public native void doRegister(int fd);
+
+ /**
+ * Unregisters pipe from polling.
+ *
+ * @param fd the file descriptor.
+ */
+ public native void doUnregister(int fd);
+
+ /**
+ * Delegates select call to unix poll function.
+ *
+ * @param fds the list of file descriptors.
+ * @param key selection key.
+ * @return the number of selected channels.
+ */
+ public native int doPoll(int[] fds, int key, int timeout);
+
+ public Collection<SelectorKey> selectNow(int ops, int timeout) throws
IOException {
+ int count = doPoll(fds, ops, 20);
+ selected.clear();
+ for (int i = 0; i < count; i++) {
+ for (Mtp1 chan : registered) {
+ Channel channel = (Channel) chan;
+ if (channel.fd == fds[i]) {
+ selected.add(channel.selectorKey);
+ }
+ }
+ }
+ return selected;
+ }
+
+ public void setOperation(int v) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public int getOperations() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isReadOperation() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isWriteOperation() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isClosed() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public void close() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Collection<Stream> getRegisteredStreams() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/hardware/dahdi/java/src/main/java/org/mobicents/protocols/ss7/hardware/dahdi/SelectorKeyImpl.java
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,64 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mobicents.protocols.ss7.hardware.dahdi;
+
+import org.mobicents.protocols.stream.api.SelectorKey;
+import org.mobicents.protocols.stream.api.Stream;
+import org.mobicents.protocols.stream.api.StreamSelector;
+
+/**
+ *
+ * @author kulikov
+ */
+public class SelectorKeyImpl implements SelectorKey {
+
+ private boolean isValid;
+ private boolean isReadable;
+ private boolean isWritable;
+
+ private Channel channel;
+ private Selector selector;
+
+ private Object attachment;
+
+ protected SelectorKeyImpl(Channel channel, Selector selector) {
+ this.channel = channel;
+ this.selector = selector;
+ }
+
+ public boolean isValid() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isReadable() {
+ return isReadable;
+ }
+
+ public boolean isWriteable() {
+ return isWritable;
+ }
+
+ public Stream getStream() {
+ return channel;
+ }
+
+ public StreamSelector getStreamSelector() {
+ return selector;
+ }
+
+ public void cancel() {
+ selector.unregister(channel);
+ }
+
+ public void attach(Object obj) {
+ this.attachment = obj;
+ }
+
+ public Object attachment() {
+ return this.attachment;
+ }
+
+}
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dahdi/native/linux/pom.xml Fri Dec 17
02:11:58 2010
@@ -0,0 +1,158 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dahdi-native</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>libmobicents-dahdi-linux</artifactId>
+
+ <properties>
+ <include.zap>/usr/include/dahdi</include.zap>
+ </properties>
+ <name>Mobicents Ss7 Dahdi Provider - Native - Linux</name>
+ <packaging>so</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dahdi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <testSourceDirectory>../src/test/java</testSourceDirectory>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+
+
<compilerProvider>generic</compilerProvider>
+ <compilerStartOptions>
+ <compilerStartOption>
+ -fPIC -O
+ </compilerStartOption>
+ </compilerStartOptions>
+
+ <javahOS>linux</javahOS>
+
+ <sources>
+ <source>
+
<directory>../src/main/native</directory>
+ <fileNames>
+
<fileName>schannel.c</fileName>
+ </fileNames>
+ </source>
+
+ <source>
+
+
<directory>${include.zap}</directory>
+
+ </source>
+
+ </sources>
+
+ <linkerStartOptions>
+ <linkerStartOption>
+ -shared -lc -ldl
+ </linkerStartOption>
+ </linkerStartOptions>
+
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>javah</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <classNames>
+ <className>
+
org.mobicents.protocols.ss7.hardware.dahdi.Channel
+ </className>
+ </classNames>
+ </configuration>
+ <goals>
+ <goal>javah</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>javah-1</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <classNames>
+ <className>
+
org.mobicents.protocols.ss7.hardware.dahdi.Selector
+ </className>
+ </classNames>
+ </configuration>
+ <goals>
+ <goal>javah</goal>
+ </goals>
+ </execution>
+
+
+ </executions>
+
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <environmentVariables>
+ <LD_LIBRARY_PATH>
+
${project.build.directory}
+ </LD_LIBRARY_PATH>
+ <systemProperties>
+ <property>
+
<name>lib_schannel</name>
+ <value>
+
${project.build.directory}
+ </value>
+ </property>
+ </systemProperties>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <profiles>
+ <!-- to build debug artifact, run maven install -Ddebug -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+
<compiler.debug.options>-MDd</compiler.debug.options>
+
<linker.debug.options>/DEBUG</linker.debug.options>
+ <classifier>debug</classifier>
+ </properties>
+ </profile>
+ <profile>
+ <id>release</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+
<compiler.debug.options>-MD</compiler.debug.options>
+ <linker.debug.options />
+ <classifier />
+ </properties>
+ </profile>
+ </profiles>
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dahdi/native/pom.xml Fri Dec 17 02:11:58
2010
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dahdi-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dahdi-native</artifactId>
+
+ <packaging>pom</packaging>
+
+ <name>Mobicents SS7 Dahdi Provider - Native</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <!-- We dont support other than lin, since there is no driver :)
-->
+ <!--
+ <profile>
+ <id>win</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>win32</value>
+ </property>
+ </activation>
+ <modules>
+ <module>win</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>solaris</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>solaris</value>
+ </property>
+ </activation>
+ <modules>
+ <module>solaris</module>
+ </modules>
+ </profile>
+ -->
+ <profile>
+ <id>dahdilinux</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>linux</value>
+ </property>
+ </activation>
+ <modules>
+ <module>linux</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>maven-release</id>
+ <modules>
+ <module>linux</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dahdi/native/src/main/native/schannel.c
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,221 @@
+#include <org_mobicents_protocols_ss7_hardware_dahdi_Channel.h>
+#include <org_mobicents_protocols_ss7_hardware_dahdi_Selector.h>
+#include <user.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/poll.h>
+
+#define ZAP_NUM_BUF 4
+
+int fd[16];
+struct pollfd fds[16];
+
+int channel_count;
+
+static int setnonblock_fd(int fd) {
+ int res, flags;
+ res = fcntl(fd, F_GETFL);
+
+ if (res < 0) {
+ return -1;
+ }
+
+ flags = res | O_NONBLOCK;
+
+ res = fcntl(fd, F_SETFL, flags);
+ if (res < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+JNIEXPORT void JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Selector_doRegister (JNIEnv
*env, jobject obj, jint fd) {
+ int i = channel_count;
+ channel_count = channel_count + 1;
+ fds[i].fd = fd;
+ fds[i].events = POLLIN|POLLPRI|POLLOUT;
+}
+
+JNIEXPORT void JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Selector_doUnregister
(JNIEnv *env, jobject obj, jint fd) {
+ struct pollfd temp[16];
+
+ int i;
+ int k;
+
+ for (i = 0; i < channel_count; i++) {
+ if (fds[i].fd != fd) {
+ temp[k++] = fds[i];
+ }
+ }
+
+ channel_count = channel_count - 1;
+
+ for (i = 0; i < channel_count; i++) {
+ fds[i] = temp[i];
+ }
+}
+
+JNIEXPORT jint JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Selector_doPoll (JNIEnv
*env, jobject obj, jintArray selected, jint flags, jint timeout) {
+ int res;
+ jint *elements = (*env)->GetIntArrayElements(env, selected, 0);
+
+ int s;
+ int k = 0;
+ int lflags = flags;
+
+ if ( (lflags & 0x1) ) {
+ s = POLLIN;
+ }
+ if ( (lflags & 0x2 ) ) {
+ s = s | POLLOUT;
+ }
+ res = poll(fds, channel_count, timeout);
+ if (res > 0) {
+ int i;
+ for (i = 0; i < channel_count; i++) {
+ if (fds[i].revents & s) {
+ elements[k++] = fds[i].fd;
+ }
+ }
+ }
+ (*env)->ReleaseIntArrayElements(env, selected, elements, 0);
+ return k;
+}
+
+JNIEXPORT jint JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Channel_openChannel
+ (JNIEnv *env, jobject obj, jint zapid, jint ioBufferSize) {
+ struct dahdi_bufferinfo bi;
+ char devname[100];
+
+ int fd;
+ int res;
+
+ sprintf(devname,"/dev/dahdi/%d",zapid );
+
+ fd = open(devname, O_RDWR);
+ if (fd < 0) {
+ return -1;
+ }
+
+
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.numbufs = ZAP_NUM_BUF;
+ bi.bufsize = ioBufferSize;
+
+ ioctl(fd, DAHDI_SET_BUFINFO, &bi);
+
+ res = setnonblock_fd(fd);
+ if (res < 0) {
+ return -1;
+ }
+
+ return fd;
+}
+
+
+
+/*
+ * Class: org_mobicents_media_server_impl_resource_zap_Schannel
+ * Method: read
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Channel_readData
+ (JNIEnv *env, jobject obj, jint fd, jbyteArray buff) {
+ int res = 0;
+ int count = 0;
+ unsigned char buffer[1024];
+ jbyte *elements = (*env)->GetByteArrayElements(env, buff, 0);
+
+ for (;;) {
+ //trying to read data
+ res = read(fd, buffer, 1024);
+ if(res > 0) {
+ //copy data to java array
+ int k;
+ for (k = 0; k < res; k++) {
+ elements[k + count] = buffer[k];
+ }
+ count = count + res;
+ break;
+ } else if( res == 0 ) {
+ break;
+ } else {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ break;
+ } else if (errno == EINTR) {
+ /* try again */
+ } else if (errno == ELAST) {
+ /* zap event */
+ } else {
+ /*some unexpected error*/
+ break;
+ }
+ }
+ }
+ (*env)->ReleaseByteArrayElements(env, buff, elements, 0);
+ return count;
+}
+
+
+
+
+/*
+ * Class: org_mobicents_media_server_impl_resource_zap_Schannel
+ * Method: write
+ * Signature: ([BI)V
+ */
+JNIEXPORT void JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Channel_writeData
+ (JNIEnv *env, jobject obj, jint fd, jbyteArray buff, jint length) {
+ int res;
+ int len = length;
+
+ unsigned char buffer[len];
+ jbyte *elements = (*env)->GetByteArrayElements(env, buff, 0);
+
+ //copy data
+ int i;
+ for (i = 0; i < len; i++) {
+ buffer[i] = elements[i];
+ }
+
+ //writting data
+ for (;;) {
+ res = write(fd, buffer, len);
+ if (res == 0) {
+ break;
+ } else if (res < 0) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ break;
+ } else if (errno == EINTR) {
+ //try again
+ } else if (errno == ELAST) {
+ //fetch zap event
+ } else {
+ //unexpected error
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ (*env)->ReleaseByteArrayElements(env, buff, elements, 0);
+}
+
+
+
+/*
+ * Class: org_mobicents_media_server_impl_resource_zap_Schannel
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
Java_org_mobicents_protocols_ss7_hardware_dahdi_Channel_closeChannel
(JNIEnv *env, jobject obj, jint fd) {
+ close(fd);
+}
+
+
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dahdi/pom.xml Fri Dec 17 02:11:58 2010
@@ -0,0 +1,20 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-hardware</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dahdi-parent</artifactId>
+
+ <packaging>pom</packaging>
+ <name>Mobicents SS7 Dahdi Provider</name>
+
+ <modules>
+ <module>native</module>
+ <module>java</module>
+ </modules>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dialogic/java/pom.xml Fri Dec 17 02:11:58
2010
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dialogic-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dialogic</artifactId>
+ <name>Mobicents SS7 Dialogic Java</name>
+
+ <!-- Please don't use below property, rather use CLI System property
-Dmaven.test.skip=true/false -->
+ <properties>
+ <maven.test.skip>false</maven.test.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.mobicents.protocols.stream</groupId>
+ <artifactId>stream</artifactId>
+ <version>${stream.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>mobicents-dahdi</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <!-- So we dont have to juse xxxTest.java.bak
"_" -->
+ <!--
+ <excludes>
<exclude>**/TestCircle.java</exclude>
+ <exclude>**/TestSquare.java</exclude>
</excludes> <includes>
+ <include>Sample.java</include>
</includes>
+ -->
+ </configuration>
+
+ </plugin>
+ </plugins>
+ </build>
+</project>
=======================================
--- /dev/null
+++
/trunk/protocols/ss7/hardware/dialogic/java/src/main/java/org/mobicents/protocols/ss7/hardware/dialogic/InterProcessCommunicator.java
Fri Dec 17 02:11:58 2010
@@ -0,0 +1,94 @@
+/*
+ * The Java Call Control API for CAMEL 2
+ *
+ * The source code contained in this file is in in the public domain.
+ * It can be used in any project or product without prior permission,
+ * license or royalty payments. There is NO WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION,
+ * THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE,
+ * AND DATA ACCURACY. We do not warrant or make any representations
+ * regarding the use of the software or the results thereof, including
+ * but not limited to the correctness, accuracy, reliability or
+ * usefulness of the software.
+ */
+
+package org.mobicents.protocols.ss7.hardware.dialogic;
+
+import java.io.IOException;
+
+/**
+ *
+ * @author Oleg Kulikov
+ */
+public class InterProcessCommunicator {
+ /** The identifier of the originated module */
+ private int source;
+ /** The identifier of the destination module */
+ private int destination;
+
+ /**
+ * Creates a new instance of InterProcessCommunicator
+ *
+ * @param source the integer identifier of the originated module
+ * @param destination the integer idenifier of the destination module.
+ */
+ public InterProcessCommunicator(int source, int destination) {
+ this.source = source;
+ this.destination = destination;
+ }
+
+ /**
+ * Receives a datagram from GCT Interprocess.
+ *
+ * @return received datagram.
+ */
+ public byte[] receive() throws IOException {
+ byte[] buffer = new byte[1000];
+ int len = receive(source, buffer);
+
+ if (len == -1) {
+ throw new IOException("Unable to read message from IPC");
+ }
+
+ byte[] message = new byte[len];
+ System.arraycopy(buffer, 0, message, 0, len);
+
+ return message;
+ }
+
+
+ /**
+ * Sends datagram to the destination module.
+ *
+ * @param packet the datagram to be sent.
+ */
+ public void send(byte[] packet) throws IOException {
+ int status = send(source, destination, packet);
+ if (status != 0) {
+ throw new IOException("Can not send packet");
+ }
+ }
+
+ /**
+ * Actualy receives datagram using Interprocces communication.
+ *
+ * @param source indicates the module id wich will receive datagrams.
+ * @param buffer the buffer wich should be used to store recevied
message.
+ * @return the actual length of the received message.
+ */
+ private native int receive(int source, byte[] buffer);
+
+ /**
+ * Actualy sends the message using interprocces communication.
+ *
+ * @param source the module id wich sends message.
+ * @param destionation the module id wich must receive message.
+ * @param buffer the buffer contained message.
+ * @return the number of actualy bytes sent.
+ */
+ private native int send(int source, int destination, byte[] buffer);
+
+ static {
+ System.loadLibrary("ipc");
+ }
+}
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dialogic/native/linux/pom.xml Fri Dec 17
02:11:58 2010
@@ -0,0 +1,137 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dialogic-native</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>libmobicents-dialogic-linux</artifactId>
+
+ <properties>
+ <include.dialogic>/usr/include/dialogic</include.dialogic>
+ </properties>
+ <name>Mobicents Ss7 Dialogic Provider - Native - Linux</name>
+ <packaging>so</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dialogic</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <testSourceDirectory>../src/test/java</testSourceDirectory>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+
+
<compilerProvider>generic</compilerProvider>
+ <compilerStartOptions>
+ <compilerStartOption>
+ -fPIC -O
+ </compilerStartOption>
+ </compilerStartOptions>
+
+ <javahOS>linux</javahOS>
+
+ <sources>
+ <source>
+
<directory>../src/main/native</directory>
+ <fileNames>
+
<fileName>ipc.c</fileName>
+ </fileNames>
+ </source>
+ <source>
+
<directory>${include.dialogic}</directory>
+ </source>
+ </sources>
+
+ <linkerStartOptions>
+ <linkerStartOption>
+ -shared -lc -ldl
+ </linkerStartOption>
+ </linkerStartOptions>
+
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>javah</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <classNames>
+ <className>
+
org.mobicents.protocols.ss7.hardware.dialogic.InterProcessCommunicator
+ </className>
+ </classNames>
+ </configuration>
+ <goals>
+ <goal>javah</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <environmentVariables>
+ <LD_LIBRARY_PATH>
+
${project.build.directory}
+ </LD_LIBRARY_PATH>
+ <systemProperties>
+ <property>
+
<name>lib_schannel</name>
+ <value>
+
${project.build.directory}
+ </value>
+ </property>
+ </systemProperties>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <profiles>
+ <!-- to build debug artifact, run maven install -Ddebug -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+
<compiler.debug.options>-MDd</compiler.debug.options>
+
<linker.debug.options>/DEBUG</linker.debug.options>
+ <classifier>debug</classifier>
+ </properties>
+ </profile>
+ <profile>
+ <id>release</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+
<compiler.debug.options>-MD</compiler.debug.options>
+ <linker.debug.options />
+ <classifier />
+ </properties>
+ </profile>
+ </profiles>
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dialogic/native/pom.xml Fri Dec 17
02:11:58 2010
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-dialogic-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dialogic-native</artifactId>
+
+ <packaging>pom</packaging>
+
+ <name>Mobicents SS7 Dialogic Provider - Native</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <!-- We dont support other than lin, since there is no driver :)
-->
+ <!--
+ <profile>
+ <id>win</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>win32</value>
+ </property>
+ </activation>
+ <modules>
+ <module>win</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>solaris</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>solaris</value>
+ </property>
+ </activation>
+ <modules>
+ <module>solaris</module>
+ </modules>
+ </profile>
+ -->
+ <profile>
+ <id>dialogiclinux</id>
+ <activation>
+ <property>
+ <name>platform</name>
+ <value>linux</value>
+ </property>
+ </activation>
+ <modules>
+ <module>linux</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>maven-release</id>
+ <modules>
+ <module>linux</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dialogic/native/src/main/native/ipc.c Fri
Dec 17 02:11:58 2010
@@ -0,0 +1,107 @@
+#include "system.h"
+#include "msg.h"
+#include "sysgct.h"
+
+#include
"org_mobicents_protocols_ss7_hardware_dialogic_InterProcessCommunicator.h"
+
+/*
+ * Class: org_mobicents_gct_InterProcessCommunicator
+ * Method: receive
+ * Signature: (I[B)I
+ */
+JNIEXPORT jint JNICALL
Java_org_mobicents_protocols_ss7_hardware_dialogic_InterProcessCommunicator_receive
+(JNIEnv *env, jobject obj, jint src_module_id, jbyteArray msg_buffer) {
+ jclass cls;
+ jfieldID fid;
+
+ jsize len;
+ jbyte *body;
+
+ u16 mlen; /* message length */
+ u8 *pptr; /* pointer into parameter area */
+
+ HDR* h;
+ int i;
+
+ h = GCT_receive(src_module_id);
+
+ if (h == 0) {
+ return -1;
+ }
+
+ len = (*env)->GetArrayLength(env, msg_buffer);
+ body = (*env)->GetByteArrayElements(env, msg_buffer, 0);
+
+ if ((mlen = ((MSG*) h)->len) > 0) {
+ pptr = get_param((MSG *) h);
+ i = 0;
+ while (mlen--) {
+ body[i++] = *pptr++;
+ }
+
+ (*env)->ReleaseByteArrayElements(env, msg_buffer, body, 0);
+
+ printf("MTP Message id: %d", h->id);
+
+ relm(h);
+ return i;
+ }
+
+
+ (*env)->ReleaseByteArrayElements(env, msg_buffer, body, 0);
+ relm(h);
+ return -1;
+
+}
+
+/*
+ * Class: org_mobicents_gct_InterProcessCommunicator
+ * Method: send
+ * Signature: (I[B)I
+ */
+JNIEXPORT jint JNICALL
Java_org_mobicents_protocols_ss7_hardware_dialogic_InterProcessCommunicator_send
+(JNIEnv *env, jobject obj, jint src_module_id, jint dest_module_id,
jbyteArray msg_buffer) {
+ jclass cls;
+ jfieldID fid;
+
+ jsize len;
+ jbyte *body;
+ int status;
+
+ HDR* h;
+ u8 *pptr;
+ int i;
+
+
+ printf("*********Preparing for sending data*******");
+
+ len = (*env)->GetArrayLength(env, msg_buffer);
+ body = (*env)->GetByteArrayElements(env, msg_buffer, 0);
+
+ ((MSG*) h) = getm(0xcf00, 3, 0,len);
+
+ if (h == 0) {
+ return -1;
+ }
+
+
+ h->src = src_module_id;
+ h->dst = dest_module_id;
+
+ ((MSG*) h)->len = len;
+
+ pptr = get_param((MSG *) h);
+
+ for(i = 0; i < len; i++) {
+ *pptr++ = body[i];
+ }
+
+ status = GCT_send(dest_module_id,h);
+
+ printf("Sent %d bytes, status %d", len, status);
+
+ (*env)->ReleaseByteArrayElements(env, msg_buffer, body, 0);
+
+ return status;
+}
+
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/dialogic/pom.xml Fri Dec 17 02:11:58 2010
@@ -0,0 +1,20 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-hardware</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mobicents-dialogic-parent</artifactId>
+
+ <packaging>pom</packaging>
+ <name>Mobicents SS7 Dialogic Provider</name>
+
+ <modules>
+ <module>native</module>
+ <module>java</module>
+ </modules>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/protocols/ss7/hardware/pom.xml Fri Dec 17 02:11:58 2010
@@ -0,0 +1,131 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>ss7-parent</artifactId>
+ <groupId>org.mobicents.protocols.ss7</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.mobicents.protocols.ss7.hardware</groupId>
+ <artifactId>mobicents-hardware</artifactId>
+
+ <name>
+ Mobicents SS7 :: Hardware :: Parent :: ${pom.artifactId}
+ </name>
+ <packaging>pom</packaging>
+
+
+ <properties>
+
+ </properties>
+
+ <modules>
+ <module>dahdi</module>
+ <module>dialogic</module>
+ </modules>
+
+ <scm>
+ <connection>
+
scm:svn:https://mobicents.googlecode.com/svn/trunk/protocols/ss7/hardware
+ </connection>
+ <developerConnection>
+
scm:svn:https://mobicents.googlecode.com/svn/trunk/protocols/ss7/hardware
+ </developerConnection>
+ <url>
+
http://mobicents.googlecode.com/svn/trunk/protocols/ss7/hardware
+ </url>
+ </scm>
+
+ <profiles>
+ <profile>
+ <id>maven-release</id>
+ <modules>
+ <module>dahdi</module>
+ <module>dialogic</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-9</version>
+ <configuration>
+ <autoVersionSubmodules>
+ true
+ </autoVersionSubmodules>
+
<remoteTagging>true</remoteTagging>
+ <tagBase>
+
https://mobicents.googlecode.com/svn/tags/protocols/ss7/hardware
+ </tagBase>
+ <preparationGoals>
+ clean install
+ </preparationGoals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>release</id>
+ <modules>
+ <module>docs</module>
+ <module>release</module>
+ </modules>
+ <!-- Add more if required -->
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${pom.artifactId}-${pom.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <groupId>org.mobicents.tools</groupId>
+ <version>
+
${mobicents.tools.mavenplugin.eclipse.version}
+ </version>
+ <inherited>false</inherited>
+ <executions />
+ <configuration>
+ <classpathExcludes>
+
<exclude>xml-apis:xml-apis</exclude>
+ <exclude>jtidy:jtidy</exclude>
+ </classpathExcludes>
+ <resolveTransitiveDependencies>
+ true
+ </resolveTransitiveDependencies>
+ <eclipseProjectName>
+ mobicents-ss7-hardware
+ </eclipseProjectName>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>file.name</name>
+
<value>target/log4j.log</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>