Skip to content

Commit

Permalink
Rd fixes (#57)
Browse files Browse the repository at this point in the history
* Modify set of things changed

* Fix the version number and copyright notice

* Update to -13 of OSCORE

Try and get all of the -13 changes in the code.

* Bugs found during client testing

* Allow CoapClient to be passed a NULL URL on construction
* Get the callbacks to work better for DTLS interfacing.
*  Change OSCORE option from 21 to 9 - Still not final value.
*  We need to be able to change the code on a message - set things up to allow this.
* Fix problems with observe processing in OSCORE

* Get netstardard 1.3 working

Get the multiple frame work build running correct.  Still need to figure out a story for testing.

* Fix to use new build file

* New version of nuget

* Change version of nunit runners again

* Package needs nunit installed

* try again

* restore on appveyor

* Get newer nuget

* correct section

* copy it in by hand.

* add package name

* Try this way to get the package installed

* Add more packages.

* typo

* Add more references

* Add dependencies to client code

* Kill unused file

* Update the packages we need.

* Find out wihch is failing

Remove 2.0

* Update the media types

Make the media types match the IANA registry.

* More media types

* Add multicast addresses to an endpoint

Setup to add multicast endpoints to the system.

* Checkpoint in

Just put in everything to start the drop process.

* Ifdef out all of the CWT stuff

* Correct testing to use correct framework

* Push up changes to examples build files

* Get the versions right

* update docs
  • Loading branch information
jimsch authored Sep 11, 2019
1 parent e25bc63 commit 5cc9a08
Show file tree
Hide file tree
Showing 66 changed files with 2,261 additions and 928 deletions.
22 changes: 22 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
jobs:
build:
docker:
- image: microsoft/dotnet:2-sdk

working_directory: ~/repo

steps:
- checkout

- run:
name: Get Examples
command: git clone --depth 1 https://github.com/cose-wg/Examples Regressions

- run:
name: Unit Tests
command: |
ls
dotnet build --framework=netcoreapp2.0 CoAP.Std10.sln
dotnet test --framework=netcoreapp2.0 CoAP.Std10.sln
90 changes: 16 additions & 74 deletions CoAP.Example/CoAP.Client/CoAP.Client.Std10.csproj
Original file line number Diff line number Diff line change
@@ -1,85 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{30223FF5-4DCB-45B8-9B06-61EB9FBF9FA8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Com.AugustCellars.CoAP.Examples</RootNamespace>
<AssemblyName>CoAPClient</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<IntermediateOutputPath>obj\Debug\Std10</IntermediateOutputPath>
<OutputPath>bin\Debug\Std10\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Release\Std10</IntermediateOutputPath>
<OutputPath>bin\Release\Std10\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Deploy|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Deploy\Std10</IntermediateOutputPath>
<OutputPath>bin\Deploy\Std10\</OutputPath>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Compile Include="ExampleClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\CoAP.NET\CoAP.Std10.csproj">
<Project>{45db1e45-4831-4e4a-bb1e-ae92eea182e3}</Project>
<Name>CoAP.Std10</Name>
</ProjectReference>
<Folder Include="Properties\" />
</ItemGroup>


<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="CBOR, Version=3.0.3.0, Culture=neutral, PublicKeyToken=9cd62db60ea5554c, processorArchitecture=MSIL">
<HintPath>..\..\packages\PeterO.Cbor.3.0.3\lib\netstandard1.0\CBOR.dll</HintPath>
</Reference>
<Reference Include="Numbers, Version=1.0.2.0, Culture=neutral, PublicKeyToken=9cd62db60ea5554c, processorArchitecture=MSIL">
<HintPath>..\..\packages\PeterO.Numbers.1.0.2\lib\netstandard1.0\Numbers.dll</HintPath>
</Reference>
<Reference Include="COSE, Version=1.3.0.0, Culture=neutral, PublicKeyToken=feba232d7e8953ed">
<HintPath>..\..\packages\Com.AugustCellars.COSE.1.3.0\lib\netstandard1.0\COSE.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CoAP.NET\CoAP.Std10.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>
6 changes: 5 additions & 1 deletion CoAP.Example/CoAP.Client/ExampleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,18 @@ private static SecurityContextSet LoadContextSet(string fileName)
if (usage == "oscoap") {
SecurityContext ctx = SecurityContext.DeriveContext(
key[CoseKeyParameterKeys.Octet_k].GetByteString(),
null,
key[CBORObject.FromObject("RecipID")].GetByteString(),
key[CBORObject.FromObject("SenderID")].GetByteString(), null,
key[CoseKeyKeys.Algorithm]);
SecurityContextSet.AllContexts.Add(ctx);
break;
}
else if (usage == "oscoap-group") {
SecurityContext ctx = SecurityContext.DeriveGroupContext(key[CoseKeyParameterKeys.Octet_k].GetByteString(), key[CBORObject.FromObject(2)].GetByteString(), key[CBORObject.FromObject("SenderID")].GetByteString(), null, null, key[CoseKeyKeys.Algorithm]);
SecurityContext ctx = SecurityContext.DeriveGroupContext(
key[CoseKeyParameterKeys.Octet_k].GetByteString(), key[CBORObject.FromObject(2)].GetByteString(), key[CBORObject.FromObject("SenderID")].GetByteString(),
null, null,
null, null, null, key[CoseKeyKeys.Algorithm]);
foreach (CBORObject recipient in key[CBORObject.FromObject("recipients")].Values) {
ctx.AddRecipient(recipient[CBORObject.FromObject("RecipID")].GetByteString(), new OneKey( recipient[CBORObject.FromObject("sign")]));
}
Expand Down
4 changes: 2 additions & 2 deletions CoAP.Example/CoAP.Client/packages.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Com.AugustCellars.COSE" version="1.3.0" targetFramework="net462" />
<package id="Com.AugustCellars.COSE" version="1.5.0" targetFramework="net462" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net45" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net45" />
<package id="PeterO.Cbor" version="3.0.3" targetFramework="net45" />
<package id="PeterO.Numbers" version="1.0.2" targetFramework="net45" />
<package id="Portable.BouncyCastle" version="1.8.3" targetFramework="net462" />
<package id="Portable.BouncyCastle" version="1.8.4" targetFramework="net462" />
<package id="System.Collections" version="4.3.0" targetFramework="net45" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net45" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net45" />
Expand Down
84 changes: 16 additions & 68 deletions CoAP.Example/CoAP.Server/CoAP.Server.Std10.csproj
Original file line number Diff line number Diff line change
@@ -1,79 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{05CC2E5E-B663-4560-844C-C8E52ED1C9D1}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Com.AugustCellars.CoAP.Examples</RootNamespace>
<AssemblyName>CoAPServer</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<IntermediateOutputPath>obj\Debug\Std10</IntermediateOutputPath>
<OutputPath>bin\Debug\Std10\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Release\Std10</IntermediateOutputPath>
<OutputPath>bin\Release\Std10\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Deploy|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Deploy\Std10</IntermediateOutputPath>
<OutputPath>bin\Deploy\Std10\</OutputPath>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Compile Include="ExampleServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\CarelessResource.cs" />
<Compile Include="Resources\FibonacciResource.cs" />
<Compile Include="Resources\HelloWorldResource.cs" />
<Compile Include="Resources\ImageResource.cs" />
<Compile Include="Resources\LargeResource.cs" />
<Compile Include="Resources\MirrorResource.cs" />
<Compile Include="Resources\SeparateResource.cs" />
<Compile Include="Resources\StorageResource.cs" />
<Compile Include="Resources\TimeResource.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CoAP.NET\CoAP.Std10.csproj">
<Project>{45DB1E45-4831-4E4A-BB1E-AE92EEA182E3}</Project>
<Name>CoAP.Std10</Name>
</ProjectReference>
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>


<ItemGroup>
<None Include="app.config" />
<Folder Include="Properties\" />
</ItemGroup>


<ItemGroup>
<Reference Include="System" />
<ProjectReference Include="..\..\CoAP.NET\CoAP.Std10.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>
2 changes: 1 addition & 1 deletion CoAP.Example/CoAP.Server/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.8.2.0" newVersion="1.8.2.0"/>
<bindingRedirect oldVersion="0.0.0.0-1.8.2.0" newVersion="1.8.4.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
8 changes: 7 additions & 1 deletion CoAP.NET/Channel/DataReceivedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ public class DataReceivedEventArgs : EventArgs
{
/// <summary>
/// </summary>
public DataReceivedEventArgs(Byte[] data, System.Net.EndPoint endPoint, ISession session)
public DataReceivedEventArgs(Byte[] data, System.Net.EndPoint endPoint, System.Net.EndPoint endPointLocal, ISession session)
{
Data = data;
EndPoint = endPoint;
Session = session;
LocalEndPoint = endPointLocal;
}

/// <summary>
Expand All @@ -37,6 +38,11 @@ public DataReceivedEventArgs(Byte[] data, System.Net.EndPoint endPoint, ISession
/// </summary>
public System.Net.EndPoint EndPoint { get; }

/// <summary>
/// Get the <see cref="System.Net.Endpoint"/> where the data was received.
/// </summary>
public System.Net.EndPoint LocalEndPoint { get; }

/// <summary>
/// Gets the communication session for the message.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions CoAP.NET/Channel/IChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

using System;
using System.Net;

namespace Com.AugustCellars.CoAP.Channel
{
Expand All @@ -26,6 +27,14 @@ public interface IChannel : IDisposable
/// Occurs when some bytes are received in this channel.
/// </summary>
event EventHandler<DataReceivedEventArgs> DataReceived;
#if !NETSTANDARD1_3
/// <summary>
/// Add a multicast address to the channel
/// </summary>
/// <param name="ep">address to add</param>
/// <returns>true if added</returns>
bool AddMulticastAddress(IPEndPoint ep);
#endif
/// <summary>
/// Starts this channel.
/// </summary>
Expand Down
Loading

0 comments on commit 5cc9a08

Please sign in to comment.