We should add a license statement at the top of code. ROS is an open source software framework, and it's in the BSD license. The following is a code snippet of LICENSE, which must be inserted at the top of the code. You will get the license agreement from any of the ROS nodes from the main repository. You can check the source code from the ROS tutorial at https://github.com/ros/ros_tutorials:
/********************************************************************** Software License Agreement (BSD License)** Copyright (c) 2012, Willow Garage, Inc.* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:*********************************************************************/ ...