Commit 672e657b authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Titan SCTPasp TP Initial Contribution

parent 49ca481d
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 Ericsson
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
File: SCTPasp_CNL113469.tpd
Description: tpd project file
Rev: R11A
Prodnr: CNL 113 469
Updated: 2014-09-24
Contact: http://ttcn.ericsson.se
-->
<TITAN_Project_File_Information version="1.0">
<ProjectName>SCTPasp_CNL113469</ProjectName>
<Folders>
<FolderResource projectRelativePath="src" relativeURI="src"/>
</Folders>
<Files>
<FileResource projectRelativePath="src/SCTPasp_PT.cc" relativeURI="src/SCTPasp_PT.cc"/>
<FileResource projectRelativePath="src/SCTPasp_PT.hh" relativeURI="src/SCTPasp_PT.hh"/>
<FileResource projectRelativePath="src/SCTPasp_PortType.ttcn" relativeURI="src/SCTPasp_PortType.ttcn"/>
<FileResource projectRelativePath="src/SCTPasp_Types.ttcn" relativeURI="src/SCTPasp_Types.ttcn"/>
</Files>
<ActiveConfiguration>Default</ActiveConfiguration>
<Configurations>
<Configuration name="Default">
<ProjectProperties>
<MakefileSettings>
<generateInternalMakefile>true</generateInternalMakefile>
<GNUMake>true</GNUMake>
<incrementalDependencyRefresh>true</incrementalDependencyRefresh>
<targetExecutable>bin/SCTPasp_CNL113469</targetExecutable>
<preprocessorDefines>
<listItem>USE_SCTP</listItem>
</preprocessorDefines>
<buildLevel>Level 3 - Creating object files with dependency update</buildLevel>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</Configuration>
</Configurations>
</TITAN_Project_File_Information>
This diff is collapsed.
/******************************************************************************
* Copyright (c) 2005, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Peter Dimitrov- initial implementation and initial documentation
* Adam Delic
* Eduard Czimbalmos
* Endre Kulcsar
* Gabor Bettesch
* Gabor Szalai
* Tamas Buti
* Zoltan Medve
******************************************************************************/
//
// File: SCTPasp_PT.hh
// Description: SCTPasp test port header
// Rev: R11A
// Prodnr: CNL 113 469
//
#ifndef SCTPasp__PT_HH
#define SCTPasp__PT_HH
#include <TTCN3.hh>
#include "SCTPasp_Types.hh"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
namespace SCTPasp__Types {
class ASP__SCTP;
class ASP__SCTP__Connect;
class ASP__SCTP__ConnectFrom;
class ASP__SCTP__Listen;
class SCTP__INIT;
class SCTP__EVENTS;
class SO__LINGER;
class SCTP__RTOINFO;
class SAC__STATE;
class SPC__STATE;
class ASP__SCTP__SetSocketOptions;
class ASP__SCTP__Close;
class ASP__SCTP__ASSOC__CHANGE;
class ASP__SCTP__PEER__ADDR__CHANGE;
class ASP__SCTP__SEND__FAILED;
class ASP__SCTP__REMOTE__ERROR;
class ASP__SCTP__SHUTDOWN__EVENT;
class ASP__SCTP__PARTIAL__DELIVERY__EVENT;
class ASP__SCTP__ADAPTION__INDICATION;
class ASP__SCTP__Connected;
class ASP__SCTP__SENDMSG__ERROR;
class ASP__SCTP__RESULT;
}
namespace SCTPasp__PortType {
class SCTPasp__PT_PROVIDER : public PORT {
public:
SCTPasp__PT_PROVIDER(const char *par_port_name = NULL);
~SCTPasp__PT_PROVIDER();
void set_parameter(const char *parameter_name,
const char *parameter_value);
void Event_Handler(const fd_set *read_fds,
const fd_set *write_fds, const fd_set *error_fds,
double time_since_last_call);
protected:
void user_map(const char *system_port);
void user_unmap(const char *system_port);
void user_start();
void user_stop();
void outgoing_send(const SCTPasp__Types::ASP__SCTP__Connect& send_par);
void outgoing_send(const SCTPasp__Types::ASP__SCTP__ConnectFrom& send_par);
void outgoing_send(const SCTPasp__Types::ASP__SCTP__Listen& send_par);
void outgoing_send(const SCTPasp__Types::ASP__SCTP__SetSocketOptions& send_par);
void outgoing_send(const SCTPasp__Types::ASP__SCTP__Close& send_par);
void outgoing_send(const SCTPasp__Types::ASP__SCTP& send_par);
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__PEER__ADDR__CHANGE& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__SEND__FAILED& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__REMOTE__ERROR& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__SHUTDOWN__EVENT& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__PARTIAL__DELIVERY__EVENT& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__ADAPTION__INDICATION& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__Connected& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__SENDMSG__ERROR& incoming_par) = 0;
virtual void incoming_message(const SCTPasp__Types::ASP__SCTP__RESULT& incoming_par) = 0;
private:
enum return_value_t { WHOLE_MESSAGE_RECEIVED, PARTIAL_RECEIVE, EOF_OR_ERROR };
return_value_t getmsg(int fd, struct msghdr *msg);
void handle_event(void *buf);
void log(const char *fmt, ...);
void error(const char *fmt, ...);
void handle_event_reconnect(void *buf);
void forced_reconnect(int attempts);
// map operations
void map_put_item(int fd);
int map_get_item(int fd);
void map_delete_item_fd(int fd);
void map_delete_item(int index);
void map_put_item_server(int fd, struct in_addr local_IP_address, unsigned short local_port);
int map_get_item_server(int fd);
void map_delete_item_fd_server(int fd);
void map_delete_item_server(int index);
void create_socket();
in_addr get_in_addr(const char *hostname);
void setNonBlocking(int fd);
boolean simple_mode;
boolean reconnect;
int reconnect_max_attempts;
boolean server_mode;
boolean debug;
int server_backlog;
struct in_addr local_IP_address;
struct in_addr peer_IP_address;
unsigned short local_port;
unsigned short peer_port;
struct sctp_event_subscribe events;
struct sctp_initmsg initmsg;
boolean local_port_is_present;
boolean peer_IP_address_is_present;
boolean peer_port_is_present;
int fd;
fd_set readfds, writefds;
int receiving_fd;
struct fd_map_item;
fd_map_item *fd_map;
int list_len;
struct fd_map_server_item;
fd_map_server_item *fd_map_server;
int list_len_server;
};
}
#endif
/******************************************************************************
* Copyright (c) 2005, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Peter Dimitrov- initial implementation and initial documentation
* Adam Delic
* Eduard Czimbalmos
* Endre Kulcsar
* Gabor Bettesch
* Gabor Szalai
* Tamas Buti
* Zoltan Medve
******************************************************************************/
//
// File: SCTPasp_PortType.ttcn
// Description: SCTPasp testport definition file
// Rev: R11A
// Prodnr: CNL 113 469
//
module SCTPasp_PortType
{
import from SCTPasp_Types all;
//=========================================================================
//Port Types
//=========================================================================
type port SCTPasp_PT message
{
inout ASP_SCTP;
out ASP_SCTP_Connect;
out ASP_SCTP_ConnectFrom;
out ASP_SCTP_Listen;
out ASP_SCTP_SetSocketOptions;
out ASP_SCTP_Close;
in ASP_SCTP_ASSOC_CHANGE;
in ASP_SCTP_PEER_ADDR_CHANGE;
in ASP_SCTP_SEND_FAILED;
in ASP_SCTP_REMOTE_ERROR;
in ASP_SCTP_SHUTDOWN_EVENT;
in ASP_SCTP_PARTIAL_DELIVERY_EVENT;
in ASP_SCTP_ADAPTION_INDICATION;
in ASP_SCTP_Connected;
in ASP_SCTP_SENDMSG_ERROR;
in ASP_SCTP_RESULT;
} with { extension "provider" }
}//end of module
with {
extension "version R11A"
}
/******************************************************************************
* Copyright (c) 2005, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Peter Dimitrov- initial implementation and initial documentation
* Adam Delic
* Eduard Czimbalmos
* Endre Kulcsar
* Gabor Bettesch
* Gabor Szalai
* Tamas Buti
* Zoltan Medve
******************************************************************************/
//
// File: SCTPasp_Types.ttcn
// Description: SCTP ASP definition file
// Rev: R11A
// Prodnr: CNL 113 469
//
module SCTPasp_Types
{
//=========================================================================
// Data Types
//=========================================================================
type octetstring PDU_SCTP;
type record ASP_SCTP
{
integer client_id optional,
integer sinfo_stream,
integer sinfo_ppid,
PDU_SCTP data
}
type record ASP_SCTP_Connect
{
charstring peer_hostname optional,
integer peer_portnumber (1..65535) optional
}
type record ASP_SCTP_ConnectFrom
{
charstring local_hostname optional,
integer local_portnumber (1..65535),
charstring peer_hostname optional,
integer peer_portnumber (1..65535) optional
}
type record ASP_SCTP_Listen
{
charstring local_hostname optional,
integer local_portnumber (1..65535)
}
type record SCTP_INIT
{
integer sinit_num_ostreams,
integer sinit_max_instreams,
integer sinit_max_attempts,
integer sinit_max_init_timeo
}
type record SCTP_EVENTS
{
boolean sctp_data_io_event,
boolean sctp_association_event,
boolean sctp_address_event,
boolean sctp_send_failure_event,
boolean sctp_peer_error_event,
boolean sctp_shutdown_event,
boolean sctp_partial_delivery_event,
boolean sctp_adaption_layer_event
}
type record SO_LINGER
{
integer l_onoff,
integer l_linger
}
type record SCTP_RTOINFO
{
integer client_id,
integer srto_initial,
integer srto_max,
integer srto_min
}
type union ASP_SCTP_SetSocketOptions
{
SCTP_INIT Sctp_init,
SCTP_EVENTS Sctp_events,
SO_LINGER So_linger,
SCTP_RTOINFO Sctp_rtoinfo
}
type record ASP_SCTP_Close
{
integer client_id optional
}
type enumerated SAC_STATE
{
SCTP_COMM_UP, SCTP_COMM_LOST, SCTP_RESTART,
SCTP_SHUTDOWN_COMP, SCTP_CANT_STR_ASSOC, SCTP_UNKNOWN_SAC_STATE
}
type record ASP_SCTP_ASSOC_CHANGE
{
integer client_id,
SAC_STATE sac_state
}
type enumerated SPC_STATE
{
SCTP_ADDR_AVAILABLE, SCTP_ADDR_UNREACHABLE, SCTP_ADDR_REMOVED,
SCTP_ADDR_ADDED, SCTP_ADDR_MADE_PRIM, SCTP_ADDR_CONFIRMED, SCTP_UNKNOWN_SPC_STATE
}
type record ASP_SCTP_PEER_ADDR_CHANGE
{
integer client_id,
SPC_STATE spc_state
}
type record ASP_SCTP_SEND_FAILED
{
integer client_id
}
type record ASP_SCTP_REMOTE_ERROR
{
integer client_id
}
type record ASP_SCTP_SHUTDOWN_EVENT
{
integer client_id
}
type record ASP_SCTP_PARTIAL_DELIVERY_EVENT
{
integer client_id
}
type record ASP_SCTP_ADAPTION_INDICATION
{
integer client_id
}
type record ASP_SCTP_Connected
{
integer client_id,
charstring local_hostname,
integer local_portnumber (1..65535),
charstring peer_hostname,
integer peer_portnumber (1..65535)
}
type record ASP_SCTP_SENDMSG_ERROR
{
integer client_id optional,
integer sinfo_stream,
integer sinfo_ppid,
PDU_SCTP data
}
type record ASP_SCTP_RESULT
{
integer client_id optional,
boolean error_status,
charstring error_message optional
}
}//end of module
with {
extension "version R11A"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment